有人能说如何通过python获得当前的职位吗?比如屏幕上的"WAVESUSDT“。
这是文档,但是我找不到这个方法。有人能帮帮我吗?https://python-binance.readthedocs.io/en/latest/account.html#account
发布于 2022-03-13 15:49:51
找到了耶!
client = Client(api,key)
client.futures_account()['positions']
发布于 2022-05-20 15:44:30
我从这个网址得到了空缺职位
https://testnet.binancefuture.com/fapi/v2/positionRisk
(注意,如果没有打开位置,它将返回2个虚拟位置)
return await axios
.get(`https://testnet.binancefuture.com/fapi/v2/positionRisk?symbol=${token_pair}×tamp=${timestamp}&signature=${signature}`, {
headers: {
'Content-Type': 'application/json',
'X-MBX-APIKEY': api_key
}
})
发布于 2022-10-31 14:06:48
如果希望在python中获取单个符号的位置信息,可以使用以下get_position_risk()
方法。
from binance.um_futures import UMFutures
um_futures_client = UMFutures(key="testnet_api_key", secret="testnet_secret_key", base_url="https://testnet.binancefuture.com")
resp = um_futures_client.get_position_risk(
symbol='WAVESUSDT'
)
print(resp)
# [{'symbol': 'WAVESUSDT', 'positionAmt': '0.0', 'entryPrice': '0.0', 'markPrice': '0.00000000', 'unRealizedProfit': '0.00000000', 'liquidationPrice': '0', 'leverage': '20', 'maxNotionalValue': '25000', 'marginType': 'cross', 'isolatedMargin': '0.00000000', 'isAutoAddMargin': 'false', 'positionSide': 'LONG', 'notional': '0', 'isolatedWallet': '0', 'updateTime': 0}, {'symbol': 'WAVESUSDT', 'positionAmt': '0.0', 'entryPrice': '0.0', 'markPrice': '0.00000000', 'unRealizedProfit': '0.00000000', 'liquidationPrice': '0', 'leverage': '20', 'maxNotionalValue': '25000', 'marginType': 'cross', 'isolatedMargin': '0.00000000', 'isAutoAddMargin': 'false', 'positionSide': 'SHORT', 'notional': '0', 'isolatedWallet': '0', 'updateTime': 0}]
https://stackoverflow.com/questions/71458356
复制相似问题