资源加载中... loading...

exchange.GetOrders()报错

Author: lzhqlj, Created: 2023-02-12 00:01:57, Updated:

学习论坛里的代码 function CancelPendingOrders() { var orders = exchange.GetOrders();//获取所有未完成的订单。

for (var j = 0; j < orders.length; j++) {
      exchange.CancelOrder(orders[j].Id, orders[j]);}//该函数的用途为取消某个Id的订单。

}

执行报错 2023-02-12 00:00:51 错误 TypeError: cannot read property ‘length’ of null at CancelPendingOrders (FILE:41) at main (FILE:125) 2023-02-12 00:00:51 Futures_OKCoin 错误 GetOrders: 401: {“msg”:“APIKey does not match current environment.”,“code”:“50101”}

请问是什么原因呢?谢谢


More

lzhqlj 问题解决啦 没有设置成模拟盘

发明者量化-小小梦 OKX使用```exchange.IO("simulate", true)```设置。API文档上搜索“模拟盘”有相关信息。