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

FTX IO函数下单报错 Futures_OP 4: 405: 405 Not Allowed

Author: GCC, Created: 2021-12-05 06:22:32, Updated: 2021-12-05 06:49:38

代码

def short(direction,price,amount):
    exchange.SetDirection('sell')
    logtype = LOG_TYPE_SELL
    para = ""
    para += "market='"+exchange.GetCurrency().replace('_USD', '-PERP') + "'"
    para += "&side='"+ direction + "'"
    para += "&price=" + str(price)
    para += "&type='" + "'limit'" + "'"
    para += "&size=" + str(amount)
    if direction == "'buy'":
        para += "&reduceOnly=true"
        logtype = LOG_TYPE_BUY
        exchange.SetDirection('closesell')
    para+="&postOnly=true"
    # para+="&timestamp="+ str(int(UnixNano() / 1000000))
    ret = exchange.IO("api", "POST", '/orders', para)
    exchange.Log(logtype, price, amount)
    return ret

实盘地址 https://www.fmz.com/robot/407656


More

发明者量化-小小梦 Not Allowed 意思是权限不足,检查下是不是API KEY 权限的问题。

发明者量化-小小梦 检查是不是IO传参时参数写错了。

GCC 检查过了,应该不是api的问题,直接用exchange的sell和buy可以正常下单