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

Commit

Permalink
Windows support (#387)
Browse files Browse the repository at this point in the history
* Windows support

* Fixed spawn command when trading
* Fixed backtester runCommand
* Added docker-compose-windows.yml which addresses DB volume exposing issues on Windows
* Update readme.md

* Untabify file...
  • Loading branch information
cmroche authored and DeviaVir committed Jul 18, 2017
1 parent d8f21fc commit e48dff4
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Zenbot is a command-line cryptocurrency trading bot using Node.js and MongoDB. I

## Quick-start

### 1. Requirements: Linux or OSX or Docker, [Node.js](https://nodejs.org/) and [MongoDB](https://www.mongodb.com/).
### 1. Requirements: Windows, Linux or OSX or Docker, [Node.js](https://nodejs.org/) and [MongoDB](https://www.mongodb.com/).

### 2. Install zenbot 4:

Expand Down Expand Up @@ -95,6 +95,12 @@ docker-compose build
docker-compose up (-d if you don't want to see the log)
```

If you are running windows use the following command

```
docker-compose --file=docker-compose-windows.yml up
```

If you wish to run commands (e.g. backfills, list-selectors), you can run this separate command after a successful `docker-compose up -d`:

```
Expand Down
3 changes: 2 additions & 1 deletion commands/trade.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ module.exports = function container (get, set, clear) {
var periods = get('db.periods')

console.log('fetching pre-roll data:')
var backfiller = spawn(path.resolve(__dirname, '..', 'zenbot.sh'), ['backfill', so.selector, '--days', days])
var zenbot_cmd = process.platform === 'win32' ? 'zenbot.bat' : 'zenbot.sh'; // Use 'win32' for 64 bit windows too
var backfiller = spawn(path.resolve(__dirname, '..', zenbot_cmd), ['backfill', so.selector, '--days', days])
backfiller.stdout.pipe(process.stdout)
backfiller.stderr.pipe(process.stderr)
backfiller.on('exit', function (code) {
Expand Down
21 changes: 21 additions & 0 deletions docker-compose-windows.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
command: "true"
3 changes: 2 additions & 1 deletion scripts/auto_backtester/backtester.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ let runCommand = (strategy, cb) => {
speed: `--baseline_periods=${strategy.baseline_periods} --trigger_factor=${strategy.trigger_factor}`,
trend_ema: `--trend_ema=${strategy.trend_ema} --oversold_rsi=${strategy.oversold_rsi} --oversold_rsi_periods=${strategy.oversold_rsi_periods} --neutral_rate=${strategy.neutral_rate}`
};
let command = `zenbot sim ${simArgs} ${strategyArgs[strategyName]} --period=${strategy.period} --min_periods=${strategy.min_periods}`;
let zenbot_cmd = process.platform === 'win32' ? 'zenbot.bat' : 'zenbot.sh'; // Use 'win32' for 64 bit windows too
let command = `${zenbot_cmd} sim ${simArgs} ${strategyArgs[strategyName]} --period=${strategy.period} --min_periods=${strategy.min_periods}`;
console.log(`[ ${countArr.length}/${strategies[strategyName].length} ] ${command}`);

shell.exec(command, {silent:true, async:true}, (code, stdout, stderr) => {
Expand Down
1 change: 1 addition & 0 deletions zenbot.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node zenbot.sh %*

0 comments on commit e48dff4

Please sign in to comment.