我在pro.coinbase上创建了具有所有三个权限的api密钥。
我正在尝试使用自述文件中的代码段来获取帐户ID。
client.getAccounts({}, function(err, accounts) {
if(accounts!=null){
accounts.forEach(function(acct) {
console.log('my bal: ' + acct.balance.amount + ' for ' + acct.name);
});
}else{
console.log("accounts="+accounts);
console.log(err);
}
});
结果:
accounts=null
AuthenticationError: invalid api key
at handleHttpError (/node_modules/coinbase/lib/errorHandler.js:46:15)
at Request.onGet [as _callback] (/node_modules/coinbase/lib/ClientBase.js:160:10)
at Request.self.callback (/node_modules/coinbase/node_modules/request/request.js:186:22)
at Request.emit (events.js:182:13)
at Request.<anonymous> (/node_modules/coinbase/node_modules/request/request.js:1163:10)
at Request.emit (events.js:182:13)
at IncomingMessage.<anonymous> (/node_modules/coinbase/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:273:13)
at IncomingMessage.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1094:12)
我想念什么? (我可以使用这些键无误地获得当前价格。)