From d29d1358e13129ae04a89a757d970659b721976f Mon Sep 17 00:00:00 2001 From: ikwtif Date: Mon, 24 Aug 2020 23:41:08 +0200 Subject: [PATCH] datetime.timedelta fix for unsupported arguments (monts, years) --- app/exchange.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/exchange.py b/app/exchange.py index 61e9afd8..9c604302 100644 --- a/app/exchange.py +++ b/app/exchange.py @@ -88,6 +88,13 @@ def get_historical_data(self, market_pair, exchange, time_unit, start_date=None, 'y': 'years' } + if time_period == 'M': + time_period = 'w' + time_quantity = 4 + elif time_period == 'Y': + time_period = 'w' + time_quantity = 48 + timedelta_args = { timedelta_values[time_period]: int(time_quantity) } start_date_delta = timedelta(**timedelta_args)