Multi Execution Problem
-
Hi, I am new here, Sorry for the maybe stupid question.
I have backtested multi asssets simultaneously, one buy order was executed for multi times, like this:2011-08-26, BUY EXECUTED, Size: 19500.00, Price: 5.00, Cost: 97480.50, Comm 1949.61
2011-09-06, 300206 Order 12 Status Submitted
2011-09-06, 300206 Order 12 Status Accepted
2011-09-07, 300206 Order 13 Status Submitted
2011-09-07, 300206 Order 13 Status Accepted
2011-09-07, 300206 Order 12 Status Completed
2011-09-07, SELL EXECUTED, Size: -19500.00, Price: 4.56, Cost: 97480.50, Comm 1779.18
2011-09-07, 300206 Order 13 Status Completed
2011-09-07, SELL EXECUTED, Size: -19500.00, Price: 4.56, Cost: -88959.00, Comm 1779.18
2011-09-07, OPERATION PROFIT, GROSS -8521.50, NET -12250.29Through debug I found it is because asset 300206 has no data at the day 2011-09-06, when in 2011-09-05 the exit rule was met, it should sell at the next open price (which should be at 2011-09-06 ) .
When I backtest with the single asset, it works fine, for 2011-09-06 was omitted.
But when multi asset were used, the data were synchronized, day 2011-09-06 was added to asset 300206, but trade cant be executed. So strategy submitted a new sell the next day. And they all being executed.I am not familiar with the mechnism, how can I fix this?
Thank you! -
When multiple data feeds are in play, if others have data for
2011-09-06
, yournext
will be called to let you know that some data feeds have advanced.But the data feed with no data for
2011-09-06
remains paused at2011-09-05
, because no new data is available.You can control if a data feed has advanced by checking its
len(data)
. If the value remains constante the data feed is not advancing.