Order update still unavailable?
I've got a strategy, where I need to update my order (or cancel and immediately place a new one) almost every period, however it seems to be impossible with backtrader right now. The only thing I can do is: cancel my order => wait for the next() run => place a new order, which means I've got a period without any live orders.
Is there any way to handle this properly?
Yes still unavailable. It was never there as something to be "already" in the first place.
I see. Any time estimates on v2?
arrr last edited by arrr
Btw is it possible to use 2 sets of data: daily bars for indicators and smaller (hourly, 15 min or whatever) to place and process orders? In this case updating order (cancel + placing the new one) will take 2 small bars instead of skipping a full day.
You can buy/sell any asset. The platform doesn't know that the
minute-resolution data and the
daily-resolution are the same asset. Buy/Sell the
I've googled about using multiple datafeeds with backtrader and it seems, that all available examples (including the docs) are looping thru the datasets, however I would like to use them simultaneously, is that possible?
however I would like to use them simultaneously
You will have to explain what you mean by simultaneously. If examples loop is because you want to check them all. Nothing prevents you from using direct pointers to each data feed.
@backtrader I mean, that if you run it with 2 data feeds, but without looping them. So it will basically mix data from both sources in a single output. Long story short: is there any way to determine which feed a bar comes from?
I guess you have to elaborate. It may all make sense to you, but it doesn't make any sense here. What you can do with backtrader
- Add as many data feeds as you wish
- Mix timeframes
Looping is just an artifact which the end user can do in cases like for example: 10 data feeds all in the same timeframe.
If you have the same data feed twice with 2 timeframes (
1-day) you may refer directly to them in the
self.datasarray or with the
Xis the index) aliases.
So it will basically mix data from both sources in a single output
That seems like a new data feed you would have to develop. Unless you mean something else.
@backtrader When using 2 data feeds backtrader will call next() on every bar in each feed. Since bt takes bars from both feeds, sorts them from oldest to newest and then runs in a single flow, feeds become "mixed". My problem is that I don't know which bar from which feed is currently calling next() and therefore I can't call indicator functions on daily feed and skip them on minute one. So my question is how do I know which feed a certain bar comes from?
You have to check the length of the data feed. It changes when a new bar is delivered. This can happen for both data feeds at the same time, but with different timeframes, it will obviously happend a lot more often for the smaller timeframe