REST validation logic changes

REST only: When sending market orders, only size or funds can be included on the order, not both.

Why this change was done?

https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postorders

When placing a market order you can specify funds and/or size . Funds limit how much of your quote currency account balance is used and size limits the bitcoin amount transacted.

Documentation still says that both can be used…

But my main problem is this:

For market buy orders where funds is specified, the funds amount is put on hold. If only size is specified, all of your account balance (in the quote account) is put on hold for the duration of the market order (usually a trivially short time). For a sell order, the size in BTC is put on hold. If size is not specified (and only funds is specified), your entire BTC balance is put on hold for the duration of the market order.

I am making market buy orders specifying size! I also specified funds to avoid holding all balance. That “usually a trivially short time” is not short enough! I had orders failing with insufficient balance in past, that is why I started to specify both parameters and it was working good until new validation changes was made.

With new validation changes, has hold rules also changed? Or should I expect my orders to fail again?

@muktupavels Thank you so much for reaching out and sharing this. We will work to update our documentation to ensure this is more clear.

The best way to move forward post these enhanced validations to minimize the amount of funds held when submitting market orders is to:

  • When submitting a market buy order, leverage the “funds” field
  • When submitting a market sell order, leverage the “size” field

This will ensure the funds held are limited to what you specify, rather than your entire quote balance.

One approach you can take to go from size to funds or funds to size is by looking at the top of book pricing via the market data apis and calculate the size or funds yourself by using the latest prices: REST, WS

  • Calculate funds using size: funds = size * price
  • Calculate size using funds: size = funds / price

Why this change was made in first place?

Based on your reply I should assume that making market buy specifying size all funds will be held? Why? Especially when there is PPP… There are no reason to hold funds that are more then mid-point price * PPP.

I don’t want to make market buys specifying funds! I want to buy specific size, not more, not less!

Are there any plans to change and/or improve this?

For example on October 9 in less then 20 seconds I had 3 failed orders with “Insufficient funds”.

@muktupavels Thanks for the input. There are currently no plans to change this behavior. If you prefer to maintain the ability to specify the size without funds for a buy, you can also submit a Limit Order with the exact size and set the Limit Price above the current best ask. This should execute immediately without holding additional funds.