Closed zydjohnHotmail closed 1 year ago
Use the class okex5
for the v5 api
Hi: The following is the output for using okex5:
D:\nodejs\CCXT_Tickers>node okex_fetch1Ticker.js ATOM
BadSymbol: okex5 does not have market symbol ATOM
at okex5.market (D:\nodejs\CCXT_Tickers\node_modules\ccxt\js\base\Exchange.js:2567:15)
at okex5.fetchTicker (D:\nodejs\CCXT_Tickers\node_modules\ccxt\js\okx.js:1445:29)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async fetch1Ticker (D:\nodejs\CCXT_Tickers\okex_fetch1Ticker.js:23:17) {
constructor: [class BadSymbol extends BadRequest]
}
My related code part:
let exchange = new ccxt.okex5 ({
'adjustForTimeDifference': true,
defaultType: 'spot',
'verbose': false
});
const fetch1Ticker = async (pair1) => {
try {
if (exchange.has['fetchTicker']) {
const ticker1 = await exchange.fetchTicker(pair1);
if (typeof ticker1 !== 'undefined') {
const json_ticker1 = JSON.stringify(ticker1);
console.log(json_ticker1);
} else {
const obj_jsonTicker0 = ({ 'Data': [] });
const json_ticker0 = JSON.stringify(obj_jsonTicker0);
console.log(json_ticker0);
}
}
} catch (err) {
console.error(err)
}
};
fetch1Ticker(pair1);
@zydjohnHotmail
ATOM
alone isn't a pair or a market symbol, it's just a currency. A market symbol includes the base and quote currency, and some other things when trading derivatives
Hi, Sorry, I made a mistake, this issue can be closed now.
Operating System
Windows 10
Programming Languages
JS
CCXT Version
2.6.7
Description
Hello: I want to check one actively traded symbol ‘ATOM’ (COSMOS) on okex exchange, I got the following output:
The wired information is: "active":false, So I asked okex API support on their telegram public channel, their answer is: This is not the data returned by the v5 api. This field is not available in the document. And they gave me the URL for API V5 document: Overview – OKX API guide | OKX technical support | OKX
I changed my code to use verbose output, but I can not see any API endpoint for fetch1Currency, please check the new API document and make some modification to reflex the latest API function calls. Thanks,
Code