-1

order_id=None symbol='BTCUSDT' order_type='Limit' side='Buy' price=26050.0 qty=0.002876 take_profit=26080.0 stop_loss=26040.0 time_in_force='GTC' reduce_only=None leverage=2 percentage=100 params error: Qty invalid (ErrCode: 10001) (ErrTime: 13:43:23). Request → POST https://api.bybit.com/v5/order/create: {"category": "linear", "symbol": "BTCUSDT", "side": "Buy", "orderType": "Limit", "qty": "0.002876", "price": "26050.0", "timeInForce": "GTC", "reduceOnly": false, "closeOnTrigger": false, "takeProfit": "26080.0", "tpTriggerBy": "LastPrice", "stopLoss": "26040.0", "slTriggerBy": "LastPrice", "positionIdx": 0}. INFO: 84.194.82.153:52266 - "POST /bybit/futures/order/limit HTTP/1.1" 500 Internal Server Error

all of a sudden there is a qty issue, but everything seems filled in fine ...

checked everything, manually putted the order on bybit and works, but on api there seems to be an issue with qty

1 Answers1

0

Welcome to Stack Overflow! The reason people are downvoting your question is that you have not followed the SO guidelines for a asking a good question. You have not listed any code or what you have tried to do to fix the issue. For future reference, have a look at this link to help you write better questions, and you will be more likely to get help from the community: How do I ask a good question?

The problem you are having here is related to the quantity step value which is a property of the instrument pair that you are trying to buy (BTCUSDT in this case).

If you query the instrument details for BTCUSDT using the endoint "/v5/market/instruments-info" of the ByBit V5 API (ByBit API documentation for "Get Instrument Info"), you can see the "qtyStep" value returned for this pair is "0.001".

In your case, you are trying to place an order with "qty=0.002876". As you can see, this does not fit the quantity step value set by the API. To fix this, you need to reformat the quantity you are trying to buy to comply.

So you would need to either round the quantity up or down. In your case for example, if you want to round the quantity up to comply, your "qty" value should be: "0.003", or if you want to round down to comply, your "qty" value should be "0.002".

Both of these values would comply with the qtyStep requirement, and will allow your order to be placed (as long as all of the other values are correct and compliant).

Zappa
  • 453
  • 1
  • 5
  • 14