GithubHelp home page GithubHelp logo

deviavir / zenbot Goto Github PK

View Code? Open in Web Editor NEW
8.2K 473.0 2.0K 30.52 MB

Zenbot is a command-line cryptocurrency trading bot using Node.js and MongoDB.

License: MIT License

JavaScript 19.33% HTML 72.42% CSS 6.07% Python 0.66% Smarty 0.29% Batchfile 0.01% Shell 0.03% Makefile 0.08% Dockerfile 0.11% EJS 1.01%
zenbot trade paper-trading strategy nodejs python

zenbot's Introduction

WARNING: project is no longer actively maintained, make sure to update any dependencies if you plan on using this in your project.

zenbot logo

“To follow the path, look to the master, follow the master, walk with the master, see through the master, become the master.” – Zen Proverb

Zenbot Build/Test Status

Description

Zenbot is a command-line cryptocurrency trading bot using Node.js and MongoDB. It features:

  • Fully-automated technical-analysis-based trading approach
  • Full support for Binance, Bitfinex, Bitstamp, Bittrex, CEX.IO, GDAX, Gemini, HitBTC, Kraken, Poloniexand TheRockTrading, work on further exchange support is ongoing.
  • Plugin architecture for implementing exchange support, or writing new strategies
  • Simulator for backtesting strategies against historical data
  • "Paper" trading mode, operates on a simulated balance while watching the live market
  • Configurable sell stops, buy stops, and (trailing) profit stops
  • Flexible sampling period and trade frequency - averages 1-2 trades/day with 1h period, 15-50/day with 5m period

Disclaimer

  • Zenbot is NOT a sure-fire profit machine. Use it AT YOUR OWN RISK.
  • Crypto-currency is still an experiment, and therefore so is Zenbot. Meaning, both may fail at any time.
  • Running a bot, and trading in general requires careful study of the risks and parameters involved. A wrong setting can cause you a major loss.
  • Never leave the bot un-monitored for long periods of time. Zenbot doesn't know when to stop, so be prepared to stop it if too much loss occurs.
  • Often times the default trade parameters will underperform vs. a buy-hold strategy, so run some simulations and find the optimal parameters for your chosen exchange/pair before going "all-in".

Documentation

The extensive documentation is located at the docs-folder.

Questions

First have a look at the docs and there are also FAQs which may answer your questions. If not, please ask (programming) questions related to Zenbot on Reddit (subreddit zenbot).

Community

Join the Zenbot community on Reddit!

Donate

P.S., some have asked for how to donate to Zenbot development. We accept donations at Bitcoin addresses below:

carlos8f's BTC (original Zenbot author)

187rmNSkSvehgcKpBunre6a5wA5hQQop6W

DeviaVir's BTC (current maintainer)

3A5g4GQ2vmjNcnEschCweJJB4umzu66sdY

zenbot logo

Thanks!

Noteworthy forks


License: MIT

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

zenbot's People

Contributors

bakfr avatar brucetus avatar cmroche avatar crubb avatar cvinacua avatar defkev avatar dependabot[bot] avatar deviavir avatar emabo avatar firepol avatar fuzzytew avatar glennfu avatar greenkeeper[bot] avatar grigio avatar haehnchen avatar haxwell avatar kernelsndrs avatar kryptonova avatar krystophv avatar maddcow avatar mmdiego avatar mt00x avatar nedievas avatar olexiyb avatar shawn8901 avatar snyk-bot avatar station384 avatar talvasconcelos avatar thediverdk avatar tiagosiebler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zenbot's Issues

MongoError: failed to connect to server

Can't understand why:

MacBook-Pro:zenbot macbookpro$ ./reducer.sh

/Users/macbookpro/btc-bot/zenbot/node_modules/motley-mongo/node_modules/mongodb/lib/mongo_client.js:225
          throw err
          ^
MongoError: failed to connect to server [localhost:27017] on first connect
    at null.<anonymous> (/Users/macbookpro/btc-bot/zenbot/node_modules/motley-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:312:35)
    at emitOne (events.js:77:13)
    at emit (events.js:169:7)
    at null.<anonymous> (/Users/macbookpro/btc-bot/zenbot/node_modules/motley-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:256:12)
    at g (events.js:260:16)
    at emitTwo (events.js:87:13)
    at emit (events.js:172:7)
    at Socket.<anonymous> (/Users/macbookpro/btc-bot/zenbot/node_modules/motley-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:160:49)
    at Socket.g (events.js:260:16)
    at emitOne (events.js:77:13)

I was try to reinstall all, but again same error.

backtest simulation behaviour

zenbot trade frequency on simulations is always one every hour at most even with rs.check_period set to 1m (and rs.min_*_wait set to 0), eg:

$ jq ".actions[].timestamp" sims/2016-08-24/btc-usd_1m
"05/26/2016 03:01:00 PM CEST"
"06/07/2016 06:01:00 PM CEST"
"06/08/2016 09:01:00 PM CEST"
"06/14/2016 05:01:00 PM CEST"
"06/15/2016 08:01:00 PM CEST"
"06/19/2016 07:01:00 AM CEST"
"06/23/2016 08:01:00 PM CEST"
"06/25/2016 10:01:00 PM CEST"
"06/28/2016 02:01:00 AM CEST"
"06/29/2016 07:01:00 AM CEST"
"06/30/2016 11:01:00 AM CEST"
"07/03/2016 10:01:00 AM CEST"
"07/04/2016 03:01:00 PM CEST"
"07/05/2016 03:02:00 PM CEST"
"07/07/2016 01:01:00 AM CEST"
"07/09/2016 02:01:00 PM CEST"
"07/11/2016 05:01:00 AM CEST"
"07/14/2016 01:01:00 AM CEST"
"07/15/2016 10:01:00 AM CEST"
"07/16/2016 03:01:00 PM CEST"
"07/17/2016 03:02:00 PM CEST"
"07/18/2016 06:01:00 PM CEST"
"07/20/2016 07:01:00 AM CEST"
"07/22/2016 01:01:00 PM CEST"
"07/23/2016 01:02:00 PM CEST"
"07/25/2016 08:01:00 AM CEST"
"07/26/2016 09:01:00 PM CEST"
"07/31/2016 04:01:00 AM CEST"
"08/03/2016 01:01:00 PM CEST"
"08/04/2016 08:01:00 PM CEST"
"08/06/2016 12:01:00 AM CEST"
"08/11/2016 09:01:00 PM CEST"
"08/13/2016 09:01:00 AM CEST"
"08/14/2016 09:02:00 AM CEST"
"08/16/2016 06:01:00 AM CEST"
"08/17/2016 04:01:00 PM CEST"

as you can see trades happens always every hour start + (1m x 1 or 2)...
moreover, if setting rs.check_period to 5m trades still happens every hour start + (5m x 1 or 2):

