kieran-mackle / AutoTrader

A Python-based development platform for automated trading systems - from backtesting to optimisation to livetrading.
https://kieran-mackle.github.io/AutoTrader/
GNU General Public License v3.0
937 stars 215 forks source link

multi-time frame data not working #77

Open ziyedbe opened 1 year ago

ziyedbe commented 1 year ago

Describe the bug I m getting the following error when i try to use multi time frame data

AutoTraderBot assigned to trade BTC-USD with virtual broker using EMA Crossover.

Trading...

  0%|                                                                                               | 0/2678400 [00:00<?, ?it/s]Traceback (most recent call last):
  File "PATH/Desktop\work\shared\personal\autotrader-demo\runfile.py", line 9, in <module>
    at.run()
  File "PATH/AppData\Local\Programs\Python\Python39\lib\site-packages\autotrader\autotrader.py", line 1142, in run  
    self._main()
  File "PATH/AppData\Local\Programs\Python\Python39\lib\site-packages\autotrader\autotrader.py", line 1660, in _main    self._trade_update_loop()
  File "PATH/AppData\Local\Programs\Python\Python39\lib\site-packages\autotrader\autotrader.py", line 2134, in _trade_update_loop
    bot._update(timestamp=timestamp)
  File "PATH/AppData\Local\Programs\Python\Python39\lib\site-packages\autotrader\autobot.py", line 306, in _update  
    self._update_virtual_broker(current_bars)
  File "PATH/AppData\Local\Programs\Python\Python39\lib\site-packages\autotrader\autobot.py", line 663, in _update_virtual_broker
    brokers = self._instrument_to_broker[product]
KeyError: '1h'
 13%|██████████                                                                 | 360000.0/2678400 [00:00<00:01, 2014412.79it/s] 

To Reproduce Steps to reproduce the behavior: Run the MTF_ema_crossover strategy

Version of AutoTrader being used Autotrader : 0.12.0 Python : 3.9.0