exchange/max: check order id field

This commit is contained in:
c9s 2022-08-05 11:29:59 +08:00
parent cba9ffe064
commit a5a40c3a42
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -169,6 +169,10 @@ func (e *Exchange) NewStream() types.Stream {
}
func (e *Exchange) QueryOrderTrades(ctx context.Context, q types.OrderQuery) ([]types.Trade, error) {
if q.OrderID == "" {
return nil, errors.New("max.QueryOrder: OrderID is required parameter")
}
orderID, err := strconv.ParseInt(q.OrderID, 10, 64)
if err != nil {
return nil, err
@ -196,6 +200,10 @@ func (e *Exchange) QueryOrderTrades(ctx context.Context, q types.OrderQuery) ([]
}
func (e *Exchange) QueryOrder(ctx context.Context, q types.OrderQuery) (*types.Order, error) {
if q.OrderID == "" {
return nil, errors.New("max.QueryOrder: OrderID is required parameter")
}
orderID, err := strconv.ParseInt(q.OrderID, 10, 64)
if err != nil {
return nil, err