$ jq ".actions[].timestamp" sims/2016-08-24/btc-usd_5m
"05/26/2016 03:05:00 PM CEST"
"06/07/2016 06:05:00 PM CEST"
"06/08/2016 09:05:00 PM CEST"
"06/14/2016 05:05:00 PM CEST"
"06/15/2016 08:05:00 PM CEST"
"06/19/2016 07:05:00 AM CEST"
"06/23/2016 08:05:00 PM CEST"
"06/25/2016 10:05:00 PM CEST"
"06/28/2016 02:05:00 AM CEST"
"06/29/2016 07:05:00 AM CEST"
"06/30/2016 11:05:00 AM CEST"
"07/03/2016 10:05:00 AM CEST"
"07/04/2016 03:05:00 PM CEST"
"07/05/2016 03:10:00 PM CEST"
"07/07/2016 01:05:00 AM CEST"
"07/09/2016 02:05:00 PM CEST"
"07/11/2016 05:05:00 AM CEST"
"07/14/2016 01:05:00 AM CEST"
"07/15/2016 10:05:00 AM CEST"
"07/16/2016 03:05:00 PM CEST"
"07/17/2016 03:10:00 PM CEST"
"07/18/2016 06:05:00 PM CEST"
"07/20/2016 07:05:00 AM CEST"
"07/22/2016 01:05:00 PM CEST"
"07/23/2016 01:10:00 PM CEST"
"07/25/2016 08:05:00 AM CEST"
"07/26/2016 09:05:00 PM CEST"
"07/31/2016 04:05:00 AM CEST"
"08/03/2016 01:05:00 PM CEST"
"08/04/2016 08:05:00 PM CEST"
"08/06/2016 12:05:00 AM CEST"
"08/11/2016 09:05:00 PM CEST"
"08/13/2016 09:05:00 AM CEST"
"08/14/2016 09:10:00 AM CEST"
"08/16/2016 06:05:00 AM CEST"
"08/17/2016 04:05:00 PM CEST"

so the trades are almost identical but shifted to the 5th or the 10th minute...
on the other hand online trades happens (correctly) at any time whenever the conditions are met, eg:

08/23/2016 12:56:00 AM CEST [      action] m24531775 buy {
  "type": "buy",
  "asset": "BTC",
  "currency": "EUR",
  "exchange": "gdax",
  "price": 520.61,
  "fee": 1.225,
  "market": true,
  "size": 0.9412035880985766,
  "rsi": 70.04739336492952,
  "roi": 1.0003260597302503,
  "performance": null,
  "waited": null,
  "id": "c9b959930a9d59ce",
  "time": 1471906560000,
  "timestamp": "08/23/2016 12:56:00 AM CEST"
}

thus backtest simulation results won't reflect the results of the online trader because they'll trade at different timestamps and frequencies...

MongoDB timeouts & process still alive in background

Sometimes ./run.sh crashes because of Mongo but the process is still alive in background
Ubuntu 16.04 LTS / MongoDB 2.6.10

08/15/2016 12:04:39 AM CEST [     reducer]    m24520204     569 trades. 08/15/2016 12:04:01 AM CEST  BUY        86.247 at       $591.71 BTC/USD
08/15/2016 12:04:43 AM CEST [     reducer] processing  35/ticks sec
{ [MongoError: connection 0 to localhost:27017 timed out]
  name: 'MongoError',
  message: 'connection 0 to localhost:27017 timed out' }
08/15/2016 12:05:07 AM CEST [ERROR] reduce err {
  "name": "MongoError",
  "message": "connection 0 to localhost:27017 timed out"
}

/home/grigio/Code/zenbot/node_modules/mongodb/lib/utils.js:98
    process.nextTick(function() { throw err; });
                                  ^
MongoError: connection 0 to localhost:27017 timed out

Is this output correct?

I have been tweaking and playing around in my strategy, and making 24% Profit? That is huge!

Although I am highly aware this stuff is still Alpha and currently bashing my head over theories... this is used on BTC/EUR Market on GDAX. Personally I would not recommend using this strategy unless you are willing to risk to lose your assets or going to use it for TESTING purposes.

08/17/2016 09:49:39 AM CEST [    launcher] cmd `sim` booting
{
  "id": "873aef7aad3c86e7",
  "ticks": 190122,
  "sim_end_timestamp": "08/11/2016 02:00:00 AM CEST",
  "sim_start_bucket": "7d2420",
  "sim_start_time": 1463616000000,
  "sim_start_tick": "7d2420",
  "sim_start_timestamp": "05/19/2016 02:00:00 AM CEST",
  "end_time": 1470873300000,
  "queue": [],
  "actions": [
    {
      "type": "buy",
      "asset": "BTC",
      "currency": "EUR",
      "exchange": "gdax",
      "price": 401.5,
      "market": true,
      "size": 0.012453300124533002,
      "rsi": 21,
      "roi": 0.9950556089862149,
      "id": "407315029c53036a",
      "time": 1463660100000,
      "timestamp": "05/19/2016 02:15:00 PM CEST"
    },
    {
      "type": "buy",
      "asset": "BTC",
      "currency": "EUR",
      "exchange": "gdax",
      "price": 397.02,
      "market": true,
      "size": 0.010075059190972749,
      "rsi": 34,
      "roi": 0.98841588513003,
      "id": "4794626ce34a1f46",
      "time": 1463690880000,
      "timestamp": "05/19/2016 10:48:00 PM CEST"
    },
    {
      "type": "sell",
      "asset": "BTC",
      "currency": "EUR",
      "exchange": "gdax",
      "price": 543.1,
      "market": true,
      "size": 0.016835824017178733,
      "rsi": 91,
      "roi": 1.2343536023729769,
      "id": "0619efd2a9f2bcce",
      "time": 1465691940000,
      "timestamp": "06/12/2016 02:39:00 AM CEST"
    },
    {
      "type": "sell",
      "asset": "BTC",
      "currency": "EUR",
      "exchange": "gdax",
      "price": 615.1,
      "market": true,
      "size": 0.013468659213742986,
      "rsi": 92,
      "roi": 1.3313279487119265,
      "id": "058e99d711bca5cd",
      "time": 1467349620000,
      "timestamp": "07/01/2016 07:07:00 AM CEST"
    },
    {
      "type": "buy",
      "asset": "BTC",
      "currency": "EUR",
      "exchange": "gdax",
      "price": 610.99,
      "market": true,
      "size": 0.010942276733204496,
      "rsi": 41,
      "roi": 1.3268994535624479,
      "id": "8ed606f7d76fcd23",
      "time": 1467382080000,
      "timestamp": "07/01/2016 04:08:00 PM CEST"
    },
    {
      "type": "sell",
      "asset": "BTC",
      "currency": "EUR",
      "exchange": "gdax",
      "price": 618.88,
      "market": true,
      "size": 0.012963382717635287,
      "rsi": 100,
      "roi": 1.3371275625266623,
      "id": "d9b76f62c9104c3d",
      "time": 1467464280000,
      "timestamp": "07/02/2016 02:58:00 PM CEST"
    },
    {
      "type": "sell",
      "asset": "BTC",
      "currency": "EUR",
      "exchange": "gdax",
      "price": 630.97,
      "market": true,
      "size": 0.01037070617410823,
      "rsi": 94,
      "roi": 1.3496657462911588,
      "id": "cb869419a158ff21",
      "time": 1467499980000,
      "timestamp": "07/03/2016 12:53:00 AM CEST"
    },
    {
      "type": "buy",
      "asset": "BTC",
      "currency": "EUR",
      "exchange": "gdax",
      "price": 604.76,
      "market": true,
      "size": 0.013661243936718592,
      "rsi": 39,
      "roi": 1.3279204495852885,
      "id": "cfb9599e1894f76f",
      "time": 1467626520000,
      "timestamp": "07/04/2016 12:02:00 PM CEST"
    },
    {
      "type": "buy",
      "asset": "BTC",
      "currency": "EUR",
      "exchange": "gdax",
      "price": 605.91,
      "market": true,
      "size": 0.010908252226462587,
      "rsi": 39,
      "roi": 1.329188763163851,
      "id": "c5630c4420f947e1",
      "time": 1467659640000,
      "timestamp": "07/04/2016 09:14:00 PM CEST"
    },
    {
      "type": "sell",
      "asset": "BTC",
      "currency": "EUR",
      "exchange": "gdax",
      "price": 605.11,
      "market": true,
      "size": 0.01321046417192282,
      "rsi": 88,
      "roi": 1.3281319260300974,
      "id": "8d6fd786ffeb7d76",
      "time": 1469389260000,
      "timestamp": "07/24/2016 09:41:00 PM CEST"
    },
    {
      "type": "buy",
      "asset": "BTC",
      "currency": "EUR",
      "exchange": "gdax",
      "price": 593.68,
      "market": true,
      "size": 0.011599333109155103,
      "rsi": 36,
      "roi": 1.3160522775912908,
      "id": "da1ef98b2255b1c5",
      "time": 1469515320000,
      "timestamp": "07/26/2016 08:42:00 AM CEST"
    },
    {
      "type": "buy",
      "asset": "BTC",
      "currency": "EUR",
      "exchange": "gdax",
      "price": 537.3,
      "market": true,
      "size": 0.01025318009341999,
      "rsi": 42,
      "roi": 1.2433883919763675,
      "id": "dff5c22c36dc222f",
      "time": 1470128460000,
      "timestamp": "08/02/2016 11:01:00 AM CEST"
    },
    {
      "type": "sell",
      "asset": "BTC",
      "currency": "EUR",
      "exchange": "gdax",
      "price": 546.2,
      "market": true,
      "size": 0.014938873978053277,
      "rsi": 95,
      "roi": 1.2566839898168345,
      "id": "e8464ba79b958389",
      "time": 1470585300000,
      "timestamp": "08/07/2016 05:55:00 PM CEST"
    },
    {
      "type": "buy",
      "asset": "BTC",
      "currency": "EUR",
      "exchange": "gdax",
      "price": 540.35,
      "market": true,
      "size": 0.011176366289845821,
      "rsi": 24,
      "roi": 1.2496925967951058,
      "id": "3a1d1568ddbb4650",
      "time": 1470623940000,
      "timestamp": "08/08/2016 04:39:00 AM CEST"
    }
  ],
  "market_price": 534.09,
  "progress": 0.76,
  "balance": {
    "BTC": 0.07093186220205892,
    "EUR": 24.15659809887275
  },
  "check_diff": 2.95,
  "last_close": 541.15,
  "rsi": 62,
  "rsi_ansi": "\u001b[37m62\u001b[39m",
  "recovery_ticks": 72,
  "oversold": false,
  "end_balance": 62.484629839755286,
  "roi": 1.2496925967951058,
  "trades": 14,
  "overbought": false,
  "end_us": 1471420195613869,
  "last_us": 16340535,
  "last_duration": "16s 340ms 535µs",
  "sim_time": 7257300000,
  "sim_duration": "83d 23h 55m",
  "input_hash": "faf4c0f720bd51a2b9946f0e90405d3d48812106"
}

Strategy:

var first_run = true
var last_balance_sig

