def user_trades(self, tids=[], book=None, marker=None, limit=25, sort='desc'): """Get a list of the user's transactions Args: book (str): Specifies which order book to get user trades from. marker (str, optional): Returns objects that are older or newer (depending on 'sort') than the object which has the marker value as ID limit (int, optional): Limit the number of results to parameter value, max=100, default=25 sort (str, optional): Sorting by datetime: 'asc', 'desc' Defuault is 'desc' Returns: A list bitso.UserTrade instances. """ url = '%s/user_trades/' % self.base_url if isinstance(tids, int): tids = str(tids) if isinstance(tids, basestring): tids = [tids] tids = map(str, tids) if tids: url += '%s/' % ('-'.join(tids)) parameters = {} if book: parameters['book'] = book if marker: parameters['marker'] = marker if limit: parameters['limit'] = limit if sort: if not isinstance(sort, basestring) or sort.lower() not in [ 'asc', 'desc' ]: raise ApiClientError( {u'message': u"sort is not 'asc' or 'desc' "}) parameters['sort'] = sort resp = self._request_url(url, 'GET', params=parameters, private=True) return [UserTrade._NewFromJsonDict(x) for x in resp['payload']]
def user_trades(self, tids=[], book=None, marker=None, limit=25, sort='desc'): """Get a list of the user's transactions Args: book (str): Specifies which order book to get user trades from. marker (str, optional): Returns objects that are older or newer (depending on 'sort') than the object which has the marker value as ID limit (int, optional): Limit the number of results to parameter value, max=100, default=25 sort (str, optional): Sorting by datetime: 'asc', 'desc' Defuault is 'desc' Returns: A list bitso.UserTrade instances. """ url = '%s/user_trades/' % self.base_url if isinstance(tids, int): tids = str(tids) if isinstance(tids, basestring): tids = [tids] tids = map(str, tids) if tids: url+='%s/' % ('-'.join(tids)) if book: url+='?book=%s' % book parameters = {} if marker: parameters['marker'] = marker if limit: parameters['limit'] = limit if sort: if not isinstance(sort, basestring) or sort.lower() not in ['asc', 'desc']: raise ApiClientError({u'message': u"sort is not 'asc' or 'desc' "}) parameters['sort'] = sort resp = self._request_url(url, 'GET', params=parameters, private=True) return [UserTrade._NewFromJsonDict(x) for x in resp['payload']]
def order_trades(self, oid): url = '%s/order_trades/%s' % (self.base_url, oid) resp = self._request_url(url, 'GET', params={}, private=True) return [UserTrade._NewFromJsonDict(x) for x in resp['payload']]