Sell with decimals (Python)

I have tried to sell (market_order) in phyton with decimal. No luck.
Without decimals, it works.

Response with decimals:

{
  "success": false,
  "failure_reason": "UNKNOWN_FAILURE_REASON",
  "order_id": "",
  "error_response": {
    "error": "INVALID_SIZE_PRECISION",
    "message": "Too many decimals in order amount",
    "error_details": "",
    "preview_failure_reason": "PREVIEW_INVALID_SIZE_PRECISION"
  },
  "order_configuration": {
    "market_market_ioc": {
      "base_size": "47.532"
    }
  }
}

Response without decimals:

{
  "success": true,
  "failure_reason": "UNKNOWN_FAILURE_REASON",
  "order_id": "bc45420b-caf7-491a-aa0f-58ec0589b1a5",
  "success_response": {
    "order_id": "bc45420b-caf7-491a-aa0f-58ec0589b1a5",
    "product_id": "BAT-EUR",
    "side": "SELL",
    "client_order_id": "949266504"
  },
  "order_configuration": {
    "market_market_ioc": {
      "base_size": "10"
    }
  }
}

Example of my payload with decimals:

payload = json.dumps({
  "client_order_id": str_order_id,
  "product_id": "BAT-EUR",
  "side": "SELL",
  "order_configuration": {
       "market_market_ioc": {
	   "base_size": "7.532"
    }
  }
})

I think, there are a lot of issues in advanced.
Is it possible to transfer the hole portfolio back and add to PRO?
Sorry, but this is not a game. It’s money.
Thx

You need to look at base_increment. In case of BAT-EUR it is 0.01. If you change 7.532 to 7.53 it should work.

1 Like

Thx, it works.
I have selled all BAT with your advice but now I have 0.002 BAT.
It’s not much money, but seems to be unreachable.

Hi @woni Thank you for sharing this with us. We can take this as a feedback. Can you please share which endpoint are you referring to?

Hi @Loop_11 I using API with /api/v3/brokerage/orders
Today I’ve tested again with BAT-EUR. I can buy 6.5026 but can only sell 6.50 BAT-EUR.
The main proplem is, I can’t buy with base-size.
Example: I want to buy 6.5 BAT-EURO. I calculate the price incl. fee and buy in time. But I get 6.5026 or 6.5509 or 6.4910 BAT-EUR.
I’m testing with less BAT cause of cheapness.

@woni That is basically year old problem, you can check this topic. And for testing you might be interested also in this topic.

Thx, it’s working with “limit_limit_gtc”, “base_size” and “limit_price”