mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
backtest: for types.OrderTypeStopMarket, use stop price to simulate the actual price for balance locking
This commit is contained in:
parent
a370a5e489
commit
26f5f36f7e
|
@ -139,6 +139,11 @@ func (m *SimplePriceMatching) PlaceOrder(o types.SubmitOrder) (*types.Order, *ty
|
||||||
switch o.Type {
|
switch o.Type {
|
||||||
case types.OrderTypeMarket:
|
case types.OrderTypeMarket:
|
||||||
price = m.LastPrice
|
price = m.LastPrice
|
||||||
|
|
||||||
|
case types.OrderTypeStopMarket:
|
||||||
|
// the actual price might be different.
|
||||||
|
price = o.StopPrice
|
||||||
|
|
||||||
case types.OrderTypeLimit, types.OrderTypeStopLimit, types.OrderTypeLimitMaker:
|
case types.OrderTypeLimit, types.OrderTypeStopLimit, types.OrderTypeLimitMaker:
|
||||||
price = o.Price
|
price = o.Price
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user