DeviaVir / zenbot

Zenbot is a command-line cryptocurrency trading bot using Node.js and MongoDB.
MIT License
8.22k stars 2.04k forks source link

Recover from "Failed to load orderbook" #1017

Open glennfu opened 6 years ago

glennfu commented 6 years ago

System information

Describe the problem

getProductOrderBook(), both in public and authenticated forms, have no retry mechanism. Any network error results in a call to throw 'Failed to load orderbook: ' + response.statusCode; immediately closing Zenbot.

I'm currently in an area where the network can hang for up to a minute, and it can't be helped. I'm assuming that's what happened while Zenbot was trying to refresh the order book, and so the whole thing just crashed. Ideally, it would wait for a couple of seconds, and then try again, with no crash, in the same way that backfill.js's and trade.js's exchange.getTrades know how to retry without crashing.

assa83 commented 6 years ago

I am getting exactly the same error but absolutely no issue with network

monshyn commented 6 years ago

I'm also having the same error and its stops zenbot. I'm also seeing more GDAX API is down! unable to call getQuote, retrying in 10s errors, as well. This second error doesn't stop zenbot, it keeps trading after the error. I'm not sure if it's related.

vinngn commented 6 years ago

Running zenbot backfill gdax.BTC-USD --days=1, get same error.

Error: Failed to load orderbook: Cannot read property 'map' of undefined at OrderbookSync.onError (/Users/vn/coin/zenbot/node_modules/gdax/lib/orderbook_sync.js:95:26) at at process._tickCallback (internal/process/next_tick.js:188:7)

I dont know where to locate internal/process/next_tick.js. It could be a bug with in gdax-node.

vinngn commented 6 years ago

Further debugging, GDAX is under maintenance when I ran that. Response from gdax when loading orderbook { message: 'GDAX is currently under maintenance. For updates please see https://status.gdax.com/' }