Skip to content

Commit b1ec17d

Browse files
Added Support for Shrimpy Historical and Management APIs
1 parent 98bbe8b commit b1ec17d

File tree

3 files changed

+121
-2
lines changed

3 files changed

+121
-2
lines changed

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,55 @@ asset_dominance = client.get_asset_dominance()
445445
asset_popularity = client.get_asset_popularity()
446446
```
447447

448+
### Historical Methods
449+
450+
* [`get_historical_instruments`](https://developers.shrimpy.io/docs/#get-historical-instruments)
451+
452+
```python
453+
instruments = client.get_historical_instruments()
454+
bittrex_instruments = client.get_historical_instruments('Bittrex')
455+
```
456+
457+
* [`get_historical_trades`](https://developers.shrimpy.io/docs/#get-historical-trades)
458+
459+
```python
460+
trades = client.get_historical_trades(
461+
'Bittrex',
462+
'LTC',
463+
'BTC',
464+
'2019-05-19T00:00:00.000Z',
465+
'2019-05-20T00:00:00.000Z',
466+
100
467+
)
468+
```
469+
470+
* [`get_historical_orderbooks`](https://developers.shrimpy.io/docs/#get-historical-orderbooks)
471+
472+
```python
473+
orderbooks = client.get_historical_orderbooks(
474+
'Bittrex',
475+
'LTC',
476+
'BTC',
477+
'2019-05-19T00:00:00.000Z',
478+
'2019-05-20T00:00:00.000Z',
479+
100
480+
)
481+
```
482+
483+
### Management Methods
484+
485+
* [`get_status`](https://developers.shrimpy.io/docs/#get-status)
486+
487+
```python
488+
status = client.get_status()
489+
```
490+
491+
* [`get_usage`](https://developers.shrimpy.io/docs/#get-usage)
492+
493+
```python
494+
usage = client.get_usage()
495+
```
496+
448497
## Websocket
449498

450499
Users can access the Shrimpy websocket feed using the [`ShrimpyWsClient`](https://github.com/shrimpy-dev/shrimpy-python/blob/master/shrimpy/shrimpy_ws_client.py) class. A handler must be

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
setuptools.setup(
1515
name="shrimpy_python",
16-
version="0.0.6",
16+
version="0.0.7",
1717
author="ShrimpyOfficial",
1818
author_email="[email protected]",
1919
description="The Official Shrimpy API Python Client",

shrimpy/shrimpy_api_client.py

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,81 @@ def get_asset_dominance(self):
354354
return self._call_endpoint('GET', endpoint)
355355

356356

357-
def get_asset_popularity(self):
357+
def get_asset_popularity(self):
358358
endpoint = 'insights/asset_popularity'
359359
return self._call_endpoint('GET', endpoint)
360360

361361

362+
##############
363+
# Historical #
364+
##############
365+
366+
def get_historical_trades(self, exchange, base_trading_symbol, quote_trading_symbol, start_time, end_time, limit):
367+
endpoint = 'historical/trades'
368+
params = {
369+
'exchange': exchange,
370+
'baseTradingSymbol': base_trading_symbol,
371+
'quoteTradingSymbol': quote_trading_symbol,
372+
'startTime': start_time,
373+
'endTime': end_time,
374+
'limit': limit
375+
}
376+
query_string = self._create_query_string(
377+
endpoint,
378+
params
379+
)
380+
381+
return self._call_endpoint('GET', query_string)
382+
383+
384+
def get_historical_orderbooks(self, exchange, base_trading_symbol, quote_trading_symbol, start_time, end_time, limit):
385+
endpoint = 'historical/orderbooks'
386+
params = {
387+
'exchange': exchange,
388+
'baseTradingSymbol': base_trading_symbol,
389+
'quoteTradingSymbol': quote_trading_symbol,
390+
'startTime': start_time,
391+
'endTime': end_time,
392+
'limit': limit
393+
}
394+
query_string = self._create_query_string(
395+
endpoint,
396+
params
397+
)
398+
399+
return self._call_endpoint('GET', query_string)
400+
401+
402+
def get_historical_instruments(self, exchange=None, base_trading_symbol=None, quote_trading_symbol=None):
403+
endpoint = 'historical/instruments'
404+
params = {}
405+
self._add_param_or_ignore(params, 'exchange', exchange)
406+
self._add_param_or_ignore(params, 'baseTradingSymbol', base_trading_symbol)
407+
self._add_param_or_ignore(params, 'quoteTradingSymbol', quote_trading_symbol)
408+
query_string = self._create_query_string(
409+
endpoint,
410+
params
411+
)
412+
413+
return self._call_endpoint('GET', query_string)
414+
415+
416+
##############
417+
# Management #
418+
##############
419+
420+
def get_status(self):
421+
endpoint = 'management/status'
422+
423+
return self._call_endpoint('GET', endpoint)
424+
425+
426+
def get_usage(self):
427+
endpoint = 'management/usage'
428+
429+
return self._call_endpoint('GET', endpoint)
430+
431+
362432
###########
363433
# Helpers #
364434
###########

0 commit comments

Comments
 (0)