回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>关于通过python二进制库使用futures testnet API:<a href="https://github.com/sammchardy/python-binance" rel="nofollow noreferrer">https://github.com/sammchardy/python-binance</a></p>
<p>我是在对冲模式下的“买空”中得到的。我能够通过用户界面执行相同的订单,并且它可以正常工作。我能够成功地将API用于“买入多头”订单。
以下是我的代码示例:</p>
<pre><code>short_order={ "symbol":"BTCUSDT",
"side": "BUY",
"type": "MARKET",
"positionSide" : "SHORT",
"quantity": "0.001"}
res = client.futures_create_order(**short_order)
print(res)
</code></pre>
<p>得到这样的回应:
BinanceAPIException:APIError(代码=-2022):拒绝ReduceOnly订单</p>
<p>我是不是做错了什么事而下了短订单。仅减少参数提到,根据API文档,它不用于对冲模式。
谢谢你的帮助</p>