Hi, I’m running into the error code ORDER_INVALID_INVALID_QUANTITY when placing offers with the v3/orders API endpoint.

This only seems to be happening for me when the decimal odds are 10000, other offers I submit at different prices are placed successfully.

For example, in the below case I wanted to put up a decimal stake of 21.85 at decimal odds of 10000:

request body

“contract_id”: “29427559”,
“market_id”: “8528363”,
“minimum_accepted_quantity”: 200000000,
“price”: 1,
“quantity”: 2185000000,
“reference_id”: “830239360”,
“side”: “buy”,
“type”: “good_til_cancelled”

response body

“Item1”: null,
“Item2”: {
“Count”: null,
“Expiry”: null,
“Limit”: null,
“Data”: null,

Customer support tells me that this error is due to a problem with the “quantity” field encoded stake. From the docs at https://docs.smarkets.com/#/orders/create_order, it says:
To convert it to back stake, just multiply by the price and divide by 100000000
Example: 100000 (quantity) * 5000 (price) / 100000000 = 5 EUR back stake

I don’t see the problem though, as in this case:
2185000000 (quantity) * 1 (price) / 100000000 = 21.85

Please could you help me understand what I am doing wrong?

Hi Oliver,

Sorry for the late reply. You are doing nothing wrong and your calculations are correct. This is a known limitation of our exchange, if you try the same on the website, you’ll get the same error:

The quantity needs to be under 2^31 - 1 = 2147483647. I will update the docs to make it more clear