You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can someone help me?
I'm using ccxt to trade against mexc and I can't figure out the math to calculate the buy amount when putting in trades if I try to use my full balance
I get an error from the api saying insufficient position / funds
Let's say I'm trading:
symbol: USDC/USDT
balance: 100.00551067 USDT
I want to buy as much USDC as I can with the full balance of USDT
I'm using a limit order and the maker fee is 0% so no fee
This gives the insufficient error when placing a limit order with that amount and price
If I go to the UI and check there I see:
You can see Maker fee in the top right is 0%
The price is below the highest bid so definitely not going to be a market order
The amount slider is dragged to 100% and even if I try to increase the Amount or Total it resets to these values
USDT balance is truncated to 100.0055 due to precision
Amount and Total become 99.9
If I change the amount or Total to say 95, it stays 95 which means there is something different happening once you approach the full balance of the account
Can someone tell me what I'm missing? What's the formula for calculating the buy amount when using your total balance?
If I try to sell the full balance (if I have USDC) then the numbers line up perfectly. It's only for buys that I can't the numbers to line up. Trying different amounts over time, it seems to be subtracting 0.1 on the full balance as a part of its calculation
For the limits and precision, here is the output from exchange.market(symbol):
Thanks in advance to anyone who takes to the time to help me
Code
The text was updated successfully, but these errors were encountered:
Operating System
macOS
Programming Languages
JavaScript
CCXT Version
4.2.79
Description
Can someone help me?
I'm using ccxt to trade against mexc and I can't figure out the math to calculate the buy amount when putting in trades if I try to use my full balance
I get an error from the api saying insufficient position / funds
Let's say I'm trading:
symbol:
USDC/USDT
balance:
100.00551067 USDT
I want to buy as much USDC as I can with the full balance of USDT
I'm using a
limit
order and the maker fee is0%
so no feeMy example code is like so:
This outputs:
This gives the insufficient error when placing a limit order with that amount and price
If I go to the UI and check there I see:
100%
and even if I try to increase the Amount or Total it resets to these valuesUSDT
balance is truncated to100.0055
due to precision99.9
95
, it stays95
which means there is something different happening once you approach the full balance of the accountCan someone tell me what I'm missing? What's the formula for calculating the buy amount when using your total balance?
If I try to sell the full balance (if I have USDC) then the numbers line up perfectly. It's only for buys that I can't the numbers to line up. Trying different amounts over time, it seems to be subtracting
0.1
on the full balance as a part of its calculationFor the limits and precision, here is the output from
exchange.market(symbol)
:Thanks in advance to anyone who takes to the time to help me
Code
The text was updated successfully, but these errors were encountered: