- I am downloading data from the cryptocurrency exchange
CodePudding user response:
The source code for this library shows two returned attributes:
dataandheadersCodePudding user response:
The naming used in the
dydx3library is a bit confusing,dydx3.helpers.requestsis not therequestsmodule.The
dydx3.helpers.requests.Responseobject only has 2 attributes:headerswhich contains the HTTP headers of the response from the APIdatawhich contains adicteither empty or containing the json data returned by the API.
So all you have to do in your code to get the data is:
from dydx3.helpers.request_helpers import generate_query_path from dydx3.helpers.requests import request class Public(object): def __init__( self, host, ): self.host = host # ============ Request Helpers ============ def _get(self, request_path, params={}): return request( generate_query_path(self.host request_path, params), 'get', ) def _put(self, endpoint, data): return request( self.host '/v3/' endpoint, 'put', {}, data, ) # ============ Requests ============ def get_historical_funding(self, market, effective_before_or_at=None): ''' Get historical funding for a market :param market: required :type market: str in list [ "BTC-USD", "ETH-USD", "LINK-USD", ... ] :param effective_before_or_at: optional :type effective_before_or_at: str :returns: Array of historical funding for a specific market :raises: DydxAPIError ''' uri = '/'.join(['/v3/historical-funding', market]) return self._get( uri, {'effectiveBeforeOrAt': effective_before_or_at}, ).data # CHANGE MADE HERE
