In this picture, how can I detect the max amount to enter the position via python future binance code, if there is no code, how to calculate, it’s needed for the quantity here:
result = request_client.post_order(symbol=“ETHUSDT”, side=OrderSide.BUY, ordertype=OrderType.LIMIT, price=1500, quantity=0.5, timeInForce=TimeInForce.GTC)
price * quantity should <= your availableBalance from /fapi/v2/account
We are in USD-M future, so there is leverage, mostly it’s:
USDT / Price * Leverage, but this will not give me the exact “MAX” that I see on trading platform for long position and short position, while MAX differ between long and short as you see in the picture. I hope that there is a code that will give me that directly.
Yeah. Let me correct it. You need to consider open loss. Please read this for a better understanding -
thanks for your help,
look here at these two red squares selected in this picture:
max quantity to open a long position is 0.015 BTC, and max quantity to open a short position is 0.015 BTC. how can I get this via python,
I have tried these python codes,
This file has been truncated.
from binance_f import RequestClient
from binance_f.constant.test import *
from binance_f.base.printobject import *
from binance_f.model.constant import *
request_client = RequestClient(api_key=g_api_key, secret_key=g_secret_key)
result = request_client.get_account_information_v2()
print("canDeposit: ", result.canDeposit)
print("canWithdraw: ", result.canWithdraw)
print("feeTier: ", result.feeTier)
print("maxWithdrawAmount: ", result.maxWithdrawAmount)
print("totalInitialMargin: ", result.totalInitialMargin)
print("totalMaintMargin: ", result.totalMaintMargin)
print("totalMarginBalance: ", result.totalMarginBalance)
print("totalOpenOrderInitialMargin: ", result.totalOpenOrderInitialMargin)
print("totalPositionInitialMargin: ", result.totalPositionInitialMargin)
print("totalUnrealizedProfit: ", result.totalUnrealizedProfit)
print("totalWalletBalance: ", result.totalWalletBalance)
print("totalCrossWalletBalance: ", result.totalCrossWalletBalance)
print("totalCrossUnPnl: ", result.totalCrossUnPnl)
but I still can’t find that MAX:
Thank you very much, I am really thankful.
Finally, how you get the
long max amount and the
short max amount ?
Because, i can’t get it successfully …
Thank’s a lot by advance !
I’ve found the solution:
Max quantity calculation