Forums

Error: connect ECONNREFUSED when trying to connect to a cryptocurrency exchange

Hi I've just started trying to use pythonanywhere today, for running some scripts that requires connection to cryptocurrency exchange. Below is the script I'm trying to run.

from mexc_sdk import Spot
client = Spot()
info = client.ticker_price("BTCUSDT")
print(info)

However I've been running into the error below

jsii.errors.JavaScriptError: 
  Error: connect ECONNREFUSED 23.205.106.132:443
      at extractValue (/tmp/jsii-kernel-ZV9Lx8/node_modules/mexc-sdk/node_modules/sync- 
   rpc/lib/index.js:165:19)
      at /tmp/jsii-kernel-ZV9Lx8/node_modules/mexc-sdk/node_modules/sync-rpc/lib/index.js:175:12
      at Function.request [as default] (/tmp/jsii-kernel-ZV9Lx8/node_modules/mexc-sdk/node_modules/sync- 
   request/lib/index.js:28:15)
      at Object.createRequest (/tmp/jsii-kernel-ZV9Lx8/node_modules/mexc-sdk/src/util/util.js:7:34)
      at Spot.publicRequest (/tmp/jsii-kernel-ZV9Lx8/node_modules/mexc-sdk/src/modules/base.js:33:23)
      at Spot.tickerPrice (/tmp/jsii-kernel-ZV9Lx8/node_modules/mexc-sdk/src/modules/market.js:143:26)
      at /tmp/tmp4nl8r22i/lib/program.js:8236:134
      at Kernel._wrapSandboxCode (/tmp/tmp4nl8r22i/lib/program.js:8848:24)
      at /tmp/tmp4nl8r22i/lib/program.js:8236:107
      at Kernel._ensureSync (/tmp/tmp4nl8r22i/lib/program.js:8829:28)

Not sure what this is about, can anyone help me on this? As I'm pretty new to this, would appreciate some help.

It doesn't look like full traceback message. By looking at the docs, though, I'd guess that the error could be caused by malformed client? Shouldn't it have an api_key and apiSecret set? See here.