Loading ...

求助,exchange.Buy报错,

Author: yuanwb, Created: 2021-01-18 09:07:21, Updated:

复制的现货单币种平衡策略,在火币平台BTC3S_USDT,未修改前遇到交易单精度错误,修改如下: 193: trade(‘buy’, buy_price.toFixed(6), buy_value.toFixed(4), ‘买入平衡’) 194: trade(‘sell’, sell_price.toFixed(6), sell_value.toFixed(4), ‘卖出平衡’) 然后报错:InternalError: bad argument #3 to ‘Exchange_Trade’ (float64 expected, got string) at <anonymous> (native) at Buy (FILE) at trade (FILE:139) at onTick (FILE:193) at main (FILE:205) 在API文档里发现exchange.Buy(Price, Amount)传递的两个参数,现货单币种平衡策略里面是: 139 id = exchange.Buy(price, amount, msg) 三个参数删掉msg后还是如上报错,感觉是toFixed()用错了,求正确的截取小数点位数的方法


More

小草 参数需要时数字,结果得到了字符串,用FMZ自带的_N函数,文档里有