ccxt / ccxt

A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges
https://docs.ccxt.com
MIT License
32.45k stars 7.46k forks source link

bybit fetchTickers() failing. uncaught error #20679

Open Eternal-Sunshine opened 8 months ago

Eternal-Sunshine commented 8 months ago

Operating System

Multiple OS

Programming Languages

JavaScript

CCXT Version

4.1.58

Description

There is an unhandled error inside bybit fetchTickers(). When I start the server it runs without issue for some days. but after few days it starts failing with unhandled error in ccxt. Attaching below the error stacktrace.

I am calling fetchTickers() in interval for serveral other exchanges and none of the other exchanges throws this error. My guess is after fews days when bybit ads/remove any coin pair then this error starts to happen and is related with bybit fetchTickers exchange response parsing logic.

Please provide some help in this regard.

Code

 Error Fetching tickers for bybit BadSymbol: bybit does not have market symbol ZKFUSDT
 at bybit.market (/var/www/...../node_modules/ccxt/dist/cjs/src/bybit.js:1256:15)
 at bybit.fetchTickers (/var/www/..../node_modules/ccxt/dist/cjs/src/bybit.js:2164:38)
 at runMicrotasks (<anonymous>)
 at processTicksAndRejections (node:internal/process/task_queues:96:5)  
carlosmiei commented 8 months ago

Hello @Eternal-Sunshine, yes I think it might be related to that (the addition of a new market), do you think that you occasionally run await exchange.loadMarkets(true) to refresh the cache with the markets?

Eternal-Sunshine commented 8 months ago

yes we do force reload of the market every 6 hours to automatically sync new coin's in all ccxt instances.

Earlier this unhandled error used to come after some days since server restarts. but today. this error is coming even after server restarts. making it completely impossible to trade on bybit.

carlosmiei commented 8 months ago

@Eternal-Sunshine Does it always happen with the same (missing) market?

Eternal-Sunshine commented 8 months ago

No, It happens with different symbols at different point of time. Here is another error stack of same signature.

Error Fetching tickers for bybit BadSymbol: bybit does not have market symbol ACEUSDT at bybit.market (/var/www/.../node_modules/ccxt/dist/cjs/src/bybit.js:1256:15) at bybit.fetchTickers (/var/www/.../node_modules/ccxt/dist/cjs/src/bybit.js:2164:38) at runMicrotasks (<anonymous>) at processTicksAndRejections (node:internal/process/task_queues:96:5)

Eternal-Sunshine commented 8 months ago

Can someone look at it please. My guess is it's fix is simple. Just ignore the symbol which is throwing error and parse other coins tickers which are parsable and present in markets dictionary. Failing entire fetchTickers() because it is unable to parse a single coin in it is the faulty logic.

carlosmiei commented 8 months ago

@Eternal-Sunshine We will try to deploy a fix

carlosmiei commented 8 months ago

@Eternal-Sunshine Actually, I can't reproduce this issue, are you calling fetchTickers with or without symbols?

Eternal-Sunshine commented 8 months ago

Without symbol. It happens when system keeps running for sometime. Probably when exchange adds or removes a symbol. Not sure.

carlosmiei commented 8 months ago

@Eternal-Sunshine Can you please try to upgrade your ccxt version to the latest to see if the issue persists? right now I can't reproduce it