module.exports = function container (get, set, clear) {
  var c = get('config')
  var o = get('utils.object_get')
  var n = require('numbro')
  var tb = require('timebucket')
  var sig = require('sig')
  var format_currency = get('utils.format_currency')
  var get_timestamp = get('utils.get_timestamp')
  var CoinbaseExchange = require('coinbase-exchange')
  var client
  var asset = 'BTC'
  var currency = 'EUR'
  var rsi_period = '15m'
  var rsi_overbought = 88
  var rsi_oversold = 44
  var check_period = '1m'
  var exchange = 'gdax'
  var selector = 'data.trades.' + exchange + '.' + asset + '-' + currency
  var recovery_ticks = 300
  var trade_pct = 0.20
  var min_trade = 0.01
  var start_balance = 50
  function onOrder (err, resp, order) {
    if (err) return get('logger').error('order err', err, resp, order, {feed: 'errors'})
    if (resp.statusCode !== 200) {
      console.error(order)
      return get('logger').error('non-200 status: ' + resp.statusCode, {data: {statusCode: resp.statusCode, body: order}})
    }
    get('logger').info(exchange, ('order-id: ' + order.id).cyan, {data: {order: order}})
    function getStatus () {
      client.getOrder(order.id, function (err, resp, order) {
        if (err) return get('logger').error('getOrder err', err)
        if (resp.statusCode !== 200) {
          console.error(order)
          return get('logger').error('non-200 status from getOrder: ' + resp.statusCode, {data: {statusCode: resp.statusCode, body: order}})
        }
        if (order.status === 'done') {
          return get('logger').info(exchange, ('order ' + order.id + ' done: ' + order.done_reason).cyan, {data: {order: order}})
        }
        else {
          get('logger').info(exchange, ('order ' + order.id + ' ' + order.status).cyan, {data: {order: order}})
          setTimeout(getStatus, 5000)
        }
      })
    }
    getStatus()
  }
  return [
    // BEGIN DEFAULT TRADE LOGIC
    // sync balance
    function (tick, trigger, rs, cb) {
      if (get('command') !== 'run' || !c.gdax_key) {
        return cb()
      }
      if (!client) {
        client = new CoinbaseExchange.AuthenticatedClient(c.gdax_key, c.gdax_secret, c.gdax_passphrase)
      }
      client.getAccounts(function (err, resp, accounts) {
        if (err) throw err
        if (resp.statusCode !== 200) {
          console.error(accounts)
          get('logger').error('non-200 status from exchange: ' + resp.statusCode, {data: {statusCode: resp.statusCode, body: accounts}})
          return cb && cb()
        }
        rs.balance = {}
        accounts.forEach(function (account) {
          if (account.currency === currency) {
            rs.balance[currency] = n(account.balance).value()
          }
          else if (account.currency === asset) {
            rs.balance[asset] = n(account.balance).value()
          }
        })
        var balance_sig = sig(rs.balance)
        if (balance_sig !== last_balance_sig) {
          get('logger').info(exchange, 'balance'.grey, n(rs.balance[asset]).format('0.000').white, asset.grey, n(rs.balance[currency]).format('0.00').yellow, currency.grey, {feed: 'exchange'})
          first_run = false
          last_balance_sig = balance_sig
        }
        cb && cb()
      })
    },
    function (tick, trigger, rs, cb) {
      // note the last close price
      var market_price = o(tick, selector + '.close')
      if (market_price) {
        rs.market_price = market_price
      }
      rs.ticks || (rs.ticks = 0)
      rs.progress || (rs.progress = 0)
      if (!rs.market_price) return cb()
      if (!rs.balance) {
        // start with start_balance, neutral position
        rs.balance = {}
        rs.balance[currency] = start_balance/2
        rs.balance[asset] = n(start_balance/2).divide(rs.market_price).value()
      }
      rs.ticks++
      if (tick.size !== check_period) {
        return cb()
      }
      rs.progress = 1
      if (rs.recovery_ticks) {
        rs.recovery_ticks--
      }
      // what % are we to a decision?
      rs.progress = recovery_ticks ? n(1).subtract(n(rs.recovery_ticks).divide(recovery_ticks)).value() : 1
      if (rs.recovery_ticks) {
        return cb()
      }
      // check price diff
      var close = o(tick || {}, selector + '.close')
      // get rsi
      var rsi_tick_id = tb(tick.time).resize(rsi_period).toString()
      get('ticks').load(get('app_name') + ':' + rsi_tick_id, function (err, rsi_tick) {
        if (err) return cb(err)
        var rsi = o(rsi_tick || {}, selector + '.rsi')
        var rsi_open = o(rsi_tick || {}, selector + '.open')
        // require minimum data
        // overbought/oversold
        // sanity check
        close || (close = o(rsi_tick || {}, selector + '.close'))
        rs.check_diff = close ? n(close).subtract(rsi_open || close).value() : rs.check_diff || null
        rs.last_close = close
        get('logger').info('trader', '================== TRADER REPORT =================='.yellow, {feed: 'trader'})
        if (!rsi) {
          get('logger').info('trader', ('no ' + rsi_period + ' RSI').red, {feed: 'trader'})
        }
        else if (rsi.samples < c.rsi_periods) {
          get('logger').info('trader', (rsi_period + ' RSI: not enough samples: ' + rsi.samples).red, {feed: 'trader'})
        }
        else if (!close) {
          get('logger').info('trader', ('no close price').red, {feed: 'trader'})
        }
        else if (rs.check_diff === null) {
          get('logger').info('trader', ('not enough ticks to make decision').red, {feed: 'trader'})
        }
        else {
          rs.rsi = Math.round(rsi.value)
          rs.rsi_ansi = rsi.ansi
          if (rsi.value >= rsi_overbought) {
            get('logger').info('trader', 'RSI:'.grey + rs.rsi_ansi, ('anticipating a reversal DOWN. sell at market. (' + format_currency(rs.market_price, currency) + ') diff: ' + format_currency(rs.check_diff, currency)).green, {feed: 'trader'})
            rs.overbought = true
          }
          else if (rsi.value <= rsi_oversold) {
            get('logger').info('trader', 'RSI:'.grey + rs.rsi_ansi, ('anticipating a reversal UP. buy at market. (' + format_currency(rs.market_price, currency) + ') diff: ' + format_currency(rs.check_diff, currency)).green, {feed: 'trader'})
            rs.oversold = true
          }
          else {
            get('logger').info('trader', (rsi_period + ' RSI within HOLD range: ').yellow + rsi.ansi + ' diff: '.grey + format_currency(rs.check_diff, currency).grey, {feed: 'trader'})
          }
        }
        get('logger').info('trader', '================== END REPORT =================='.yellow, {feed: 'trader'})
        rs.recovery_ticks = recovery_ticks + 1
        cb()
      })
    },
    // @todo MACD
    function (tick, trigger, rs, cb) {
      cb()
    },
    // trigger trade signals
    function (tick, trigger, rs, cb) {
      if ((rs.overbought || rs.oversold) && rs.balance && rs.market_price) {
        var size, new_balance = {}
        if (rs.overbought) {
          size = rs.balance[asset]
        }
        else if (rs.oversold) {
          size = n(rs.balance[currency]).divide(rs.market_price).value()
        }
        // scale down size a little, to prevent out-of-balance errors
        size = n(size || 0).multiply(trade_pct).value()
        // min size
        if (!size || size < min_trade) {
          if (rs.overbought) {
            get('logger').info('trader', 'RSI:'.grey + rs.rsi_ansi, ('not enough ' + asset + ' to execute sell!').red, {feed: 'trader'})
          }
          else if (rs.oversold) {
            get('logger').info('trader', 'RSI:'.grey + rs.rsi_ansi, ('not enough ' + currency + ' to execute buy!').red, {feed: 'trader'})
          }
          rs.overbought = rs.oversold = false
          return cb()
        }
        if (rs.overbought) {
          new_balance[currency] = n(rs.balance[currency]).add(n(size).multiply(rs.market_price)).value()
          new_balance[asset] = n(rs.balance[asset]).subtract(size).value()
        }
        else if (rs.oversold) {
          new_balance[asset] = n(rs.balance[asset]).add(size).value()
          new_balance[currency] = n(rs.balance[currency]).subtract(n(size).multiply(rs.market_price)).value()
        }
        // consolidate balance
        var new_end_balance = n(new_balance[currency]).add(n(new_balance[asset]).multiply(rs.market_price)).value()
        var new_roi = n(new_end_balance).divide(start_balance).value()
        rs.balance = new_balance
        rs.end_balance = new_end_balance
        rs.roi = new_roi
        rs.trades || (rs.trades = 0)
        rs.trades++
        trigger({
          type: rs.overbought ? 'sell' : 'buy',
          asset: asset,
          currency: currency,
          exchange: exchange,
          price: rs.market_price,
          market: true,
          size: size,
          rsi: rs.rsi,
          roi: rs.roi
        })
        if (get('command') === 'run' && c.gdax_key) {
          var params = {
            type: 'market',
            size: n(size).format('0.000000'),
            product_id: asset + '-' + currency
          }
          client[rs.overbought ? 'sell' : 'buy'](params, function (err, resp, order) {
            onOrder(err, resp, order)
          })
        }
        rs.overbought = rs.oversold = false
      }
      cb()
    }
    // END DEFAULT TRADE LOGIC
  ]
}

cmd `server` exited with code 1, respawning now.

09/07/2016 07:55:30 PM MSK [    launcher] cmd `server` exited with code 1, respawning now.
09/07/2016 07:55:31 PM MSK [    launcher] cmd `server` booting
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::3013
    at Object.exports._errnoException (util.js:870:11)
    at exports._exceptionWithHostPort (util.js:893:20)
    at Server._listen2 (net.js:1237:14)
    at listen (net.js:1273:10)
    at Server.listen (net.js:1369:5)
    at Array.listen (/home/zenbot/node_modules/motley/site/listen.js:3:24)
    at module.exports (/home/zenbot/node_modules/run-series/index.js:20:33)
    at runHook (/home/zenbot/node_modules/motley/hooks/runHook.js:4:29)
    at runListen [as listen] (/home/zenbot/node_modules/motley/hooks/runListen.js:10:25)
    at action (/home/zenbot/plugins/server/action.js:10:9)
09/07/2016 07:55:31 PM MSK [    launcher] cmd `server` exited with code 1, respawning now.
09/07/2016 07:55:32 PM MSK [    launcher] cmd `server` booting
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::3013
    at Object.exports._errnoException (util.js:870:11)
    at exports._exceptionWithHostPort (util.js:893:20)
    at Server._listen2 (net.js:1237:14)
    at listen (net.js:1273:10)
    at Server.listen (net.js:1369:5)
    at Array.listen (/home/zenbot/node_modules/motley/site/listen.js:3:24)
    at module.exports (/home/zenbot/node_modules/run-series/index.js:20:33)
    at runHook (/home/zenbot/node_modules/motley/hooks/runHook.js:4:29)
    at runListen [as listen] (/home/zenbot/node_modules/motley/hooks/runListen.js:10:25)
    at action (/home/zenbot/plugins/server/action.js:10:9)

Why this is happening and what can i do when this happens?

For the development of zenbot

zenbot has many benefits program.

  1. The appropriate rate of return
  2. Easy-to-read statistics page

So this seems to be managed except if one the best.

  1. GDAX have access country-specific constraints
    • If do not use a best of best of good program to poop
  2. The deal should be clear from the large markets
    • OKcoin.cn or Poloniex
  3. Installation and Setup Manual Rewrite
    • Do you even attempt to use the Kraken lack of information
    • #9 Note to install, but I do not know how well
    • Very Difficulty settings (and Nothing Manual)
  4. Diversification strategy
    • The only indicator that one Trading will not see the road light.

    • If it is difficult to implement Fibonacci retracement of the harmonic pattern
      Take advantage of the indicators at https://www.tradingview.com.

    • Recommended indicators
      a. "The Rational Flibbr Indicator v2" + "CM_Williams_Vix_Fix Finds Market Bottoms" ★★
      b. "[LAVA] Renko Mod" ★★
      c. "Indicator: WaveTrend Oscillator [WT]" ★
      d. "VDUB_Rejection_Spike_V3"★
      e. "CM_Ultimate RSI MTF" ★
      f. "Godmode3.1"
      g. "Squeeze Momentum Indicator [LazyBear]"
      h. "ANN Strategy"
      i. "Chande Composite Momentum Index"
      j. "COG Double Channel [LazyBear]"

      best of best indicator is "[LAVA]Renko Mod"

  5. Auto Trading is necessary to money management.
    • Profit or stop loss feature is essential

https://github.com/askmike/gekko is programs are a lot of advantages trading bots.

It would be best of best of best of best of best of best if combined with Zenbot3

Localhost site crashes server process on Windows

Hi,

After just updating to your v3.0.2 and rebuilding /data/db, everything is working fine (expect still requiring cross-spawn on Windows), but when I go to load the localhost website it gives me this error:

08/14/2016 10:37:14 PM BST [      server] open http://localhost:3013/?secret=dc3d5ed33f476e8e to see a live graph.
D:\zenbot-3.x\node_modules\motley-templ\node_modules\templ\index.js:48
        if (typeof file === 'undefined') throw new Error('template not found: ' + p);
                                         ^

Error: template not found: home
    at render (D:\zenbot-3.x\node_modules\motley-templ\node_modules\templ\index.js:48:48)
    at ServerResponse.res.render (D:\zenbot-3.x\node_modules\motley-templ\node_modules\templ\index.js:70:23)
    at Runner.<anonymous> (D:\zenbot-3.x\plugins\server\controllers\home.js:11:11)
    at Immediate.nextRoute [as _onImmediate] (D:\zenbot-3.x\node_modules\motley\node_modules\middler\node_modules\bladerunner\index.js:51:23)
    at processImmediate [as _immediateCallback] (timers.js:383:17)
 08/14/2016 10:37:14 PM BST [    launcher] cmd `server` exited with code 1, respawning now.
08/14/2016 10:37:17 PM BST [    launcher] cmd `server` booting

I can't figure it out myself sorry, so I thought I'd report it.

Simulation inconsistent results

Hi
I've been playing around with Zenbot on windows for a week now, although I know you don't support it the only 2 things that doesn't work are the server, because of path problems, and the launch option, which can be averted by launching zenbot in separate processes.
I decided to go this way because the reducer is way faster than using it inside docker, so I decided to ditch the server for now since I can live without it.
On my first try I restored the database that you provide and backfilled the rest, runned the reducer and the simulations where consistent with your results.
The second time I decided to start from scratch and backfill all the data, for BTC in EUR and USD, it took +-1 day to backfill and reduce.
I ran the simulations but this time they do not yield the same results, I've got BTC/USD = 1.297 ROI and BTC/EUR = 0.797774 ROI
The main thing I'm, confused is why the results where identical when I restored the database and why are they so off now. I also noticed that the bot only traded 4 times in BTC/EUR but traded 44 times in BTC/USD so something strange is happening here.
I'm a newbie in trading so there must be something I'm doing wrong, but cant figure out what.

Here are my configs

  • BTC/USD
var c = module.exports = require('./config')

c.assets = [
  "BTC"
]
c.currencies = [
  "USD",
  "EUR",
  "BTC"
]

// default selector for indicators, etc
c.default_selector = "gdax.BTC-USD"
//c.logic = require('./logic_2');
  • BTC/EUR
var c = module.exports = require('./config')

c.assets = [
  "BTC"
]
c.currencies = [
  "EUR",
  "USD",
  "BTC"
]

// default selector for indicators, etc
c.default_selector = "gdax.BTC-EUR"
//c.logic = require('./logic_2')

Here is my latest sim data.

BTCUSDsim.txt
BTCEURsim.txt

javascript out of memory

I've been seeing some out of memory errors when doing backfill. I'm running in a docker container (barnumd/zenbot:3.2.4). There's no memory limit on the container. And my host has 16GB of RAM, 12 available.

