Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Commit

Permalink
4.1.3 (#1724)
Browse files Browse the repository at this point in the history
* Exchanges: update-products 1011

* Fix Bittrex error (#1563)

I fixed the order cancel error in issue #1514. I changed the cancelOrder and getOrder functions. 

I also changed 'fistRun' to 'firstRun'

* Exchanges: update-products 1019

* Bittrex code cleanup (#1566)

This time there are no functional changes, I just wanted to clean up the code. I also combined the warning messages and made it more clear.

* Exchanges: update-products 1023

* Exchanges: update-products 1026

* Exchanges: update-products 1029

* Exchanges: update-products 1032

* Exchanges: update-products 1038

* Exchanges: update-products 1041

* Exchanges: update-products 1045

* Exchanges: update-products 1047

* Exchanges: update-products 1051

* Exchanges: update-products 1053

* Exchanges: update-products 1057

* Exchanges: update-products 1059

* so long, Zenbot

* Fixed grammatical error in dashboard (#1588)

* Mistake with ws calc request. (fix for #516 and partially #868) (#1586)

* Docker and commandline improvements (#1583)

* [BUG] Docker: Closed critical public access to non-protected database

* [ENH] Improved docker handling (synced folder, alpine image for production)

* [ENH] Add initial Makefile

* [ENH] Docker: Add traefik reverse proxy support

* [CLEAN] Cleanup data files from repo

* Webpack: split js and css into its own bundles (#1582)

So stylesheets get loaded if the browser has strict MIME-Type checking enabled.

* Edit max_sell/buy_loss_pct defaults in conf-sample.js (#1578)

* Changed default c.max_sell_loss_pct and c.max_buy_loss_pct to 99. With a value of 25, once the current price is 25% under the bought price the bot would refuse to sell unless the current price goes back above the 25% loss, however, this doesn't always happen and can cause the bot to refuse sells and end up with a huge loss. Also the descriptions for these options are very vague and confusing and I don't think most users know what they even are or would want them to use them. If my interpretation of what the option actually does is incorrect let me know.

* fix broken balance command (#1573)

* Exchanges: update-products 1070

* Exchanges: update-products 1074

* Exchanges: update-products 1076

* Exchanges: update-products 1079

* Exchanges: update-products 1083

* Exchanges: update-products 1085

* CEXIO: getTrades return error to engine (#1595)

Instead of retrying infinitely causing requests to get stacked on top of another which will lead to the cursor freezing, rendering the bot inoperable.

* Exchanges: update-products 1090

* Exchanges: update-products 1092

* Repairs #1596 error (#1601)

* Repair duplicate key issue on backfill, resolves #1596 (#1600)

* Exchanges: update-products 1099

* Exchanges: update-products 1101

* Exchanges: update-products 1105

* Exchanges: update-products 1107

* Exchanges: update-products 1109

* Exchanges: update-products 1111

* Exchanges: update-products 1113

* Exchanges: update-products 1124

* Exchanges: update-products 1126

* Exchanges: update-products 1129

* Exchanges: update-products 1132

* Exchanges: update-products 1134

* Exchanges: update-products 1137

* Exchanges: update-products 1141

* fix(package): update webpack-cli to version 3.0.4 (#1616)

Closes #1606

* Add OHLC candle backfilling (#1614)

* Exchanges: update-products 1147

* Exchanges: update-products 1151

* typo in README.md (#1620)

* Exchanges: update-products 1157

* Exchanges: update-products 1163

* Add asset to push message (#1623)

If you get bombarded with messages by multiple bots it can get a bit confusing at times to know who is selling/buying what.

* Add strategies that utilize TA-Lib and Tulip-Lib (#1621)

* Add Backing Libs

ta-lib Bollinger Bands
ta-lib Stochastic Oscillator
ta-lib Stochastic RSI Oscillator
Tulip-lib Bollinger Bands
Tulip-lib MACD
Tulip-lib RSI
Tulip-lib Stochastic Oscillator
Tulip-lib Stochastic RSI Oscillator

* Add strategy ta_srsi_bollinger

This Strategy uses SRSI to detect when to buy and sell verifying price position using Bollinger Bands

* Add Strategy ti_stoch_bollinger

This strategy uses Stochastic Oscillator to detect buy and sell signals verifying using bollinger bands This utilizes the Tulip Libs

* Add strategy ti_bollinger

This is a duplicate of native bollinger strategy but implemented using Tulip libs.   This was for testing the ti_bollinger backing lib.  This can be used by itself but does not detect trends so most likely will result in losses.

* Add Strategy ti_stoch

This is the Stochastic Oscillator implmented using the Tulip lib.   this buys and sells at set SO crossover points.  This is mainly for testing the backing library.  It can be used standalone but does not check for trends so it is likely to result in losses

* Add Stragegy ti_stoch_bollinger

This strategy buys and sells using Stochastic Oscillator crossover points and verifies using bollinger.  implemented us Tulip lib

* Fix bugs in Stoch RSI.  add option  for passing in market data

* Fix bugs in Stoch.  add option  for passing in market data

* Set Bollinger time divider to default.   adjust but/sell calculation

* fix(package): update mathjs to version 5.0.0 (#1622)

* Exchanges: update-products 1173

* Debug lib (#1624)

* Debug lib

Move debugging to its own library so it can be (re)used in every module instead of just engine.js

Furthermore this will expose the current debugging state (in debug.on) globally, use it instead of declaring so.debug locally in each module from process.argv

* Picky Travis...

* fix(package): update poloniex.js to version 0.0.9 (#1618)

* fix(package): update gdax to version 0.8.0 (#1594)

* fix(package): update bl to version 2.0.1 (#1625)

Closes #1591

* fix(package): update stats-lite to version 2.1.1 (#1575)

* CEXIO: Migrate over to WebSocket (#1615)

* CEXIO: Migrate over to WebSocket

Fees and Backfill still using REST due to API limitation.

* Cleanup

* CEXIO: WebSocket additions

* wsTrades catch reject was out-of-scope *duh*
* Disconnect message formating

* CEXIO: WebSocket

* Improve error handling
* Reject client requests until authenticated

* CEXIO: WebSocket trade

* Use REST for Taker/Market orders, looks like this isn't supported (yet?) 😞

* CEXIO: Use debug lib (#1626)

* CEXIO: Use debug lib

Might as well use it 😏

* CEXIO: Use LF over CRLF

*ups*

* Exchanges: update-products 1186

* Exchanges: update-products 1188

* Exchanges: update-products 1190

* Add minimum trades and fitnessCalcType options (#1631)

--minTrades will try and achieve the minimum x amount of trades before using normal fitness calculations
--fitnessCalcType allows for different fitness priorities.  i.e. profit does not care how many wins or losses occur.  it only looks at how much of a return is occurring.   wl does not care about profit, only more wins than losses, profitwl tries to get the best profit, while taking into consideration wins and losses, but rates profit higher.  classic uses the legacy calculation and is the default.

Addition modifications
Add PROPERTY_RANDOM_CHANCE to phenotype process to allow for injection of entirely new species. this helps prevent stagnation during a long run.

At some point floatScanWindow was removed from backtester.  Commented out code in darwin.js at applies to this change

* Exchanges: update-products 1194

* Exchanges: update-products 1200

* Exchanges: update-products 1202

* Exchanges: update-products 1204

* Code Cleanup (#1634)

Fix indent to match .eslint requirement
Fix undeclared variables to match .eslint requirement

* Added missing parameter text (#1638)

* Exchanges: update-products 1211

* Exchanges: update-products 1213

* Exchanges: update-products 1215

* chore(package): update yargs to version 12.0.1 (#1643)

* Exchanges: update-products 1220

* Exchanges: update-products 1223

* Update strategy.js (#1646)

* Update strategy.js

Added overbought parameters to trade with crypto assets directly (the original code works fine if starts with FIAT, but not with asset) and use red color to mark RSI with red (sell signal). Tested and works fine.

* Update strategy.js

* Exchanges: update-products 1231

* Update strategy.js (#1651)

Sorry, correct the code. The original was reported first tim goes right.

Thanks.

* Exchanges: update-products 1236

* Exchanges: update-products 1240

* Exchanges: update-products 1242

* fix(package): update css-loader to version 1.0.0 (#1653)

* Exchanges: update-products 1245

* Exchanges: update-products 1250

* Exchanges: update-products 1252

* Exchanges: update-products 1257

* Cross-platform Makefile (#1660)

* Added database to .gitignore (#1658)

* Time-sync function to update container time (#1659)

* Edited Docker ignore

edited docker for mac

* added time sync function

* Exchanges: update-products 1257

* Cross-platform Makefile (#1660)

* Added database to .gitignore (#1658)

* added time sync function

* Fix Poloniex not fetching all available trades (#1565) (#1661)

* Exchanges: update-products 1269

* Exchanges: update-products 1273

* Exchanges: update-products 1275

* Exchanges: update-products 1277

* Exchanges: update-products 1279

* Exchanges: update-products 1281

* Exchanges: update-products 1284

* Fix issue #1664: Error 'Invalid end time.' on Poloniex (#1666)

For some reason the opts.offset is void, so I patched the code to use the default value in these cases.

* Discord has been removed

* Update README.md

* Stop complaint flood

* Exchanges: update-products 1290

* Exchanges: update-products 1292

* Exchanges: update-products 1296

* fix(package): update ws to version 6.0.0 (#1668)

* Exchanges: update-products 1299

* Exchanges: update-products 1301

* Exchanges: update-products 1303

* Exchanges: update-products 1305

* Exchanges: update-products 1307

* Exchanges: update-products 1309

* Exchanges: update-products 1311

* Exchanges: update-products 1313

* Exchanges: update-products 1315

* Exchanges: update-products 1317

* Exchanges: update-products 1319

* Exchanges: update-products 1321

* Exchanges: update-products 1323

* Exchanges: update-products 1325

* Exchanges: update-products 1327

* Exchanges: update-products 1329

* Exchanges: update-products 1333

* fix(package): update jasmine to version 3.2.0 (#1676)

* fix(package): update postcss-loader to version 3.0.0 (#1675)

* fix(package): update style-loader to version 0.22.1 (#1677)

Closes #1674

* Exchanges: update-products 1344

* Exchanges: update-products 1346

* Exchanges: update-products 1348

* Exchanges: update-products 1350

* Exchanges: update-products 1352

* Exchanges: update-products 1354

* Exchanges: update-products 1356

* Exchanges: update-products 1358

* Exchanges: update-products 1360

* Exchanges: update-products 1362

* Exchanges: update-products 1364

* Exchanges: update-products 1366

* Exchanges: update-products 1368

* Exchanges: update-products 1370

* Exchanges: update-products 1373

*  Modified to support Binance MIN_NOTIONAL Filter (#1687)

* Fix issue #1664: Error 'Invalid end time.' on Poloniex

For some reason the opts.offset is void, so I patched the code to use the default value in these cases.

* Fixed wrong max_size for ADABTC pair.

* Fixed EOSETH Pair.

* Revert "Fixed EOSETH Pair."

This reverts commit ca3cb18.

* Modified to support MIN_NOTIONAL Filter.
Order must be over MIN_NOTIONAL value, so I have modified the script to set min_size a little over MIN_NOTIONAL when it is below.

* Update Products with MIN_NOTIONAL filter

* Exchanges: update-products 1378

* Exchanges: update-products 1381

* RSI, oversold start optimization (#1691)

* Update strategy.js

Correct code proposed in the second pull request.
This code is tested and works, actually I'm using whit this modifications and all works ok.
Sorry again for my error.

* Optimized RSI

Adding validation before execute all the conditionals

* Optimization RSI

Adding validation before execute all the conditionals

* Optimization RSI strategy

* Optimization RSI strategy

* Exchanges: update-products 1384

* Fixed max_size. The script was taking maxPrice instead of maxQty. (#1692)

* Fix issue #1664: Error 'Invalid end time.' on Poloniex

For some reason the opts.offset is void, so I patched the code to use the default value in these cases.

* Fixed wrong max_size for ADABTC pair.

* Fixed EOSETH Pair.

* Revert "Fixed EOSETH Pair."

This reverts commit ca3cb18.

* Modified to support MIN_NOTIONAL Filter.
Order must be over MIN_NOTIONAL value, so I have modified the script to set min_size a little over MIN_NOTIONAL when it is below.

* Update Products with MIN_NOTIONAL filter

* Fixed max_size. The script was taking maxPrice instead of maxQty.

* Revert "Fixed max_size. The script was taking maxPrice instead of maxQty."

This reverts commit 9dbaa32.

* Fixed max_size. The script was taking maxPrice instead of maxQty.

* Exchanges: update-products 1389

* Exchanges: update-products 1396

* fix(package): update style-loader to version 0.23.0 (#1695)

* Fixed to make proper use of the MIN_NOTIONAL parameter. (#1693)

* Fix issue #1664: Error 'Invalid end time.' on Poloniex

For some reason the opts.offset is void, so I patched the code to use the default value in these cases.

* Fixed wrong max_size for ADABTC pair.

* Fixed EOSETH Pair.

* Revert "Fixed EOSETH Pair."

This reverts commit ca3cb18.

* Modified to support MIN_NOTIONAL Filter.
Order must be over MIN_NOTIONAL value, so I have modified the script to set min_size a little over MIN_NOTIONAL when it is below.

* Update Products with MIN_NOTIONAL filter

* Fixed max_size. The script was taking maxPrice instead of maxQty.

* Revert "Fixed max_size. The script was taking maxPrice instead of maxQty."

This reverts commit 9dbaa32.

* Fixed max_size. The script was taking maxPrice instead of maxQty.

* Fixed to make proper use of the MIN_NOTIONAL.
The parameter MIN_NOTIONAL was being used wrong.
Now it is fixed to do the right calculations: https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md

* fix(package): update babel-loader to version 8.0.0 (#1697)

* Exchanges: update-products 1401

* Exchanges: update-products 1403

* Exchanges: update-products 1407

* Exchanges: update-products 1409

* fix(package): update bitfinex-api-node to version 2.0.0 (#1698)

* Exchanges: update-products 1412

* Exchanges: update-products 1414

* Exchanges: update-products 1416

* Exchanges: update-products 1418

* Exchanges: update-products 1420

* Exchanges: update-products 1422

* Exchanges: update-products 1424

* Exchanges: update-products 1426

* Exchanges: update-products 1442

* Exchanges: update-products 1442

* Exchanges: update-products 1453

* Greenkeeper/ccxt 1.17.280 (#1708)

* chore(package): update ccxt to version 1.17.280

* chore(package): update lockfile package-lock.json

* Update stats-lite to the latest version 🚀 (#1706)

* fix(package): update stats-lite to version 2.2.0

* chore(package): update lockfile

* Exchanges: update-products 1469

* Exchanges: update-products 1469

* Exchanges: update-products 1483

* Exchanges: update-products 1491

* Exchanges: update-products 1500

* Exchanges: update-products 1507

* Exchanges: update-products 1516

* Exchanges: update-products 1524

* Exchanges: update-products 1524

* Update resolve-url-loader to the latest version 🚀 (#1709)

* fix(package): update resolve-url-loader to version 3.0.0

* chore(package): update lockfile package-lock.json

* Update pushbullet to the latest version 🚀 (#1710)

* fix(package): update pushbullet to version 2.3.0

* chore(package): update lockfile package-lock.json

* Greenkeeper/ccxt 1.17.321 (#1713)

* chore(package): update ccxt to version 1.17.321

* chore(package): update lockfile package-lock.json

* Exchanges: update-products 1540

* Exchanges: update-products 1540

* Exchanges: update-products 1548

* Exchanges: update-products 1548

* Exchanges: update-products 1560

* Exchanges: update-products 1568

* Exchanges: update-products 1571

* Exchanges: update-products 1578

* Exchanges: update-products 1585

* Exchanges: update-products 1585

* Exchanges: update-products 1590

* Exchanges: update-products 1598

* Exchanges: update-products 1598

* Exchanges: update-products 1605

* Exchanges: update-products 1605

* Greenkeeper/ccxt 1.17.360 (#1720)

* chore(package): update ccxt to version 1.17.360

* chore(package): update lockfile package-lock.json

* Greenkeeper/babel loader 8.0.4 (#1721)

* chore(package): update babel-loader to version 8.0.4

* chore(package): update lockfile package-lock.json

* Greenkeeper/husky 1.0.1 (#1722)

* fix(package): update husky to version 1.0.1

Closes #1718

* chore(package): update lockfile package-lock.json

* Exchanges: update-products 1618

* fixing vulnerabilities in repo (#1723)
  • Loading branch information
DeviaVir authored Oct 1, 2018
1 parent ef32e9f commit 6001e06
Show file tree
Hide file tree
Showing 56 changed files with 15,571 additions and 10,403 deletions.
5 changes: 5 additions & 0 deletions .env-sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BASIC_AUTH_ZEN=ommm:$apr1$1n0zqO2y$A2ueB9zMWZTYTtfckFhql1
TRAEFIK_HOST_ZEN=myhost.com
BASIC_AUTH_DB=ommm:$apr1$1n0zqO2y$A2ueB9zMWZTYTtfckFhql1
TRAEFIK_HOST_DB=db.myhost.com
TRAEFIK_NETWORK_NAME=traefik-proxy
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ dist/*
simulations/sim_*.json
gen.*.bat
gen.*.sh

.env
scripts/auto_backtester/backtesting_*.csv
database/*
18 changes: 12 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
FROM node:8

RUN mkdir -p /app
FROM node:8 as builder
ADD . /app
WORKDIR /app

COPY . /app
RUN npm install -g node-gyp
RUN npm install --unsafe

FROM node:8-alpine

ADD . /app
WORKDIR /app

COPY --from=builder /usr/local/lib/node_modules/ /usr/local/lib/node_modules/
COPY --from=builder /app/node_modules /app/node_modules/
COPY --from=builder /app/dist /app/dist/

RUN ln -s /app/zenbot.sh /usr/local/bin/zenbot

ENV NODE_ENV production

ENTRYPOINT ["/usr/local/bin/node", "zenbot.js"]
ENTRYPOINT ["/app/zenbot.sh"]
CMD [ "trade", "--paper" ]
132 changes: 132 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Check if this is Windows
ifneq (,$(findstring WINDOWS,$(PATH)))
WINDOWS := True
endif

# Set shell to cmd on windows
ifdef WINDOWS
SHELL := C:/Windows/System32/cmd.exe
endif

# Don't use sudo on windows
SUDO := "sudo"
ifdef WINDOWS
SUDO :=
endif

# set home dir to user's home on windows running MINGW
ifdef MSYSTEM
HOME := $(subst \,/,$(HOME))
endif

# Get the root dir of this file
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

# Define the full path to this file
THIS_FILE := $(lastword $(MAKEFILE_LIST))

# Set docker-compose file selector for windows
ifneq (,$(findstring WINDOWS,$(PATH)))
DC_CONFIG=$(ROOT_DIR)/docker-compose-windows.yml
else
DC_CONFIG=$(ROOT_DIR)/docker-compose.yml
endif

# Find or create a home for sensitive environment variables
# Check my secret place
CREDS=$(HOME)/.bash/.credentials
ifneq ("$(wildcard $(CREDS))","")
CREDENTIALS := $(CREDS)
else
# Check a normal place
CREDS=$(HOME)/.credentials
ifneq ("$(wildcard $(CREDS))","")
CREDENTIALS := $(CREDS)
else
$(info $(shell "mkdir" $(CREDS)))
endif
endif

# To use arguments with make execute: make -- <command> <args>
ARGS = $(filter-out $@,$(MAKECMDGOALS))
MAKEFLAGS += --silent

list:
sh -c "echo; $(MAKE) -p no_targets__ | awk -F':' '/^[a-zA-Z0-9][^\$$#\/\\t=]*:([^=]|$$)/ {split(\$$1,A,/ /);for(i in A)print A[i]}' | grep -v '__\$$' | grep -v 'Makefile'| sort"

#############################
# ZENBOT
#############################

list-strategies:
docker-compose exec server zenbot list-strategies $(ARGS)

list-selectors:
docker-compose exec server zenbot list-selectors $(ARGS)

backfill:
docker-compose exec server zenbot backfill $(ARGS)

sim:
docker-compose exec server zenbot sim $(ARGS)

trade:
docker-compose exec server zenbot trade $(ARGS)

paper:
docker-compose exec server zenbot trade --paper $(ARGS)

balance:
docker-compose exec server zenbot balance $(ARGS)

buy:
docker-compose exec server zenbot buy $(ARGS)

sell:
docker-compose exec server zenbot sell $(ARGS)

zenbot:
docker-compose exec server zenbot $(ARGS)

#############################
# Docker machine states
#############################
time-sync:
docker run --rm --privileged alpine hwclock -s

up:
$(SUDO) docker-compose --file=$(DC_CONFIG) up

start:
docker-compose start

stop:
docker-compose stop

state:
docker-compose ps

rebuild:
$(SUDO) docker-compose stop
$(SUDO) docker-compose pull
$(SUDO) docker-compose rm --force server
$(SUDO) docker-compose rm --force mongodb
-$(SUDO) docker-compose rm --force adminmongo
$(SUDO) docker-compose build --no-cache
$(SUDO) docker-compose --file=$(DC_CONFIG) up -d --force-recreate


shell:
docker-compose exec server /bin/sh

shellw:
docker exec -it -u root $$(docker-compose ps -q server) /bin/sh

logs:
docker-compose logs $(ARGS)

#############################
# Argument fix workaround
#############################
%:
@:
27 changes: 7 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,8 @@
# Zenbot [![Build/Test Status](https://travis-ci.org/DeviaVir/zenbot.svg?branch=master)](https://travis-ci.org/DeviaVir/zenbot) [![Greenkeeper badge](https://badges.greenkeeper.io/DeviaVir/zenbot.svg)](https://greenkeeper.io/)

## Current Status

Zenbot 4 is functional, but is having trouble reliably making profit. At this point, **I would recommend against trading with large amounts** until some of these issues can be worked out:

- Many people are reporting [losses in live trading](https://github.com/carlos8f/zenbot/issues/189) even if the simulation results and/or paper trading is positive.
- This is my highest priority right now, since an unprofitable bot is not worth much, but please understand that reliably making profit is hard, and so is making a realistic simulator.
- The losses may be due to the default strategy not working well in sideways (non-trending) market conditions, slippage during limit order execution, or both. Currently I would recommend against using Zenbot on a market that is non-trending or trending generally downwards.
- The limit-order strategy that Zenbot uses to avoid taker fees, is prone to race conditions and delays. A mode for using market-type orders will probably need to be made, which may make frequent-trade strategies less viable due to fees, but more reliable execution overall.
- An upcoming feature will allow Zenbot to use a limited amount of your balance, which will help with experimenting with live trading, but mitigating the possible losses from the issues above.

Zenbot is a hobby project for me and I'm sorry that I can't devote myself full-time to it. Since I'm getting busier, development may slow down a bit from here, so please be patient if issues aren't fixed right away.

## Questions
Please ask (programming) questions related to zenbot on stackoverflow. The tag is [zenbot](https://stackoverflow.com/questions/tagged/zenbot).
Please ask (programming) questions related to zenbot on reddit. The subreddit is [zenbot](https://reddit.com/r/zenbot).

## Description

Expand Down Expand Up @@ -76,7 +64,7 @@ cp conf-sample.js conf.js
- View and edit `conf.js`.
- It's possible to use zenbot in "paper trading" mode without making any changes.
- You must add your exchange API keys to enable real trading however.
- API keys do NOT need deposit/withdrawl permissions.
- API keys do NOT need deposit/withdrawal permissions.

If using Docker, skip to section "Docker" below.

Expand Down Expand Up @@ -818,12 +806,6 @@ Or to sell 10% of your BTC,
zenbot sell gdax.BTC-USD --pct=10
```

## Chat with other Zenbot users

[![zenbot logo](https://rawgit.com/deviavir/zenbot/master/assets/discord.png)](https://discord.gg/ZdAd2gP)

Zenbot has a Discord chat! You can get in [through this invite link](https://discord.gg/ZdAd2gP).

## Donate

P.S., some have asked for how to donate to Zenbot development. We accept donations at **Bitcoin addresses** below:
Expand All @@ -840,6 +822,11 @@ P.S., some have asked for how to donate to Zenbot development. We accept donatio

Thanks!

## Noteworthy forks

- [bot18](https://medium.com/@carlos8f_11468/introducing-bot18-the-new-crypto-trading-bot-to-supersede-zenbot-and-unleash-the-zalgo-da8464b41e53)
- [magic8bot](https://github.com/notVitaliy/magic8bot)

- - -

### License: MIT
Expand Down
2 changes: 2 additions & 0 deletions boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ module.exports = function (cb) {
var config = {}
var overrides = {}

module.exports.debug = args.debug

// 1. load conf overrides file if present
if(!_.isUndefined(args.conf)){
try {
Expand Down
18 changes: 14 additions & 4 deletions commands/balance.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var minimist = require('minimist')
, colors = require('colors')
, moment = require('moment')
, objectifySelector = require('../lib/objectify-selector')
, exchangeService = require('../lib/services/exchange-service')
, { formatCurrency } = require('../lib/format')

module.exports = function (program, conf) {
Expand Down Expand Up @@ -33,9 +34,18 @@ module.exports = function (program, conf) {
so.debug = cmd.debug
so.mode = 'live'
function balance () {
s.exchange.getBalance(s, function (err, balance) {
var exchangeServiceInstance = exchangeService(conf)
var exchange = exchangeServiceInstance.getExchange()

var exchangeName = exchange.name // TODO: Refactor all exchanges to be in the format of the stub.exchange, so we can use getName() here.
if (exchange === undefined) {
console.error('\nSorry, couldn\'t find an exchange named [' + exchangeName + '].')
process.exit(1)
}

exchange.getBalance(s, function (err, balance) {
if (err) throw err
s.exchange.getQuote(s, function (err, quote) {
exchange.getQuote(s, function (err, quote) {
if (err) throw err

var bal = moment().format('YYYY-MM-DD HH:mm:ss').grey + ' ' + formatCurrency(quote.ask, s.currency, true, true, false) + ' ' + (s.product_id).grey + '\n'
Expand All @@ -46,10 +56,10 @@ module.exports = function (program, conf) {
console.log(bal)

if (so.calculate_currency) {
s.exchange.getQuote({'product_id': s.asset + '-' + so.calculate_currency}, function (err, asset_quote) {
exchange.getQuote({'product_id': s.asset + '-' + so.calculate_currency}, function (err, asset_quote) {
if (err) throw err

s.exchange.getQuote({'product_id': s.currency + '-' + so.calculate_currency}, function (err, currency_quote) {
exchange.getQuote({'product_id': s.currency + '-' + so.calculate_currency}, function (err, currency_quote) {
if (err) throw err
var asset_total = balance.asset * asset_quote.bid
var currency_total = balance.currency * currency_quote.bid
Expand Down
4 changes: 4 additions & 0 deletions commands/sim.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ module.exports = function (program, conf) {
output_lines.push('error rate: ' + (sells ? n(losses).divide(sells).format('0.00%') : '0.00%').yellow)
}
options_output.simresults.start_capital = s.start_capital
options_output.simresults.last_buy_price = s.last_buy_price
options_output.simresults.last_assest_value = s.trades[s.trades.length-1].price
options_output.net_currency = s.net_currency
options_output.simresults.asset_capital = s.asset_capital
options_output.simresults.currency = n(s.balance.currency).value()
options_output.simresults.profit = profit.value()
options_output.simresults.buy_hold = buy_hold.value()
Expand Down
5 changes: 3 additions & 2 deletions commands/trade.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var tb = require('timebucket')
, objectifySelector = require('../lib/objectify-selector')
, engineFactory = require('../lib/engine')
, collectionService = require('../lib/services/collection-service')
, debug = require('../lib/debug')

module.exports = function (program, conf) {
program
Expand Down Expand Up @@ -519,8 +520,8 @@ module.exports = function (program, conf) {
console.log('\nDumping statistics...'.grey)
toggleStats()
} else if (key === 'L' && !info.ctrl) {
so.debug = !so.debug
console.log('\nDEBUG mode: ' + (so.debug ? 'ON'.green.inverse : 'OFF'.red.inverse))
debug.flip()
console.log('\nDEBUG mode: ' + (debug.on ? 'ON'.green.inverse : 'OFF'.red.inverse))
} else if (info.name === 'c' && info.ctrl) {
// @todo: cancel open orders before exit
console.log()
Expand Down
6 changes: 3 additions & 3 deletions conf-sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ c.sell_pct = 99
// ms to adjust non-filled order after
c.order_adjust_time = 5000
// avoid selling at a loss below this pct set to 0 to ensure selling at a higher price...
c.max_sell_loss_pct = 25
c.max_sell_loss_pct = 99
// avoid buying at a loss above this pct set to 0 to ensure buying at a lower price...
c.max_buy_loss_pct = 25
c.max_buy_loss_pct = 99
// ms to poll order status
c.order_poll_time = 5000
// ms to wait for settlement (after an order cancel)
Expand Down Expand Up @@ -252,4 +252,4 @@ c.output = {}
c.output.api = {}
c.output.api.on = true
c.output.api.ip = '0.0.0.0' // IPv4 or IPv6 address to listen on, uses all available interfaces if omitted
c.output.api.port = 0 // 0 = random port
c.output.api.port = 0 // 0 = random port, set to 17365 if you use docker
67 changes: 67 additions & 0 deletions docker-compose-traefik.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
version: '3.1'
services:
zenbotserver:
build:
context: .
dockerfile: Dockerfile
volumes:
- ./:/app/
- /app/node_modules/
- /app/dist/
restart: always
tty: true
expose:
- "17365"
labels:
- "traefik.enable=true"
- "traefik.frontend.rule=Host:$(TRAEFIK_HOST_ZEN)"
- "traefik.docker.network=$(TRAEFIK_NETWORK_NAME)"
- "traefik.port=17365"
- "traefik.frontend.auth.basic=$(BASIC_AUTH_ZEN)"
networks:
- internal
- proxy
depends_on:
- mongodb
environment:
- MONGODB_PORT_27017_TCP_ADDR=mongodb

mongodb:
image: mongo:latest
restart: always
volumes:
- ./data/db:/data/db
command: mongod --smallfiles --bind_ip=0.0.0.0 --logpath=/dev/null
networks:
- internal
expose:
- 27017

# "adminMongo is a Web based user interface (GUI) to handle all your MongoDB connections/databases needs."
adminmongo:
image: mrvautin/adminmongo
expose:
- 1234
depends_on:
- mongodb
environment:
- "CONN_NAME=zenbot_mongodb"
- "DB_HOST=mongodb"
- "DB_PORT=27017"
labels:
- "traefik.enable=true"
- "traefik.frontend.rule=Host:$(TRAEFIK_HOST_DB)"
- "traefik.docker.network=$(TRAEFIK_NETWORK_NAME)"
- "traefik.port=1234"
- "traefik.frontend.auth.basic=$(BASIC_AUTH_DB)"
networks:
- internal
- proxy
command: "npm start"

networks:
proxy:
external:
name: "$(TRAEFIK_NETWORK_NAME)"
internal:
external: false
Loading

0 comments on commit 6001e06

Please sign in to comment.