繁体   English   中英

使用 ccxt 创建 OKEx 订单

[英]Creating OKEx orders using ccxt

我正在尝试使用 ccxt 模块在 DEMO 交易模式下使用 StopLoss 和 TakeProfit 在 OKEx 中创建 SWAP 订单的程序。 但是我得到了错误: The current account mode does not support this API interface. 我该如何解决它,是否有一些创建订单的示例? 我的尝试:

params = {
        'tdMode': 'isolated',
        'tpOrdPx': '-1',
        'slOrdPx': '-1',
        'tpTriggerPx': take_profit,
        'slTriggerPx': stop_loss,
        'headers': {
            'x-simulated-trading': '1'
        }

    }
order = exchange.create_order(
        f"XRP/USDT:USDT", 'market', 'buy', summa, price, params=params)

错误代码:

File "/home/excl/.local/lib/python3.10/site-packages/ccxt/base/exchange.py", line 561, in throw_exactly_matched_exception
    raise exact[string](message)
ccxt.base.errors.AccountNotEnabled: okx {"code":"1","data":[{"clOrdId":"*id*","ordId":"","sCode":"51010","sMsg":"The current account mode does not support this API interface. ","tag":""}],"msg":"Operation failed."}

通过将帐户模式从简单模式更改为投资组合模式来解决。 https://www.okx.com/academy/en/guide-to-portfolio-margin-mode-on-okex

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM