Closed mapierce closed 3 years ago
try increasing the TIMING.RECEIVE_WINDOW in your configuration file.
i still have issues maybe it needs some code fixes there to ignore timed out tickers and retry later. or maybe limit the tickers to initialize.
The config looks fine. I'm slightly worried that an error is being buried complaining that a request's timestamp is ahead of server time which could happen if USE_SERVER_TIME
is set to true. Set that value to false and restart the bot.
Does this happen when starting the bot? Or does the bot run for some time and then you experience this?
On a side note @paranic the next release will reduce the number of socket connections!
Ok, so I reset the DEPTH.SIZE
back to the default of 50
, and set the TIMING.USE_SERVER_TIME
to false
, and the error is slightly different:
> binance-triangle-arbitrage@5.5.0 start /../../../binance-triangle-arbitrage
> node src/main/Main.js
Error: connect ECONNREFUSED **.***.**.***:443
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16) {
errno: -61,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '**.***.**.***',
port: 443
}
Don't really know what to be at... ¯_(ツ)_/¯
Based on that log, the bot is attempting to measure latency by performing 5 REST calls to https://api.binance.com/api/v3/time
Can you access this url in a browser? Or curl it from the command line like:
curl https://api.binance.com/api/v3/time
Yep, just re-ran there and this is the first output I get:
> binance-triangle-arbitrage@5.5.0 start /../../../binance-triangle-arbitrage
> node src/main/Main.js
Successfully pinged Binance in 449 ms
Found 691/958 currently trading tickers
Found 167 triangular relationships
Checking configuration ...
Opening 691 depth websockets ...
/../../../binance-triangle-arbitrage/node_modules/node-binance-api/node-binance-api.js:4822
if ( err ) throw err;
^
Error: ESOCKETTIMEDOUT
at ClientRequest.<anonymous> (/../../../binance-triangle-arbitrage/node_modules/request/request.js:816:19)
at Object.onceWrapper (events.js:420:28)
at ClientRequest.emit (events.js:314:20)
at TLSSocket.emitRequestTimeout (_http_client.js:769:9)
at Object.onceWrapper (events.js:420:28)
at TLSSocket.emit (events.js:326:22)
at TLSSocket.Socket._onTimeout (net.js:483:8)
at listOnTimeout (internal/timers.js:551:17)
at processTimers (internal/timers.js:494:7) {
code: 'ESOCKETTIMEDOUT',
connect: false
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! binance-triangle-arbitrage@5.5.0 start: `node src/main/Main.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the binance-triangle-arbitrage@5.5.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /../../.npm/_logs/2020-08-17T22_54_58_455Z-debug.log
Contents of the debug.log
are:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@6.14.7
3 info using node@v14.8.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle binance-triangle-arbitrage@5.5.0~prestart: binance-triangle-arbitrage@5.5.0
6 info lifecycle binance-triangle-arbitrage@5.5.0~start: binance-triangle-arbitrage@5.5.0
7 verbose lifecycle binance-triangle-arbitrage@5.5.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle binance-triangle-arbitrage@5.5.0~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:~/Documents/Code/Node/Binance/binance-triangle-arbitrage/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS
9 verbose lifecycle binance-triangle-arbitrage@5.5.0~start: CWD:~/Documents/Code/Node/Binance/binance-triangle-arbitrage
10 silly lifecycle binance-triangle-arbitrage@5.5.0~start: Args: [ '-c', 'node src/main/Main.js' ]
11 silly lifecycle binance-triangle-arbitrage@5.5.0~start: Returned: code: 1 signal: null
12 info lifecycle binance-triangle-arbitrage@5.5.0~start: Failed to exec start script
13 verbose stack Error: binance-triangle-arbitrage@5.5.0 start: `node src/main/Main.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:314:20)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:314:20)
13 verbose stack at maybeClose (internal/child_process.js:1051:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid binance-triangle-arbitrage@5.5.0
15 verbose cwd ~/Documents/Code/Node/Binance/binance-triangle-arbitrage
16 verbose Darwin 19.6.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
18 verbose node v14.8.0
19 verbose npm v6.14.7
20 error code ELIFECYCLE
21 error errno 1
22 error binance-triangle-arbitrage@5.5.0 start: `node src/main/Main.js`
22 error Exit status 1
23 error Failed at the binance-triangle-arbitrage@5.5.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
The workaround for ESOCKETTIMEDOUT and ETIMEDOUT errors is to increase the TIMING.RECEIVE_WINDOW
to something higher like 10000
I am baffled by the ECONNREFUSED and that is the first I've seen it reported
Ok, so in a bizarre turn of events, if I hotspot from my phone, it all works fine. It's not working on my home network. What the hell is that about? Anyway, I don't think that really matters considering I should really be running this from a server in HK right? Thanks for the help anyways.
Which error do you get consistently on your home network?
I have long suspected that ISPs could be at fault for throttling foreign connections and this could potentially shed some light on this
The ECONNREFUSED
error. Then switch to hotspot and all good.
Okay glad you have a consistent workaround!! For future debugging can I get the following please:
Getting this output when running
npm start
My config looks like this:
Environment: Macos: 10.15.6 Node: 14.8.0 Npm: 6.14.7