Live Trading and Compression - question
-
I have been using BT for a couple years for backtesting on Forex. Now I am preparing to move into live trading, using Oanda.
I'm not sure what compression does in terms of live trading. If I say I want 1-minute bars, does Oanda handle that - does it accumulate the data and send it to my system once per minute? Or does Oanda send tick data and BT (or the Oanda API) summarizes it into 1M bars?
I am planning on running my algo on multiple currency pairs and time-frames, and I want to design this for reasonable performance and minimal traffic.
And question #2 if I can...
I see a lot more documentation "out there" for BT with Interactive Brokers than for Oanda. And the Oanda interface uses their V1 API. Should I be concerned that I am using a less used, possibly less tested and maintained platform?
-
@leecallen I am not sure whether I should be asking about compression or the timeframe parameter in the data feed.
-
Check out https://github.com/ftomassetti/backtrader-oandav20 for oanda v20 support. It will provide you tick data, also 1m data. You can resample or replay tick data to 1min data with backtrader.
-
@leecallen the minimal timeframe for historical data is 5S, for live trading you can use Ticks and replay or resample this to your needed timeframe.
-
@dasch Thank you. I am now using the oandav20 API. I'm still trying to sort out the resampling.
So are you saying, with this API, BT gets Ticks no matter what, and oandav20 or BT summarizes them for me?
-
@leecallen basically yes. when you stream live data, then you will always get ticks. You can either resample or replay the data to your needed timeframe.
You can also request candles instead, then streaming will not be used but instead, oanda will be queried every x sec for new data (x depends on timeframe used).
So if you want to use candles instead, you would provide the candles=True parameter to your feed, when creating.
-
@dasch That was EXACTLY the bit of information I needed - thank you!
Could you tell me where might I have found this information for myself?
-
@leecallen most of this info is commented in the source code of the data feed. you would also need to read some of the source code: https://github.com/ftomassetti/backtrader-oandav20/blob/master/btoandav20/feeds/oandav20feed.py