backtest: set order price for market order

This commit is contained in:
c9s 2022-06-28 22:17:39 +08:00 committed by Austin Liu
parent 609b6a7a50
commit b32cfef2fd

View File

@ -172,6 +172,10 @@ func (m *SimplePriceMatching) PlaceOrder(o types.SubmitOrder) (*types.Order, *ty
order := m.newOrder(o, orderID) order := m.newOrder(o, orderID)
if isTaker { if isTaker {
if order.Type == types.OrderTypeMarket {
order.Price = m.LastPrice
}
// emit the order update for Status:New // emit the order update for Status:New
m.EmitOrderUpdate(order) m.EmitOrderUpdate(order)