Ejemplo n.º 1
0
    def _get_all_markets(self) -> dict:
        _METHOD = "GET"
        _ENDPOINT = "/v1/markets"
        """
        :meth: _get_all_markets
        :args: None

        :returns:
        {
            "status": {
                "timestamp": "2018-06-02T22:51:28.209Z",
                "elapsed": 10
            },
            "data": [
            {
                "exchange": "binance",
                "base": "btc",
                "quote": "usdt",
                "pair": "btc-usdt"
                }
            ]
        }

        """
        _request = _check_endpoint(method=_METHOD,
                                   endpoint=_ENDPOINT,
                                   endpoint_dict=MARKET_ENDPOINTS)
        api_response = _request(url=self._PATH + _ENDPOINT,
                                headers=grab_headers())
        return api_response.get_json()
Ejemplo n.º 2
0
 def _get_asset_metrics_by_symbol(self, symbol: str) -> dict:
     """
     """
     _METHOD = "GET"
     _ENDPOINT = "v1/assets/<symbol>/metrics".replace("<symbol>", symbol)
     _REQUEST_FILTER = None  #no filters available for this endpoint
     _request = _check_endpoint(method=_METHOD,
                                endpoint=_ENDPOINT,
                                endpoint_dict=ASSET_ENDPOINTS)
     api_response = _request(url=self._PATH + _ENDPOINT,
                             headers=grab_headers())
     return api_response.get_json()
Ejemplo n.º 3
0
 def _get_only_asset_symbols(self) -> dict:
     """
     """
     _METHOD = "GET"
     _ENDPOINT = "/v1/assets"
     _request = _check_endpoint(method=_METHOD,
                                endpoint=_ENDPOINT,
                                endpoint_dict=ASSET_ENDPOINTS)
     api_response = _request(url=self._PATH + _ENDPOINT)
     symbols = [
         value["symbol"] for value in api_response["data"]
         if "data" in api_response
     ]
     return symbols
Ejemplo n.º 4
0
 def _get_all_assets(self, optional_filter="") -> dict:
     """
     """
     _METHOD = "GET"
     _ENDPOINT = "/v1/assets"
     _REQUEST_FILTER = _check_optional_filter(
         class_type=self._class_type, optional_filter=optional_filter)
     _request = _check_endpoint(method=_METHOD,
                                endpoint=_ENDPOINT,
                                endpoint_dict=ASSET_ENDPOINTS)
     if _REQUEST_FILTER is True:
         api_response = _request(url=self._PATH + _ENDPOINT +
                                 _REQUEST_FILTER,
                                 headers=grab_headers())
     else:
         api_response = _request(url=self._PATH + _ENDPOINT,
                                 headers=grab_headers())
     return api_response.get_json()
Ejemplo n.º 5
0
    def _get_all_news(self) -> dict:
        _METHOD = "GET"
        _ENDPOINT = "/v1/news"
        _REQUEST_FILTER = None  #no filters available for this endpoint
        """
        :meth: _get_all_news
        :args: optional
        :optional args: `optional_filter`

        :returns:
        {
            "status": {
                "timestamp": "2018-06-02T22:51:28.209Z",
                "elapsed": 10
                },
            "data": [
                {
                "symbol": "btc",
                "name": "Bitcoin",
                "id": "1e31218a"
                }
            ]
        }

        """
        _request = _check_endpoint(method=_METHOD,
                                   endpoint=_ENDPOINT,
                                   endpoint_dict=NEWS_ENDPOINTS)
        if _REQUEST_FILTER is True:
            api_response = _request(url=self._PATH + _ENDPOINT +
                                    _REQUEST_FILTER,
                                    headers=grab_headers())
        else:
            api_response = _request(url=self._PATH + _ENDPOINT,
                                    headers=grab_headers())
        return api_response