我正在尝试使用 kucoin-api 包访问任何端点,并取回任何数据。这看起来很简单,但我在 Node 中遇到了这个错误:
HttpError [ImATeapotError]: The api version you are using has been disabled. Please use the latest url of api.
at ClientRequest.onResponse (/Users/danieljobe/Desktop/kucoin/node_modules/restify-clients/lib/HttpClient.js:217:26)
at Object.onceWrapper (events.js:483:26)
at ClientRequest.emit (events.js:376:20)
at HTTPParser.parserOnIncomingClient (_http_client.js:647:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
at TLSSocket.socketOnData (_http_client.js:515:22)
at TLSSocket.emit (events.js:376:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at TLSSocket.Readable.push (internal/streams/readable.js:223:10) {
jse_shortmsg: '',
jse_info: {},
body: {}
}
这里有一个未解决的问题引用了同样的错误,当它被 API 使用时,它看起来是一个与http 包依赖项有关的错误,但我就可以跟踪错误。我在这里缺少什么吗?任何想法或建议将不胜感激。谢谢!
和代码:
'use strict'
require('dotenv').config();
const http = require('http');
const Kucoin = require('kucoin-api');
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('You got served.');
});
server.listen(3000, "localhost", () => {
console.log(`Server running at http://localhost:${port}/`);
});
let kc = new Kucoin(process.env.KCAPIKEY, process.env.KCAPISECRET)
kc.getBalance({
symbol: 'GAS'
})
.then((result) => {
console.log(result)
})
.catch((err) => {
console.log(err)
});