implement get_market_summaries

This commit is contained in:
gcarq 2017-11-11 19:20:16 +01:00
parent 12ae1e111e
commit bcd3340a80
3 changed files with 34 additions and 0 deletions

View File

@ -159,6 +159,10 @@ def get_markets() -> List[str]:
return _API.get_markets()
def get_market_summaries() -> List[Dict]:
return _API.get_market_summaries()
def get_name() -> str:
return _API.name

View File

@ -137,3 +137,9 @@ class Bittrex(Exchange):
if not data['success']:
raise RuntimeError('{message}'.format(message=data['message']))
return [m['MarketName'].replace('-', '_') for m in data['result']]
def get_market_summaries(self) -> List[Dict]:
data = _API.get_market_summaries()
if not data['success']:
raise RuntimeError('{message}'.format(message=data['message']))
return data['result']

View File

@ -131,3 +131,27 @@ class Exchange(ABC):
Returns all available markets.
:return: List of all available pairs
"""
@abstractmethod
def get_market_summaries(self) -> List[Dict]:
"""
Returns a 24h market summary for all available markets
:return: list, format: [
{
'MarketName': str,
'High': float,
'Low': float,
'Volume': float,
'Last': float,
'TimeStamp': datetime,
'BaseVolume': float,
'Bid': float,
'Ask': float,
'OpenBuyOrders': int,
'OpenSellOrders': int,
'PrevDay': float,
'Created': datetime
},
...
]
"""