BTCMarkets / API

API
120 stars 30 forks source link

ClientOrderId should not be required for "/v3/batchorders" #174

Closed sossee2 closed 4 years ago

sossee2 commented 4 years ago

The current /v3/batchorders endpoint required the ClientOrderId to cancel one or more orders. This greatly complicates things especially considering List Orders "/v3/orders" doesn't return the ClientOrderId.

Any particular reason this hasn't been designed to allow the OrderId to be used to cancel the order? Also should List Orders be returning the client ID as well?

martin-nginio commented 4 years ago

Hi @sossee2

Thank you for your feedback.

Please note: 1- /v3/orders returns clientOrderId attribute if it was provided as part of the original order. Orders with no clientOrderId won't have the attribute as part of the response.

[{"orderId":"12282691","marketId":"XRP-AUD","side":"Bid","type":"Limit","creationTime":"2019-10-10T16:36:47.160000Z","price":"0.03","amount":"0.01","openAmount":"0.01","status":"Placed","clientOrderId":"abc-24"}]

This is the same response format whether you retrieve orders by id or list orders, etc.

The following document also provides a sample response with all possible order attributes when they are provided as part of creating new order : https://api.btcmarkets.net/doc/v3/#tag/Order-Placement-APIs/paths/~1v3~1orders/post

2- With your batch order request, you can either use orderId or clientOrderId when cancelling orders. clientOrderId is only mandatory for creating new orders.

For instance the following is a valid batch request (note orderId is used in one instance to cancel orders)

[
{"placeOrder":{"marketId":"XRP-AUD","side":"Bid","type":"Limit","price":"0.21","amount":".025","clientOrderId":"abc-26"},
"cancelOrder":{"orderId":"123456789"}},
{"placeOrder":{"marketId":"XRP-AUD","side":"Bid","type":"Limit","price":"0.22","amount":"0.26","clientOrderId":"abc-27"},
"cancelOrder":{"clientOrderId":"abc-24"}}
]

I hope this helps.

Thanks.

Regards, Martin

sossee2 commented 4 years ago

Thanks Martin, looks like I've misinterpreted the doco. I can confirm my batch orders are now working using orderId to cancel.