I’m going crazy trying to calculate the amount to open a position.
I was reading responses to previous posts and came to the following
usdt_par = futures_functions.get_qtyU(“USDT”)/price #this get the usdt on my wallet and then divide divide by the current price of the currency in which I am going to make the position
minQ = float(client.get_symbol_info(symbol)[‘filters’][‘minQty’])
stepS = float(client.get_symbol_info(symbol)[‘filters’][‘stepSize’])
b = (usdt_par-minQ)/stepS
quantity = minQ + b * stepS
I’m testing with btc and this is the amount that it returns:
and this is the error:
Precision is over the maximum defined for this asset.
I understand why the error comes out, what I’m looking for is a way to calculate the amount
Then I try:
from binance.helpers import round_step_size
stepS = float(client.get_symbol_info(“BTCUSDT”)[‘filters’][‘stepSize’])
round_step_size(qty, stepS) - stepS
and again the same error
So my question is how can I calculate the number of correct decimal places in general for any currency?