作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在 okex 交换版本 5 上使用 ccxt 创建一个永久限价订单。API 成功地在现货交易所下订单(包括限价和市价),但在永续交易上却没有成功。这是我正在尝试的 -
exchange_swap = ccxt.okex5({
'apiKey': credentials['okex']['apikey'],
'secret': credentials['okex']['secretkey'],
'password': credentials['okex']['password'],
'options': {
'defaultType': 'swap',
}
})
params = {
"test":True
}
order = exchange_swap.createLimitBuyOrder('XRP-USDT-SWAP',100,0.7)
错误信息-
ccxt.base.errors.BadRequest: okex5 {"code":"1","data":[{"clOrdId":"","ordId":"","sCode":"51000","sMsg":"Parameter posSide error ","tag":""}],"msg":""}
搜索此错误后,我在他们的文档中找到了这一点-
Error message Http status code Error code
Parameter {0} error. 400 51000
文档链接 - Okex v5
P.S - 我可以通过 okex 上的交易仪表板放置它,但不能通过 API。我有足够的余额来创建此订单。
整个错误信息是这样的-
Traceback (most recent call last):
File "C:\Users\ishaa\Desktop\trading\Crypto Vibhor\Testing Files\ccxt_test.py", line 70, in
<module>
order = exchange_swap.createLimitBuyOrder('XRP-USDT-SWAP',100,0.7)
File "C:\Users\ishaa\Desktop\trading\tradingenv\lib\site-packages\ccxt\base\exchange.py", line 1983, in create_limit_buy_order
return self.create_order(symbol, 'limit', 'buy', amount, price, params)
File "C:\Users\ishaa\Desktop\trading\tradingenv\lib\site-packages\ccxt\okex5.py", line 1287, in create_order
response = self.privatePostTradeOrder(self.extend(request, params))
File "C:\Users\ishaa\Desktop\trading\tradingenv\lib\site-packages\ccxt\base\exchange.py", line 461, in inner
return entry(_self, **inner_kwargs)
File "C:\Users\ishaa\Desktop\trading\tradingenv\lib\site-packages\ccxt\base\exchange.py", line
486, in request
return self.fetch2(path, api, method, params, headers, body)
File "C:\Users\ishaa\Desktop\trading\tradingenv\lib\site-packages\ccxt\base\exchange.py", line 482, in fetch2
return self.fetch(request['url'], request['method'], request['headers'], request['body'])
File "C:\Users\ishaa\Desktop\trading\tradingenv\lib\site-packages\ccxt\base\exchange.py", line 634, in fetch
self.handle_errors(http_status_code, http_status_text, url, method, headers, http_response, json_response, request_headers, request_body)
File "C:\Users\ishaa\Desktop\trading\tradingenv\lib\site-packages\ccxt\okex5.py", line 2230, in handle_errors
self.throw_exactly_matched_exception(self.exceptions['exact'], errorCode, feedback)
File "C:\Users\ishaa\Desktop\trading\tradingenv\lib\site-packages\ccxt\base\exchange.py", line 500, in throw_exactly_matched_exception
raise exact[string](message)
ccxt.base.errors.BadRequest: okex5 {"code":"1","data":
[{"clOrdId":"","ordId":"","sCode":"51000","sMsg":"Parameter posSide error
","tag":""}],"msg":""}
最佳答案
如果您的 OKX 帐户设置中的Order Placement Mode
错误,则可能会发生这种情况。前往您的 OKX 账户 > 交易 > 永续合约 > 设置 > 下单模式并将其设置为多/空模式
。
关于python - CCXT okex5 掉期合约 - 参数 posSide 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67869339/
我是一名优秀的程序员,十分优秀!