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
945 stars 217 forks source link

Ability to access across different price data in Strategy #50

Closed ktlim86 closed 1 year ago

ktlim86 commented 1 year ago

Hi,

I was looking at the documentation and I have a use case where I want to compare across different price asset in term of their volatility and rank them accordingly. May I know does Autotrader support this? Thank you.

kieran-mackle commented 1 year ago

Hi @ktlim86,

I am assuming you are asking how to get the prices of multiple assets into a single strategy? If so, the main thing to look for is to set PORTFOLIO: True in the strategy configuration. This will indicate to autotrader that all of the instruments in your WATCHLIST are to be passed into a single strategy bot, rather than to spawn a single bot for each.

After setting PORTFOLIO: True, the data passed to your strategy will contain the prices for all of the instruments in your watchlist.

Does this help?

ktlim86 commented 1 year ago

hi @kieran-mackle ,

that mean if i will to access the data, it will be data["EURUSD=X"] and data["GPBUSD=X"] if i will to assess EURUSD and GBPUSD asset in the generate_signal function? so if i want to do the multi-timeframe, does it mean i can further access by data["EURUSD=X"]["1h] and data["EURUSD=X"]["1d"]? Thank you.

kieran-mackle commented 1 year ago

@ktlim86

Yes, it should be something like that, however I would now recommend simply resampling the data to your desired timeframe(s) from the base data passed in.