From fe74367c8f03149920ef4f10c1efa020c99f24c6 Mon Sep 17 00:00:00 2001 From: brandsimon Date: Thu, 17 May 2018 15:19:05 +0200 Subject: [PATCH] Exchange: support availabe spot values --- catalyst/exchange/exchange.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/catalyst/exchange/exchange.py b/catalyst/exchange/exchange.py index 5379a5ba2..42079ba80 100644 --- a/catalyst/exchange/exchange.py +++ b/catalyst/exchange/exchange.py @@ -370,11 +370,13 @@ def get_spot_value(self, assets, field, dt=None, data_frequency='minute'): if field == 'close' or field == 'price': return [tickers[asset]['last'] for asset in tickers] - elif field == 'volume': - return [tickers[asset]['volume'] for asset in tickers] - - else: - raise NoValueForField(field=field) + result = [] + for asset in tickers: + if field in tickers[asset]: + result.append(tickers[asset][field]) + else: + raise NoValueForField(field=field) + return result def get_single_spot_value(self, asset, field, data_frequency): """