Skip to content

Commit 6a6d7a6

Browse files
authored
Merge pull request #1095 from c9s/fix/maxapi/query-trades-by-order-id
FIX: filter wrong order id from self-trade trades
2 parents 4586f68 + ead5486 commit 6a6d7a6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/exchange/max/exchange.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,13 @@ func (e *Exchange) QueryOrderTrades(ctx context.Context, q types.OrderQuery) ([]
192192
continue
193193
}
194194

195-
trades = append(trades, localTrades...)
195+
// because self-trades will contains ask and bid orders in its struct
196+
// we need to make sure the trade's order is what we want
197+
for _, localTrade := range localTrades {
198+
if localTrade.OrderID == uint64(orderID) {
199+
trades = append(trades, localTrade)
200+
}
201+
}
196202
}
197203

198204
// ensure everything is sorted ascending

0 commit comments

Comments
 (0)