Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Implement working dir as variable editable in conf." #3

Merged
merged 1 commit into from
Jun 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
data
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

[*.{js,json}]
charset = utf-8
indent_style = space

[*.{js,yml}]
indent_size = 2

[*.{json,sh}]
indent_size = 4

[Makefile]
indent_style = tab

[{package.json,.travis.yml}]
indent_style = space
indent_size = 2
15 changes: 0 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -18,18 +18,3 @@ conf-*
sim_result*
*_test
backtesting_*

.ipynb_checkpoints
data.csv
value_net.json

extensions/strategies/bumblebee
zen/logs/history/*.png
zen/logs/hof/*.txt
zen/evolution/__pycache__/

zen/__pycache__/

zen/temp\.html

*.pyc
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

97 changes: 97 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
FROM node:latest



# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#


# ensure local python is preferred over distribution python
ENV PATH /usr/local/bin:$PATH

# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8

# runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
tcl \
tk \
&& rm -rf /var/lib/apt/lists/*

ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
ENV PYTHON_VERSION 3.6.0

# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 9.0.1

RUN set -ex \
&& buildDeps=' \
tcl-dev \
tk-dev \
' \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
\
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
&& rm -r "$GNUPGHOME" python.tar.xz.asc \
&& mkdir -p /usr/src/python \
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
&& rm python.tar.xz \
\
&& cd /usr/src/python \
&& ./configure \
--enable-loadable-sqlite-extensions \
&& make -j$(nproc) \
&& make install \
&& ldconfig \
\
# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
&& wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
&& python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
&& rm /tmp/get-pip.py \
; fi \
# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python
# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages")
# https://github.com/docker-library/python/pull/143#issuecomment-241032683
&& pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
# then we use "pip list" to ensure we don't have more than one pip version installed
# https://github.com/docker-library/python/pull/100
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
\
&& find /usr/local -depth \
\( \
\( -type d -a -name test -o -name tests \) \
-o \
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
\) -exec rm -rf '{}' + \
&& apt-get purge -y --auto-remove $buildDeps \
&& rm -rf /usr/src/python ~/.cache

# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& { [ -e easy_install ] || ln -s easy_install-* easy_install; } \
&& ln -s idle3 idle \
&& ln -s pydoc3 pydoc \
&& ln -s python3 python \
&& ln -s python3-config python-config




RUN apt-get update
RUN apt install -y graphviz libgraphviz-dev pkg-config
RUN PKG_CONFIG_ALLOW_SYSTEM_LIBS=OHYESPLEASE pip install pygraphviz
ADD zen/requirements.txt /
RUN pip3 install -r /requirements.txt
WORKDIR /app
RUN /usr/local/bin/npm install
RUN npm update


11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -260,7 +260,7 @@ rsi
--overbought_rsi=<value> sell when RSI reaches or goes above this value (default: 82)
--rsi_recover=<value> allow RSI to recover this many points before buying (default: 3)
--rsi_drop=<value> allow RSI to fall this many points before selling (default: 0)
--rsi_divisor=<value> sell when RSI reaches high-water reading divided by this value (default: 2)
--rsi_dividend=<value> sell when RSI reaches high-water reading divided by this value (default: 2)

sar
description:
@@ -452,8 +452,15 @@ zenbot sell gdax.BTC-USD --pct=10
## TODO

- cancel pending orders on SIGINT
- determine and fix what is causing live trading to underperform vs. paper trading/simulations
- improve order execution speed, possibly by using market-type orders (incurring taker fees)
- support for limiting the amount of balance Zenbot can use for trading
- fix partial filled orders sometimes not getting recognized, due to race conditions
- tool to generate graph and stats from live or paper trading sessions
- review PRs
- save sim data to db, for front-end UI
- make error output compact, no stack trace
- review PR for Bitfinex
- more exchange support
- web UI with graphs and logs
- "reaper" to automatically prune trades collection to a certain day length
- "lite mode" for trader, an option to run without MongoDB
3 changes: 0 additions & 3 deletions commands/sim.js
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ var tb = require('timebucket')
, moment = require('moment')
, colors = require('colors')


module.exports = function container (get, set, clear) {
var c = get('conf')
return function (program) {
@@ -78,7 +77,6 @@ module.exports = function container (get, set, clear) {
var cursor, reversing, reverse_point
var query_start = so.start ? tb(so.start).resize(so.period).subtract(so.min_periods + 2).toMilliseconds() : null


function exitSim () {
console.log()
if (!s.period) {
@@ -165,7 +163,6 @@ module.exports = function container (get, set, clear) {
process.exit(0)
}


function getNext () {
var opts = {
query: {
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
server:
build: .
volumes:
- .:/app
- /app/node_modules
links:
- mongodb
command: ./zenbot.sh trade --paper
restart: always

mongodb:
image: mongo:latest
volumes_from:
- mongodb-data
command: mongod --smallfiles

mongodb-data:
image: mongo:latest
volumes:
- ./data/db:/data/db
command: "true"
1 change: 0 additions & 1 deletion extensions/exchanges/gdax/exchange.js
Original file line number Diff line number Diff line change
@@ -81,7 +81,6 @@ module.exports = function container (get, set, clear) {
side: trade.side
}
})
trades.reverse()
cb(null, trades)
})
},
77 changes: 77 additions & 0 deletions extensions/exchanges/kraken/products.json
Original file line number Diff line number Diff line change
@@ -90,6 +90,20 @@
"increment": "0.00000001",
"label": "ETH/XBT"
},
{
"asset": "XETH",
"currency": "XXBT",
"min_size": "0.01",
"increment": "0.00000001",
"label": "ETH/XBT"
},
{
"asset": "XETH",
"currency": "ZCAD",
"min_size": "0.01",
"increment": "0.00000001",
"label": "ETH/CAD"
},
{
"asset": "XETH",
"currency": "ZCAD",
@@ -104,6 +118,20 @@
"increment": "0.00000001",
"label": "ETH/EUR"
},
{
"asset": "XETH",
"currency": "ZEUR",
"min_size": "0.01",
"increment": "0.00000001",
"label": "ETH/EUR"
},
{
"asset": "XETH",
"currency": "ZGBP",
"min_size": "0.01",
"increment": "0.00000001",
"label": "ETH/GBP"
},
{
"asset": "XETH",
"currency": "ZGBP",
@@ -118,6 +146,20 @@
"increment": "0.00000001",
"label": "ETH/JPY"
},
{
"asset": "XETH",
"currency": "ZJPY",
"min_size": "0.01",
"increment": "0.00000001",
"label": "ETH/JPY"
},
{
"asset": "XETH",
"currency": "ZUSD",
"min_size": "0.01",
"increment": "0.00000001",
"label": "ETH/USD"
},
{
"asset": "XETH",
"currency": "ZUSD",
@@ -209,13 +251,34 @@
"increment": "0.00000001",
"label": "XBT/CAD"
},
{
"asset": "XXBT",
"currency": "ZCAD",
"min_size": "0.01",
"increment": "0.00000001",
"label": "XBT/CAD"
},
{
"asset": "XXBT",
"currency": "ZEUR",
"min_size": "0.01",
"increment": "0.00000001",
"label": "XBT/EUR"
},
{
"asset": "XXBT",
"currency": "ZEUR",
"min_size": "0.01",
"increment": "0.00000001",
"label": "XBT/EUR"
},
{
"asset": "XXBT",
"currency": "ZGBP",
"min_size": "0.01",
"increment": "0.00000001",
"label": "XBT/GBP"
},
{
"asset": "XXBT",
"currency": "ZGBP",
@@ -230,6 +293,20 @@
"increment": "0.00000001",
"label": "XBT/JPY"
},
{
"asset": "XXBT",
"currency": "ZJPY",
"min_size": "0.01",
"increment": "0.00000001",
"label": "XBT/JPY"
},
{
"asset": "XXBT",
"currency": "ZUSD",
"min_size": "0.01",
"increment": "0.00000001",
"label": "XBT/USD"
},
{
"asset": "XXBT",
"currency": "ZUSD",
4 changes: 1 addition & 3 deletions extensions/exchanges/kraken/update-products.sh
Original file line number Diff line number Diff line change
@@ -34,9 +34,7 @@ kraken.api('Assets', null, function (error, data) {
process.exit(1)
} else {
Object.keys(data.result).forEach(function (result) {
if(!result.match('\.d')) {
addProduct(data.result[result].base, data.result[result].quote, data.result[result].altname)
}
addProduct(data.result[result].base, data.result[result].quote, data.result[result].altname)
})
var target = require('path').resolve(__dirname, 'products.json')
require('fs').writeFileSync(target, JSON.stringify(products, null, 2))
6 changes: 0 additions & 6 deletions extensions/strategies/deep_net0/_codemap.js

This file was deleted.

Loading