I'm doing a MarketOrder, and checking order status at OnOrderEvent.
The weird thing is that security price at this point is 1009, while FillPrice is 1020.
Even weirder is FillPrice is 1020 on EVERY order fill, while security price is changing.
What is wrong with the data??
Thanks!!
public override void OnOrderEvent(OrderEvent orderEvent)
{
var order = Transactions.GetOrderById(orderEvent.OrderId);
_FillPrice = orderEvent.FillPrice;
if (orderEvent.FillQuantity > 0 && _FillPrice > 0)
{
Log("Order FillPrice " + _FillPrice);
Log("Stock Price " + Securities[orderEvent.Symbol].Price);
}
}
Example output:
2017-07-31 09:37:33 Order FillPrice 1020.01000000000
2017-07-31 09:37:33 Stock Price 1013.71
2017-07-31 09:51:55 Order FillPrice 1020.01000000000
2017-07-31 09:51:55 Stock Price 1009.16
2017-07-31 10:23:28 Order FillPrice 1020.01000000000
2017-07-31 10:23:28 Stock Price 1002.31
Backtest properties:
SetStartDate(2017, 07, 31);
SetEndDate(2017, 08, 01);
Symbol = "AMZN", Exchange = "P"
Andrew Hart
Hey Jenny,
There was a bug in Lean particular to QuantConnect equities data at Tick resolution. QuantConnect tick resolution data does not include bid/ask spreads. The fill model you are using, ImmediateFillModel, looked for the bid/ask spread of the tick and when it did not find it, used the price with which the security was created, or 'seeded' with.
This bug should now be fixed. You can find more information about the bug and the fix here:
Jenny S
Andrew thank you very much!
Appreciate your quick fix, fortunately we've encountered this situation pre live mode...
Jenny S
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!