我正在编写一些代码以调用 api 并获取一些数据....该代码有一个 github 存储库 https://github.com/kwiksand/yobit我调用了一个名为 addTrade 的函数/方法(在 index.js 下)...
通过 API key 和安全性后,我有以下代码:
privateYoBit.addTrade(function(err,data){
console.log(data);
console.log(err)
},"eth_btc","buy",0.04, 0.02);
}
我得到以下回复:
{ success: 0, error: 'invalid method' }
null
我的问题是:
非常感谢任何帮助/支持
问候
最佳答案
阅读 source of the mentioned library ,看起来作者正在发送以下参数作为请求的一部分:
var params = {
symbol: symbol,
type: type,
amount = amount,
price = price
}
但是,阅读 the documentation for the API ,他们期望以下 4 个参数:
pair : pair (example: ltc_btc)
type : transaction type (example: buy или sell)
rate : exchange rate for buying or selling (value: numeral)
amount : amount needed for buying or selling (value: numeral)
也许尝试调整库以符合 API 期望的参数?
如果我是你,我会非常小心使用不受信任、未经测试的 API 进行交易......
关于javascript - 如何读取node.js中回调函数的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47401361/