`08/20/2016 05:51:56 PM UTC [ reducer] processing 9/ticks sec, thought queue: 297075
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

<--- Last few GCs --->

7925875 ms: Mark-sweep 1292.6 (1434.9) -> 1292.1 (1434.9) MB, 2954.8 / 0 ms [allocation failure] [GC in old space requested].
7928486 ms: Mark-sweep 1292.1 (1434.9) -> 1292.0 (1434.9) MB, 2611.1 / 0 ms [allocation failure] [GC in old space requested].
7930980 ms: Mark-sweep 1292.0 (1434.9) -> 1291.8 (1434.9) MB, 2494.4 / 0 ms [last resort gc].
7933455 ms: Mark-sweep 1291.8 (1434.9) -> 1291.8 (1434.9) MB, 2474.5 / 0 ms [last resort gc].

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x1cb8528c9e31
1: parse [native json.js:~51] [pc=0x3479c74f0a43] (this=0x1cb8528c37b1 <a JSON with map 0x3012fee095e9>,x=0x37a77b01d4a9 <String[254]: {"app":"zb","id":"zb:poloniex-43478444","key":"trade","value":{"id":"poloniex-43478444","trade_id":43478444,"time":1469526543000,"asset":"ETH","currency":"BTC","size":1.71176473,"price":0.02030962,"side":"buy","exchange":"poloniex"},"time":1469526543000}>,s=...

1: node::Abort() [node]
2: 0xfb1c8c [node]
3: v8::Utils::ReportApiFailure(char const_, char const_) [node]
4: v8::internal::V8::FatalProcessOutOfMemory(char const_, bool) [node]
5: v8::internal::Factory::NewTransitionArray(int) [node]
6: v8::internal::TransitionArray::Allocate(v8::internal::Isolate_, int, int) [node]
7: v8::internal::TransitionArray::Insert(v8::internal::Handlev8::internal::Map, v8::internal::Handlev8::internal::Name, v8::internal::Handlev8::internal::Map, v8::internal::SimpleTransitionFlag) [node]
8: v8::internal::Map::CopyReplaceDescriptors(v8::internal::Handlev8::internal::Map, v8::internal::Handlev8::internal::DescriptorArray, v8::internal::Handlev8::internal::LayoutDescriptor, v8::internal::TransitionFlag, v8::internal::MaybeHandlev8::internal::Name, char const_, v8::internal::SimpleTransitionFlag) [node]
9: v8::internal::Map::CopyAddDescriptor(v8::internal::Handlev8::internal::Map, v8::internal::Descriptor_, v8::internal::TransitionFlag) [node]
10: v8::internal::Map::CopyWithField(v8::internal::Handlev8::internal::Map, v8::internal::Handlev8::internal::Name, v8::internal::Handlev8::internal::FieldType, v8::internal::PropertyAttributes, v8::internal::Representation, v8::internal::TransitionFlag) [node]
11: v8::internal::Map::TransitionToDataProperty(v8::internal::Handlev8::internal::Map, v8::internal::Handlev8::internal::Name, v8::internal::Handlev8::internal::Object, v8::internal::PropertyAttributes, v8::internal::Object::StoreFromKeyed) [node]
12: v8::internal::LookupIterator::PrepareTransitionToDataProperty(v8::internal::Handlev8::internal::JSObject, v8::internal::Handlev8::internal::Object, v8::internal::PropertyAttributes, v8::internal::Object::StoreFromKeyed) [node]
13: v8::internal::Object::AddDataProperty(v8::internal::LookupIterator_, v8::internal::Handlev8::internal::Object, v8::internal::PropertyAttributes, v8::internal::Object::ShouldThrow, v8::internal::Object::StoreFromKeyed) [node]
14: v8::internal::JSObject::DefineOwnPropertyIgnoreAttributes(v8::internal::LookupIterator_, v8::internal::Handlev8::internal::Object, v8::internal::PropertyAttributes, v8::internal::Object::ShouldThrow, v8::internal::JSObject::AccessorInfoHandling) [node]
15: v8::internal::JSObject::DefinePropertyOrElementIgnoreAttributes(v8::internal::Handlev8::internal::JSObject, v8::internal::Handlev8::internal::Name, v8::internal::Handlev8::internal::Object, v8::internal::PropertyAttributes) [node]
16: v8::internal::JsonParser::ParseJsonObject() [node]
17: v8::internal::JsonParser::ParseJsonValue() [node]
18: v8::internal::JsonParser::ParseJson() [node]
19: v8::internal::Runtime_ParseJson(int, v8::internal::Object*, v8::internal::Isolate) [node]
20: 0x3479c710961b
08/20/2016 05:52:40 PM UTC [ reducer] processing 4/ticks sec, thought queue: 292575
`

Spawning child processes in learner.js on Windows

Hi,

Great program, really enjoying using and learning about it. I found when using it on Windows, that it has trouble using the spawn command due to a well known bug (discussed here). I had to install another node module 'node-cross-spawn'.

To get past this I had to add this line of code to learner.js:
spawn = require('cross-spawn')
I put it after line 10 and it worked. I have not tested this on any other OS though ...

ZenBot Learning.js Param Errors

Running Zenbot 2.6.0, while running ZenBot Learn I get errors at regular intervals, usually happening just before the 'simulating' progress bar hits 100%

Log file attached:
log.txt

Support for Bitfinex API

It would be really useful to add support for bitfinex trading API.

I've never used NodeJS before, but I'll see if I can help.

Sticky: Poll: What do you want to see in Zenbot 3.6?

Greetings Zenbot users!

After a gazillion commits over the weekend Zenbot 3.5.x is fairly stable now. However there's much more Zenbot is capable of, and only so much time to implement it. I need help prioritizing!

  • Auto-learn engine, to mutate trade params on the fly, simulate in parallel, and hot-reload better params into the runner?
  • Simulation with date ranges?
  • Generic default_trade.js usable with any exchange?
  • Composable JSON configuration?
  • More exchanges?
  • Better support for EUR trading and other currencies
  • Web UI for bot status or control?
  • Email or text message on trade execution?
  • New indicators such as MACD?
  • Repair tool for backfilled data
  • Improve the ROI for BTC?
  • Improve the ROI for ETH?
  • More altcoins support?
  • Twitter integration?
  • Performance?
  • Documentation or guides?
  • How-to videos?
  • More "hint" or "help" notifications when executing commands?
  • man page?
  • Online docs for Zenbrain engine and API?
  • Online docs for writing plugins?
  • Example apps using Zenbrain for other purposes? (I have a web crawler and twitter bot built on earlier versions of Zenbrain)
  • Backup or maintenance scripts?
  • Additional commands? Utilities?
  • Dockerfile?

Please comment below with what features you'd like to see in the next release, 3.6.0.

Cheers,
Carlos

Contributing in non-programming way?

Hello there,

Currently I am running your bot on one of my servers (Version 3.x) and noticed its stunning performance and trading. As of I started initially with a small amount and its performing nicely on the GDAX Exchange. Hopefully I am able to contribute towards your project in a non programming way and support your project.

Yours Faithfully,
RDash

sim for alternate currencies

I am attempting to run sim for alternative assets (ETH instead of BTC). My settings are as follows:

c.assets = [
//"BTC",
"ETH",
//"LTC",
]
c.currencies = [
//"CNY",
//"EUR",
"USD",
//"USDT",
//"BTC"
]
// will require(plugins/{name}/_codemap or {name}/_codemap)
// to watch an exchange, uncomment it from the list below.
c.enabled_plugins = [
"bitfinex",
"gdax",
//"kraken",
//"poloniex",
"server"
]

I've also changed:

c.graph_selectors = [
//"gdax.BTC-USD",
"gdax.ETH-USD",

c.price_reporter_selector = "gdax.ETH-USD"

However, when I run zenbot sim I don't get any trading results. Instead the output says the asset is BTC and the selector is data.trades.gdax.BTC-USD. Is zenbot not set up for backtesting in alternate assets?

Feedback scripts

Sorry @carlos8f , I read the docs about the "new scripts organization" but i'm more confused now..

I run with an empty db:
sh reducer.sh and in another terminal sh run-xxbt-zusd.sh (just changed the currencies ids inside)

  • It's seems that the gdax functions are loaded even if I have enabled only the kraken exchange (ex-plugin) in config.js
// watch these exchanges
c.watch_exchanges = [
  //"bitfinex",
  //"gdax",
  "kraken",
  //"poloniex"
  • sh run-xxbt-zusd.sh seems to start also the simulation mode, but sim argument is passed nowhere
08/23/2016 04:57:17 PM CEST [      kraken]    m24430349    1000 trades. 06/13/2016 02:29:21 PM CEST  BUY       488.105 at       688.814 XXBT/ZUSD
08/23/2016 04:57:19 PM CEST [      trader] Begin simulation for kraken.XXBT-ZUSD. --Zen <-- WHY?
08/23/2016 04:57:19 PM CEST [      trader] RSI:62 trend: undefined -> null
08/23/2016 04:57:19 PM CEST [      trader] skipping historical tick zb:m24532736

3.5.0 Config not found

I'm trying to use --config in 3.5.0. When I do I get config_btc_usd.js is not in the same folder.

zenbot launch map --backfill run --config /data/config_btc_usd.js --rs btc_usd

/usr/src/zenbot/node_modules/zenbrain/core/launcher/launcher.js:22
throw new Error('No config found. Please copy config_sample.js to ' + options.parent.config + ', edit, and re-try.')
^

Error: No config found. Please copy config_sample.js to /data/config_btc_usd.js, edit, and re-try.
at Command. (/usr/src/zenbot/node_modules/zenbrain/core/launcher/launcher.js:22:19)
at Command.listener (/usr/src/zenbot/node_modules/commander/index.js:301:8)
at emitTwo (events.js:106:13)
at Command.emit (events.js:191:7)
at Command.parseArgs (/usr/src/zenbot/node_modules/commander/index.js:615:12)
at Command.parse (/usr/src/zenbot/node_modules/commander/index.js:458:21)
at Object.cli (/usr/src/zenbot/node_modules/zenbrain/zenbrain.js:71:15)
at Object. (/usr/src/zenbot/zenbot:10:7)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)

Cancel all open orders before placing market order..

Attempting to run in tandem with other automatic trading platforms. Since the frequency of trades is low-to-minimal and I've had issues with "insufficient funds" due to other open orders. Is it possible to send a "cancel all open orders" api call right before placing the market order?

Support for BTC/EUR

First I want to say: Good work! 👍 I tested it and it's working pretty good so far.
I first backfilled the last 90 days, then started the recorder and then the learner. Is this the correct order?
But I can not trade for BTC/USD on Coinbase, could you please add support for BTC/EUR?

Can't get Altcoin/BTC pair to display properly on graph

Hello,

I have been trying to get altcoins to graph properly for about a week now. I've tried many different settings in exchange.js for multiple pairs on both Bitfinex and Poloniex and while zenbot will pull the data correctly, pull and plot volume data and even report good/accurate sell/buy indicators (which are actually on the graph) I can't seem to get the price data to plot properly. I also noticed that any Altcoin/BTC coin will not work at all unless BTC is added as a "currency" which makes sense.

I even tried RDash21's settings from pull request #19 without any success. I was able to get something after a while but it only plots the 3rd of August. The USD pairs show volumes and plots prices almost instantly after running zenbot while the BTC pairs only show volume. Also the log/graph is only showing 0.003 decimal instead of the exact price. I figured I would ask here before I dug deeper.

As of right now the BTC pair graph looks like this:
etc-btc

While the USD pairs display properly as seen below:
etc-usd
btc-usd

I have tried many different settings in both config.js and exchange.js with many different pairs and have not found a solution. Am I doing something wrong or is this not implemented yet?

config.js pair settings:

c.assets = [
  "BTC",
  "ETC",
  //"ETH",
  //"LTC"
]
c.currencies = [
  //"CNY",
  //"EUR",
  "USD",
  "BTC"
]
c.enabled_plugins = [
  //"bitfinex",
  //"gdax",
  "poloniex",
  "server"
]

Poloniex exchange.js pair settings (produced the graph from above):

    {
      "id":"USDT_ETC",
      "asset":"ETC",
      "currency":"USD",
      "min_size":0.01,
      "max_size":10000,
      "increment":0.01,
      "label":"USDT/ETC"
    },
    {
      "id":"BTC_ETC",
      "asset":"ETC",
      "currency":"BTC",
      "min_size":0.01,
      "max_size":10000,
      "increment":0.00001,
      "label":"BTC/ETC"
    },

I have been watching this project since you announced 3.x and I'm loving it so far. I was actually working on my own ML bot based off of Gekko and pyTrader when I found it :)
I'm looking forward to contributing in anyway I can. I am working on getting Bitfinex and Poloniex live trading but I'm not confident it will perform as expected without knowing zenbot is seeing the right prices.

Any help with this issue would be much appreciated. Thanks.

map issue

I seem to be getting this strange error once I try to run map in sim or direclty as a command:

bey@ubuntu:~/zenbot$ zenbot map --backfill
09/07/2016 03:36:25 PM EDT [    launcher] cmd `map` booting
/home/bey/zenbot/utils/get_products.js:6
      if (c.assets.indexOf(product.asset) === -1) return false
                  ^

TypeError: Cannot read property 'indexOf' of undefined
    at /home/bey/zenbot/utils/get_products.js:6:19
    at Array.filter (native)
    at get_products (/home/bey/zenbot/utils/get_products.js:5:23)
    at mapper (/home/bey/zenbot/plugins/gdax/backfiller.js:12:20)
    at /home/bey/zenbot/node_modules/run-parallel/index.js:41:7
    at Array.forEach (native)
    at module.exports (/home/bey/zenbot/node_modules/run-parallel/index.js:40:11)
    at mapper (/home/bey/zenbot/node_modules/zenbrain/core/mapper/mapper.js:9:5)
    at Object.<anonymous> (/home/bey/zenbot/node_modules/zenbrain/core/launcher/launcher.js:76:11)
    at Immediate._onImmediate (/home/bey/zenbot/node_modules/sosa/api.js:15:12)

I looked around and there are no open or closed issues related to this.

Does anybody know whats going on here?

Capturing redundant trades?

Hi. I ran run.sh. It began importing history. I would exepect those entries (like 08/02/2016 07:31:09 PM) to have ~1000 trades as it goes back through history. I don't understand though why it keeps pulling 1000 trades for what seems like the current time frame. (08/15/2016 02:18:01 AM UTC) (08/15/2016 02:18:32 AM UTC) (08/15/2016 02:19:02 AM UTC). Shouldn't it only gather the latest trades? Thanks.

08/15/2016 02:18:39 AM UTC [ reducer] processing 28/ticks sec 08/15/2016 02:18:45 AM UTC [ reducer] m24520458 1000 trades. 08/15/2016 02:18:01 AM UTC SELL 550.905 at $564.91 BTC/USD 08/15/2016 02:18:57 AM UTC [ reducer] m24502771 1000 trades. 08/02/2016 07:31:09 PM UTC BUY 478.203 at $578.46 BTC/USD 08/15/2016 02:19:00 AM UTC [ reporter] m24520458 1 trades. 08/15/2016 02:18:00 AM UTC 0.211 CLOSE: $569.79 USD 08/15/2016 02:19:09 AM UTC [ reducer] m24520458 1000 trades. 08/15/2016 02:18:32 AM UTC SELL 678.611 at $580.22 BTC/USD 08/15/2016 02:19:09 AM UTC [ reducer] processing 21/ticks sec 08/15/2016 02:19:21 AM UTC [ reducer] m24502704 1000 trades. 08/02/2016 06:24:38 PM UTC SELL 563.896 at $597.60 BTC/USD 08/15/2016 02:19:33 AM UTC [ reducer] m24502652 1000 trades. 08/02/2016 05:32:31 PM UTC BUY 419.043 at $601.26 BTC/USD 08/15/2016 02:19:39 AM UTC [ reducer] processing 35/ticks sec 08/15/2016 02:19:45 AM UTC [ reducer] m24520459 1000 trades. 08/15/2016 02:19:02 AM UTC SELL 226.849 at $600.21 BTC/USD 08/15/2016 02:19:57 AM UTC [ reducer] m24502501 1000 trades. 08/02/2016 03:01:20 PM UTC BUY 335.306 at $607.63 BTC/USD 08/15/2016 02:20:00 AM UTC [ reporter] m24520459 1 trades. 08/15/2016 02:19:00 AM UTC 0.350 CLOSE: $569.79 USD 08/15/2016 02:20:09 AM UTC [ reducer] m24520459 1000 trades. 08/15/2016 02:19:31 AM UTC BUY 238.721 at $608.78 BTC/USD 08/15/2016 02:20:09 AM UTC [ reducer] processing 33/ticks sec

Running version 3

Hi Carlos,

I know you're not done with v3 yet.. I noticed that you split zenbot and zenbrain, at least, that's what it appears like. I'm a little lost as to how to run zenbot now. Do I have to clone both of these and npm install them?

Thanks

RSI Backfiller Error

I am getting the following error with the latest update while trying to use the new config_eth.js with config_defaults.js

/home/zero/zenbot/zenbot/core/indicators/rsi/backfiller.js:36
        if (err) throw err
                 ^
MongoError: $in needs an array
    at Function.MongoError.create (/home/zero/zenbot/zenbot/node_modules/mongodb-core/lib/error.js:31:11)
    at queryCallback (/home/zero/zenbot/zenbot/node_modules/mongodb-core/lib/cursor.js:197:36)
    at /home/zero/zenbot/zenbot/node_modules/mongodb-core/lib/connection/pool.js:428:18
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Any idea what is causing this?

Error: Module version mismatch. Expected 48, got 46.

I have installed Zenbot using the instructions here, but when I try to launch ./run I am having this error:

/home/tox/Scrivania/zenbot/node_modules/bindings/bindings.js:83
    throw e
    ^

Error: Module version mismatch. Expected 48, got 46.
at Error (native)
at Object.Module._extensions..node (module.js:568:18)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at bindings (/home/tox/Scrivania/zenbot/node_modules/bindings/bindings.js:76:44)
at Object.<anonymous> (/home/tox/Scrivania/zenbot/node_modules/microtime/index.js:1:96)
at Module._compile (module.js:541:32)

MongoDB is at version 3.2.8
Node.JS is 6.3.1

[Offtopic] Where to learn NodeJs/Javascript?

Heya,

I have been searching all over the place where to learn to code in NodeJS. And considered it better asking to more experienced people.

Generally the question:
Where would it be possible to learn NodeJS?
And is there a kind of mentoring program for it (online)?

Yours Faithfully,
RDash

SyntaxError: Use of const in strict mode.

hello. i get following error with recent git pull:

pi@raspberrypi:~/Development/bitcoin/zenbot $ zenbot backfill

/home/pi/Development/bitcoin/zenbot/node_modules/ws/lib/WebSocket.js:9
const url = require('url');
^^^^^
[SyntaxError: Use of const in strict mode.]
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/home/pi/Development/bitcoin/zenbot/node_modules/ws/index.js:9:27)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)

