Skip to content

Commit

Permalink
bitget: check bitget websocket trade id and order status
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Dec 18, 2023
1 parent f19ed7a commit 038d180
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/exchange/bitget/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,20 +432,27 @@ func (s *Stream) handleOrderTradeEvent(m OrderTradeEvent) {
}
continue
}

// The bitget support only snapshot on orders channel, so we use snapshot as update to emit data.
if m.actionType != ActionTypeSnapshot {
continue
}
s.StandardStream.EmitOrderUpdate(globalOrder)

if globalOrder.Status == types.OrderStatusPartiallyFilled {
if order.TradeId == 0 {
continue
}

switch globalOrder.Status {
case types.OrderStatusPartiallyFilled, types.OrderStatusFilled:
trade, err := order.toGlobalTrade()
if err != nil {
if tradeLogLimiter.Allow() {
log.Errorf("failed to convert trade to global: %s", err)
}
continue
}

s.StandardStream.EmitTradeUpdate(trade)
}
}
Expand Down

0 comments on commit 038d180

Please sign in to comment.