Fetch existing positions from Oanda into backrader
I am looking at using backtrader to automate live trading using Oanda as my preferred broker. Ideally I would like to fetch my existing positions from my Oanda account [both manually created positions and those created via backtrader into my Bt strategy - I have no issue using Backtrader with Oanda if I avoid closing or cancelling existing orders manually, directly on Oanda. I was looking at enhancing the notify_store function to handle this scenario - Is this the right approach ? Has anyone in the community tried to achieve something along the same lines? Any help appreciated.
you can set
use_positions=Truewhile initiating the broker which will fetch positions from your account. its the default behaviour for default Oanda implementation available along with BT as well as for Oanda v20 store.
Thank you Rajanprabu
Why would someone downvote this answer :-(
vladisld last edited by
@rajanprabu Sorry, wanted to upvote, but clicked the wrong button - fixed.
:-) Thanks @vladisld