Skip to content

Commit

Permalink
update cancel order time with backtest time
Browse files Browse the repository at this point in the history
  • Loading branch information
eric committed Jun 16, 2020
1 parent 008d86e commit 5427f50
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions exchanges/spotsim/spotsim.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ func (s *SpotSim) CancelAllOrders(symbol string, opts ...OrderOption) (err error
switch order.Status {
case OrderStatusCreated, OrderStatusNew, OrderStatusPartiallyFilled:
order.Status = OrderStatusCancelled
order.UpdateTime = s.backtest.GetTime()
idsToBeRemoved = append(idsToBeRemoved, order.ID)
default:
err = errors.New("error")
Expand Down Expand Up @@ -379,6 +380,7 @@ func (s *SpotSim) CancelOrder(symbol string, id string, opts ...OrderOption) (re
switch order.Status {
case OrderStatusCreated, OrderStatusNew, OrderStatusPartiallyFilled:
order.Status = OrderStatusCancelled
order.UpdateTime = s.backtest.GetTime()
result = order
s.openOrders.Delete(id)
s.logOrderInfo("Cancel order", SimEventOrder, order)
Expand Down

0 comments on commit 5427f50

Please sign in to comment.