Merge pull request #1095 from c9s/fix/maxapi/query-trades-by-order-id

FIX: filter wrong order id from self-trade trades
This commit is contained in:
kbearXD 2023-03-09 16:59:33 +08:00 committed by GitHub
commit 6a6d7a6293
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -192,7 +192,13 @@ func (e *Exchange) QueryOrderTrades(ctx context.Context, q types.OrderQuery) ([]
continue
}
trades = append(trades, localTrades...)
// because self-trades will contains ask and bid orders in its struct
// we need to make sure the trade's order is what we want
for _, localTrade := range localTrades {
if localTrade.OrderID == uint64(orderID) {
trades = append(trades, localTrade)
}
}
}
// ensure everything is sorted ascending