Fee Validation on Market orders #46
-
Trying to understand why taker/maker commission is added to validation for amounts when doing a market sell or buy on Binance Lets say I have 10 ETH as balance, if I try to sell 10 ETH with bot currently, validate will fail ErrInsufficientFunds since it adds How should I calculate the |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments
-
Hi @jafri, to sell all the open positions, you have to consider the fee. For Binance, it is 0.1%. I recommend you to keep a small amount in (USDT, BNB, BUSD) to take these fees. Using |
Beta Was this translation helpful? Give feedback.
-
@rodrigo-brito wouldn't that make it not possible to sell 100% of your holdings? When using Binance UI directly, I can simply select 100% of the asset to sell and it will sell 100% and automatically deduct fees |
Beta Was this translation helpful? Give feedback.
-
Yes, but it considers the calculation of the fee in this 100% and notices that it is not accurate. After selling 100%, always rest a small amount of coins in your wallet. Another important point, the exchange accepts precision for the order size. You can check these limits here: https://api.binance.com/api/v1/exchangeInfo For example, this is the restrictions for BTCUSDT {
"filterType": "PRICE_FILTER",
"minPrice": "0.01000000",
"maxPrice": "1000000.00000000",
"tickSize": "0.01000000"
},
{
"filterType": "PERCENT_PRICE",
"multiplierUp": "5",
"multiplierDown": "0.2",
"avgPriceMins": 5
},
{
"filterType": "LOT_SIZE",
"minQty": "0.00000100",
"maxQty": "9000.00000000",
"stepSize": "0.00000100"
},
{
"filterType": "MIN_NOTIONAL",
"minNotional": "10.00000000",
"applyToMarket": true,
"avgPriceMins": 5
},
{
"filterType": "ICEBERG_PARTS",
"limit": 10
},
{
"filterType": "MARKET_LOT_SIZE",
"minQty": "0.00000000",
"maxQty": "138.57632811",
"stepSize": "0.00000000"
},
{
"filterType": "MAX_NUM_ORDERS",
"maxNumOrders": 200
},
{
"filterType": "MAX_NUM_ALGO_ORDERS",
"maxNumAlgoOrders": 5
} |
Beta Was this translation helpful? Give feedback.
-
I understand that a little bit of coins are left due to precision size Here is the code I am discussing ninjabot/pkg/exchange/binance.go Lines 135 to 139 in 63062e8 In ninjabot, if my balance is 1 BTC and I try selling 1 BTC, it will fail at validate since it tries to add taker fee on top of the 1 BTC instead of from it. In binance API, if my balance is 1 BTC, and I pass Also, does |
Beta Was this translation helpful? Give feedback.
-
I will make some tests, maybe it works. We use FloatFormat: ninjabot/pkg/exchange/binance.go Lines 258 to 264 in 6b4b9b8 |
Beta Was this translation helpful? Give feedback.
-
Hi @jafri, I make some tests and are you shure, we do not need this validation. I will refactor the code and will remove it. |
Beta Was this translation helpful? Give feedback.
-
I'm not 100% sure that just removing validation is what is needed @rodrigo-brito, I just know my order with amount was failing through this library which succeeded doing the same amount in UI |
Beta Was this translation helpful? Give feedback.
-
I will try to remove it and change the format function to avoid problems with aproximation |
Beta Was this translation helpful? Give feedback.
-
Hi @jafri, i fixed this in the last release. |
Beta Was this translation helpful? Give feedback.
Hi @jafri, i fixed this in the last release.