DeviaVir / zenbot

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

Error Saving Period #526

Closed VertigoRay closed 7 years ago

VertigoRay commented 7 years ago

Thank you so much for your work on this bot.

I've been running this fine in paper mode without error for a couple of days. I woke up this morning, and found this error:

2017-09-06 09:29:11 - error saving my_trade
{ MongoError: server instance pool was destroyed
    at Function.MongoError.create (/home/vertigoray/Git/zenbot/node_modules/mongodb-core/lib/error.js:29:11)
    at basicWriteValidations (/home/vertigoray/Git/zenbot/node_modules/mongodb-core/lib/topologies/server.js:462:51)
    at Server.update (/home/vertigoray/Git/zenbot/node_modules/mongodb-core/lib/topologies/server.js:581:16)
    at Server.update (/home/vertigoray/Git/zenbot/node_modules/mongodb/lib/server.js:397:17)
    at updateDocuments (/home/vertigoray/Git/zenbot/node_modules/mongodb/lib/collection.js:1055:19)
    at save (/home/vertigoray/Git/zenbot/node_modules/mongodb/lib/collection.js:1341:12)
    at Collection.save (/home/vertigoray/Git/zenbot/node_modules/mongodb/lib/collection.js:1324:44)
    at Object.save (/home/vertigoray/Git/zenbot/node_modules/sosa_mongo/mongo_backend.js:35:12)
    at withHooks (/home/vertigoray/Git/zenbot/node_modules/sosa/api.js:68:15)
    at Object.save (/home/vertigoray/Git/zenbot/node_modules/sosa/api.js:65:12)
    at savePeriod (/home/vertigoray/Git/zenbot/commands/trade.js:449:27)
    at /home/vertigoray/Git/zenbot/commands/trade.js:461:19
    at end (/home/vertigoray/Git/zenbot/node_modules/run-series/index.js:8:15)
    at done (/home/vertigoray/Git/zenbot/node_modules/run-series/index.js:11:10)
    at Immediate.each (/home/vertigoray/Git/zenbot/node_modules/run-series/index.js:16:43)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)
  name: 'MongoError',
  message: 'server instance pool was destroyed',
  saved: false,
  obj:
   { period_id: 'm25078469',
     size: '1m',
     time: 1504708140000,
     open: 78.07,
     high: 78.07,
     low: 78.07,
     close: 78.07,
     volume: 8.81191444,
     close_time: 1504708150687,
     speed: 0.03844182470526259,
     abs_speed: 0.03844182470526259,
     baseline: 0.2386469544467618,
     id: '4a7fb927',
     selector: 'gdax.LTC-USD',
     session_id: 'fe2bc17b' } }

Based on the line numbers, I believe the error should be: error saving period. Anyway, I just wanted to get this reported. If I get a chance I'll dig into the code some more.

I was going to get you a version (zenbot --version), but when I ran it, I got this:

warning: mongodb not accessible. some features (such as backfilling/simulation) may be disabled.
4.0.5

Trying to restart the bot with this command:

$ zenbot trade gdax.LTC-USD --paper --currency_capital=500 --enable_profit_pct=10 --profit_stop_pct=4 --trend_ema=36 --sell_rate=-0.006

Give me this output:

warning: mongodb not accessible. some features (such as backfilling/simulation) may be disabled.
/home/vertigoray/Git/zenbot/node_modules/sosa_mongo/mongo_backend.js:6
  if (!backend_options.db) throw new Error('must pass a node-mongodb-native db with backend_options.db');
                           ^

Error: must pass a node-mongodb-native db with backend_options.db
    at module.exports (/home/vertigoray/Git/zenbot/node_modules/sosa_mongo/mongo_backend.js:6:34)
    at /home/vertigoray/Git/zenbot/node_modules/sosa/index.js:7:17
    at createCollection (/home/vertigoray/Git/zenbot/db/createCollection.js:5:7)
    at Object.container (/home/vertigoray/Git/zenbot/db/sessions.js:2:36)
    at Object.getValue (/home/vertigoray/Git/zenbot/node_modules/codemap/index.js:298:22)
    at /home/vertigoray/Git/zenbot/node_modules/codemap/index.js:238:23
    at Array.forEach (native)
    at Object.get (/home/vertigoray/Git/zenbot/node_modules/codemap/index.js:237:13)
    at get (/home/vertigoray/Git/zenbot/node_modules/codemap/index.js:60:22)
    at Command.<anonymous> (/home/vertigoray/Git/zenbot/commands/trade.js:173:24)
    at Command.listener (/home/vertigoray/Git/zenbot/node_modules/commander/index.js:300:8)
    at emitTwo (events.js:106:13)
    at Command.emit (events.js:191:7)
    at Command.parseArgs (/home/vertigoray/Git/zenbot/node_modules/commander/index.js:635:12)
    at Command.parse (/home/vertigoray/Git/zenbot/node_modules/commander/index.js:457:21)
    at /home/vertigoray/Git/zenbot/zenbot.sh:39:11
    at /home/vertigoray/Git/zenbot/boot.js:28:7
    at f (/home/vertigoray/Git/zenbot/node_modules/once/once.js:25:25)
    at Glob.<anonymous> (/home/vertigoray/Git/zenbot/node_modules/glob/glob.js:151:7)
    at emitOne (events.js:96:13)
    at Glob.emit (events.js:188:7)
    at Glob._finish (/home/vertigoray/Git/zenbot/node_modules/glob/glob.js:197:8)

Seems to be that my mongo instance has crashed. I find that odd since I have a pretty beefy server that otherwise exhibits no issues. Maybe this is the first sign? 😟

VertigoRay commented 7 years ago

Disregard: file system full. 😌

Apparently, I had some VMs running on the SSD with MongoDB and it got filled up.