hal9000cc / live_trading_indicators

MIT License
26 stars 7 forks source link

Indicator value can not be calculated because of the the error " Bad date or time value: Time end cannot be set in live mode" #5

Open mydanniel opened 1 year ago

mydanniel commented 1 year ago

Hi i have run the following code: import live_trading_indicators as lti import datetime as dt import talib as ta import pandas as pd

print(f'Now is {utcnow} UTC') indicators = lti.Indicators('binance',20230701,with_incomplete_bar=True) print(indicators.time_end) ohlcv = indicators.OHLCV('btcusdt', '1h') sma = indicators.SMA('btcusdt', '1h',period = 10) print(indicators.time_end)

It give me an error, when executing the code to calculate SMA, could you please take a look at it? Traceback (most recent call last): File "ltiimcompletebar.py", line 13, in sma = indicators.SMA('btcusdt', '1h',period = 10) File "/usr/local/lib/python3.8/dist-packages/live_trading_indicators/indicators_set/init.py", line 445, in call return self.indicators.get_indicator_out(self.indicator_name, self.indicator_module, symbols, use_timeframe, File "/usr/local/lib/python3.8/dist-packages/live_trading_indicators/indicators_set/init.py", line 298, in get_indicator_out out = self.get_indicator_out_cached(indicator_name, indicator_module, symbols, timeframe, indicator_kwargs, File "/usr/local/lib/python3.8/dist-packages/live_trading_indicators/indicators_set/init.py", line 278, in get_indicator_out_cached out_valid = indicator_module.get_indicator_out(self, symbols, timeframe, out_for_grow, **indicator_kwargs) File "/usr/local/lib/python3.8/dist-packages/live_trading_indicators/indicators_set/SMA.py", line 9, in get_indicator_out ohlcv = indicators.OHLCV.full_data(symbol, timeframe) File "/usr/local/lib/python3.8/dist-packages/live_trading_indicators/indicators_set/init.py", line 432, in full_data return self.indicators.get_indicator_out(self.indicator_name, self.indicator_module, symbols, timeframe, File "/usr/local/lib/python3.8/dist-packages/live_trading_indicators/indicators_set/init.py", line 290, in get_indicator_out use_time_begin, use_time_end = self.check_call_time_intervals(time_begin, time_end, timeframe) File "/usr/local/lib/python3.8/dist-packages/live_trading_indicators/indicators_set/init.py", line 223, in check_call_time_intervals return self.check_call_time_intervals_live(time_begin, time_end, timeframe) File "/usr/local/lib/python3.8/dist-packages/live_trading_indicators/indicators_set/init.py", line 205, in check_call_time_intervals_live raise LTIExceptionBadTimeParameter('Time end cannot be set in live mode') live_trading_indicators.exceptions.LTIExceptionBadTimeParameter: Bad date or time value: Time end cannot be set in live mode