我使用图书馆python-binance
当我连接binance客户端时,如果我尝试进行短期订购,如果Hedge模式未处于活动状态(more about Hedge mode activation),我会出现以下错误:
binance.exceptions.BinanceAPIException: APIError(code=-4061): Order's position side does not match user's setting.
守则:
from binance.client import Client
client = Client(
api_key,
api_secret,
)
# Here : I want to get if client accoutn has hedge mode enable or not like :
# hedge_mode = client.get_hedge_mode_active() <--- This method does not exists on library
order = client.futures_create_order(
symbol = "XRPUSDT",
side = SIDE_BUY,
positionSide = "SHORT",
type = ORDER_TYPE_MARKET,
quantity = 500,
)
positionSide
是对冲模式,特别是。激活它允许您同时持有同一符号的多头和空头头寸因此,如果您想要单向模式(而不是对冲模式),那么您只需要:
要检查对冲模式是否激活,只需使用:
答复:
来自binance API的文档:
https://binance-docs.github.io/apidocs/futures/en/#get-current-position-mode-user_data
相关问题 更多 >
编程相关推荐