ccxt: NetworkError fetch failed

Operating System

Ubuntu

Programming Languages

JS

CCXT Version

3.0.20

Description

This exception doesn’t get handled properly :

NetworkError: binance GET https://api.binance.com/api/v3/ticker/24hr?symbol=BTCUSDT fetch failed at binance.fetch (/var/opt/balance-botv2/node_modules/ccxt/dist/ccxt.bundle.cjs:18402:23) at runMicrotasks (<anonymous>) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async binance.fetch2 (/var/opt/balance-botv2/node_modules/ccxt/dist/ccxt.bundle.cjs:20144:16) at async binance.request (/var/opt/balance-botv2/node_modules/ccxt/dist/ccxt.bundle.cjs:36737:26) at async binance.fetchTicker (/var/opt/balance-botv2/node_modules/ccxt/dist/ccxt.bundle.cjs:32051:26) at async _0x264545 (/var/opt/balance-botv2/bb/bot.js:1:12815)

Code

await exchange.fetchTicker(symbol); 

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 32 (5 by maintainers)

Most upvoted comments

I found the problem. I was doing this:

const ccxt = require(‘ccxt’).pro

Removed the .pro and and adjusted the relevant parts of my code accordingly. Now it’s working. My mistake, apologies for that. Case closed.

I’m seeing this issue on a regular basis with v3.0.20, but I’ll update to the latest and see if it still appears.