kieran-mackle / AutoTrader

A Python-based development platform for automated trading systems - from backtesting to optimisation to livetrading.

Home Page:https://kieran-mackle.github.io/AutoTrader/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Periodic Live trading works for only one Instrument

SeifallahSnoussi opened this issue · comments

Describe the bug
I had an issue when I run the script in live trading for more than one Instrument. Only the last Instrument in Watchlist variable is traded.

To Reproduce

Configuration:

  • WATCHLIST: ['XAG_USD' ,
    'EUR_USD' ,
    'AUD_USD']

  • Trading mode : periodic

When I run the script I see that 3 bots have been assigned to the three instruments, However, only the last one is traded
In fact, the function generate_signal() is called once in each interval (I added a print inside this function to check which Instrument is traded)

Below the console output when the script is running in live trading:
`AutoTraderBot assigned to trade XAG_USD with oanda broker using Difkara Mean Reversion Strategy.

AutoTraderBot assigned to trade EUR_USD with oanda broker using Difkara Mean Reversion Strategy.

AutoTraderBot assigned to trade AUD_USD with oanda broker using Difkara Mean Reversion Strategy.
Update bot for instrument AUD_USD
Instrument AUD_USD , MACD Value= 25.1`

I fixed this by adding a for loop inside autotrader.py in line 1175
for bot in self._bots_deployed:

image

Could you please add that line in the upcoming release ?

Thanks,

Thanks for raising this. I've just fixed it in the version 0.7 development branch, which I am hoping to release relatively soon.

I've also patched it on the main branch in case that is more convenient for the time being.

I'll leave this issue open until I publish the next release.

Thanks

Fixed in version 0.7.