From 809f835f740ec8dfdeb05cdcb3a0fd097bbcc4d4 Mon Sep 17 00:00:00 2001 From: wassname Date: Fri, 10 Nov 2017 10:21:26 +0800 Subject: [PATCH] prevent error at this level when no data returned --- libcryptomarket/historical.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcryptomarket/historical.py b/libcryptomarket/historical.py index df25247..410f79d 100644 --- a/libcryptomarket/historical.py +++ b/libcryptomarket/historical.py @@ -87,7 +87,7 @@ def get_historical_prices(source='cryptocompare', symbol=None, exchange=None, data = pd.DataFrame([CryptocompareHisto(**e).__dict__ for e in data]) # Filter only valid time range - if from_time is not None and to_time is not None: + if len(data) and from_time is not None and to_time is not None: data = data[(data['r_time'] >= from_time) & (data['r_time'] <= to_time)]