diff --git a/changelog b/changelog new file mode 100644 index 0000000..274a0ad --- /dev/null +++ b/changelog @@ -0,0 +1,14 @@ +# Geminipy Changelog + +# v0.0.4 +Added "fees" function for the fee and notional volume API endpoint + +# v0.0.3 +Added "pubticker" function for the public ticker API endpoint +Added "auction" and "auction_history" functions for auction data +Added "tradevolume" function to get user trade volume +Added "newAddress" function to get a new cryptocurrency deposit address + +# v0.0.2 +Changed project layout to make it compatible with PyPi (pip) +Added an "options" argument to the "new_order" function diff --git a/geminipy/__init__.py b/geminipy/__init__.py index 4800e1e..20c0a3c 100644 --- a/geminipy/__init__.py +++ b/geminipy/__init__.py @@ -47,6 +47,12 @@ def symbols(self): return requests.get(url) + def pubticker(self, symbol='btcusd'): + """Send a request for latest ticker info, return the response.""" + url = self.base_url + '/v1/pubticker/' + symbol + + return requests.get(url) + def book(self, symbol='btcusd', limit_bids=0, limit_asks=0): """ Send a request to get the public order book, return the response. @@ -84,6 +90,34 @@ def trades(self, symbol='btcusd', since=0, limit_trades=50, return requests.get(url, params) + def auction(self, symbol='btcusd'): + """Send a request for latest auction info, return the response.""" + url = self.base_url + '/v1/auction/' + symbol + + return requests.get(url) + + def auction_history(self, symbol='btcusd', since=0, + limit_auction_results=50, include_indicative=1): + """ + Send a request for auction history info, return the response. + + Arguments: + symbol -- currency symbol (default 'btcusd') + since -- only return auction events after this timestamp (default 0) + limit_auction_results -- maximum number of auction events to return + (default 50). + include_indicative -- whether to include publication of indicative + prices and quantities. (default True) + """ + url = self.base_url + '/v1/auction/' + symbol + '/history' + params = { + 'since': since, + 'limit_auction_results': limit_auction_results, + 'include_indicative': include_indicative + } + + return requests.get(url, params) + # authenticated requests def new_order(self, amount, price, side, client_order_id=None, symbol='btcusd', type='exchange limit', options=None): @@ -206,6 +240,17 @@ def past_trades(self, symbol='btcusd', limit_trades=50, timestamp=0): return requests.post(url, headers=self.prepare(params)) + def tradevolume(self): + """Send a request to get your trade volume, return the response.""" + request = '/v1/tradevolume' + url = self.base_url + request + params = { + 'request': request, + 'nonce': self.get_nonce() + } + + return requests.post(url, headers=self.prepare(params)) + def balances(self): """Send an account balance request, return the response.""" request = '/v1/balances' @@ -217,6 +262,38 @@ def balances(self): return requests.post(url, headers=self.prepare(params)) + def newAddress(self, currency='btc', label=''): + """ + Send a request for a new cryptocurrency deposit address + with an optional label. Return the response. + + Arguements: + currency -- a Gemini supported cryptocurrency (btc, eth) + label -- optional label for the deposit address + """ + request = '/v1/deposit/' + currency + '/newAddress' + url = self.base_url + request + params = { + 'request': request, + 'nonce': self.get_nonce() + } + + if label != '': + params['label'] = label + + return requests.post(url, headers=self.prepare(params)) + + def fees(self): + """Send a request to get fee and notional volume, return the response.""" + request = '/v1/notionalvolume' + url = self.base_url + request + params = { + 'request': request, + 'nonce': self.get_nonce() + } + + return requests.post(url, headers=self.prepare(params)) + def heartbeat(self): """Send a heartbeat message, return the response.""" request = '/v1/heartbeat' diff --git a/setup.py b/setup.py index 6de423b..c9d0387 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,11 @@ from setuptools import setup with open('README.md') as f: - readme = f.read() + readme = f.read().replace('```', '') setup( name='geminipy', - version='0.0.2', + version='0.0.4', packages=['geminipy'], url='https://github.com/geminipy/geminipy', license='GNU GPL',