From dbcd4a767ac0b332ddbd68f7183ac2119f3945ce Mon Sep 17 00:00:00 2001 From: bas20150622 Date: Sat, 16 May 2020 16:06:51 +0200 Subject: [PATCH 1/2] added crypto_transactions --- bitstamp/client.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/bitstamp/client.py b/bitstamp/client.py index f781eba..d878958 100755 --- a/bitstamp/client.py +++ b/bitstamp/client.py @@ -253,7 +253,7 @@ def account_balance(self, base="btc", quote="usd"): url = self._construct_url("balance/", base, quote) return self._post(url, return_json=True, version=2) - def user_transactions(self, offset=0, limit=100, descending=True, + def user_transactions(self, offset=0, limit=1000, descending=True, base=None, quote=None): """ Returns descending list of transactions. Every transaction (dictionary) @@ -276,6 +276,25 @@ def user_transactions(self, offset=0, limit=100, descending=True, url = self._construct_url("user_transactions/", base, quote) return self._post(url, data=data, return_json=True, version=2) + def user_crypto_transactions(self, offset=0, limit=1000): + """ + Returns list of crypto transactions. Every transaction (dictionary) + contains:: + {u'currency' : u'xrp' + u'destinationAddress': 'Destination Address' + u'txid': 'Transaction Hash' + u'amount' u'1.0' + u'datetime': u'0.2'} + + Instead of the keys btc and usd, it can contain other currency codes + """ + data = { + 'offset': offset, + 'limit': limit, + } + url = self._construct_url("crypto-transactions/") + return self._post(url, data=data, return_json=True, version=2) + def open_orders(self, base="btc", quote="usd"): """ Returns JSON list of open orders. Each order is represented as a From caa50176648ec9c6fa2cb3f01782785c26c3ee08 Mon Sep 17 00:00:00 2001 From: bas20150622 Date: Sat, 16 May 2020 16:31:51 +0200 Subject: [PATCH 2/2] added since_id, since_timestamp on user_transactions, renamed and fixed crypto_transactions --- bitstamp/client.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/bitstamp/client.py b/bitstamp/client.py index d878958..9537e58 100755 --- a/bitstamp/client.py +++ b/bitstamp/client.py @@ -254,7 +254,7 @@ def account_balance(self, base="btc", quote="usd"): return self._post(url, return_json=True, version=2) def user_transactions(self, offset=0, limit=1000, descending=True, - base=None, quote=None): + base=None, quote=None, since_timestamp=None, since_id=None): """ Returns descending list of transactions. Every transaction (dictionary) contains:: @@ -273,18 +273,22 @@ def user_transactions(self, offset=0, limit=1000, descending=True, 'limit': limit, 'sort': 'desc' if descending else 'asc', } + if since_timestamp is not None: + data.update({'since_timestamp': since_timestamp}) + if since_id is not None: + data.update({'since_id': since_id}) url = self._construct_url("user_transactions/", base, quote) return self._post(url, data=data, return_json=True, version=2) - def user_crypto_transactions(self, offset=0, limit=1000): + def crypto_transactions(self, offset=0, limit=1000): """ Returns list of crypto transactions. Every transaction (dictionary) contains:: - {u'currency' : u'xrp' - u'destinationAddress': 'Destination Address' - u'txid': 'Transaction Hash' + {u'currency' : u'LTC' + u'destinationAddress': u'Destination Address' + u'txid': u'Transaction Hash' u'amount' u'1.0' - u'datetime': u'0.2'} + u'datetime': int(timestamp)} Instead of the keys btc and usd, it can contain other currency codes """ @@ -292,7 +296,7 @@ def user_crypto_transactions(self, offset=0, limit=1000): 'offset': offset, 'limit': limit, } - url = self._construct_url("crypto-transactions/") + url = "crypto-transactions/" return self._post(url, data=data, return_json=True, version=2) def open_orders(self, base="btc", quote="usd"):