Question about dropping DB

I have a question regarding new versions and when you say it's 'Safe to drop your zenbrain DB before this update.'

Does this mean I should or must drop the database? It takes my computer a day or two to resync - and I loose some historical data - especially for exchanges that don't support backfill. I'd rather not drop if I can get away with it.

Raspberry Pi Errors

Hello,
I just tried your software on RPI and got the following errors.

Thanks!

pi@raspberrypi:~/Development/bitcoin/zenbot $ npm install && npm link
npm WARN package.json [email protected] No repository field.

[email protected] install /home/pi/Development/bitcoin/zenbot/node_modules/timebucket/node_modules/microtime
node-gyp rebuild

make: Entering directory '/home/pi/Development/bitcoin/zenbot/node_modules/timebucket/node_modules/microtime/build'
CXX(target) Release/obj.target/microtime/src/microtime.o
In file included from ../src/microtime.cc:9:0:
../node_modules/nan/nan.h:324:47: error: ‘REPLACE_INVALID_UTF8’ is not a member of ‘v8::String’
static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8;
^
microtime.target.mk:82: recipe for target 'Release/obj.target/microtime/src/microtime.o' failed
make: *** [Release/obj.target/microtime/src/microtime.o] Error 1
make: Leaving directory '/home/pi/Development/bitcoin/zenbot/node_modules/timebucket/node_modules/microtime/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 4.4.11-v7+
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/pi/Development/bitcoin/zenbot/node_modules/timebucket/node_modules/microtime
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm WARN engine [email protected]: wanted: {"node":">=0.12"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.12"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the microtime package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls microtime
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 4.4.11-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/pi/Development/bitcoin/zenbot
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm WARN deprecated [email protected]: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN engine [email protected]: wanted: {"node":">=0.12"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine [email protected]: wanted: {"node":">=0.12"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/pi/Development/bitcoin/zenbot/npm-debug.log
npm ERR! not ok code 0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.