zenbot
zenbot copied to clipboard
errors when running darwin.js
System information
- Have I written custom code (as opposed to using zenbot vanilla): No
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 17.10
- Zenbot version: 4.05
- NodeJS version: v8.9.3
- Python version: Python 2.7.14
- Exact command to reproduce:
scripts/genetic_backtester/darwin.js --selector=poloniex.XRP-BTC --days=4 --population=1
Describe the problem
The code errors out without generating results.
Source code / logs
``Generation complete, saving results...
Generation's Best Results
(crossover_vwap) VS Buy and Hold: undefined End Balance: undefined
(cci_srsi) VS Buy and Hold: undefined End Balance: undefined
(srsi_macd) VS Buy and Hold: undefined End Balance: undefined
(macd) VS Buy and Hold: undefined End Balance: undefined
(neural) VS Buy and Hold: undefined End Balance: undefined
(rsi) VS Buy and Hold: undefined End Balance: undefined
(sar) VS Buy and Hold: undefined End Balance: undefined
(speed) VS Buy and Hold: undefined End Balance: undefined
(trend_ema) VS Buy and Hold: undefined End Balance: undefined
(trust_distrust) VS Buy and Hold: undefined End Balance: undefined
(ta_macd) VS Buy and Hold: undefined End Balance: undefined
(ta_ema) VS Buy and Hold: undefined End Balance: undefined
=== Simulating generation 2 ===
Backfilling (might take some time) ...
./zenbot.sh backfill --days=4 poloniex.XRP-BTC
Generation complete, saving results...
Generation's Best Results
/home/greg/zenbot/scripts/genetic_backtester/node_modules/geneticalgorithm/index.js:121
},scored[0]).phenotype
^
TypeError: Cannot read property 'phenotype' of undefined
at Object.best (/home/greg/zenbot/scripts/genetic_backtester/node_modules/geneticalgorithm/index.js:121:19)
at /home/greg/zenbot/scripts/genetic_backtester/darwin.js:575:35
at Array.forEach (<anonymous>)
at parallel (/home/greg/zenbot/scripts/genetic_backtester/darwin.js:574:24)
at end (/home/greg/zenbot/scripts/genetic_backtester/node_modules/run-parallel-limit/index.js:17:15)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
``
having the same issue with command
./scripts/genetic_backtester/darwin.js --selector="gdax.LTC-USD" --days=1 --currency_capital=10000 --use_strategies=trend_ema --population=1 --order_type=maker
--==Zenbot 4 Genetic Backtester v0.2==--
Sun, 24 Dec 2017 05:17:59 GMT
Backtesting strategy trend_ema ...
Creating population of 1 ...
=== Simulating generation 1 ===
Backfilling (might take some time) ...
./zenbot.sh backfill --days=1 gdax.LTC-USD
[ 1/1 ] ./zenbot.sh sim gdax.LTC-USD --days=1 --currency_capital=10000 --filename none --strategy=trend_ema --periodLength=102m --min_periods=13 --markup_pct=3.643411730842544 --order_type=maker --sell_stop_pct=0 --buy_stop_pct=19 --profit_stop_enable_pct=0 --profit_stop_pct=19 --trend_ema=20 --oversold_rsi=26 --oversold_rsi_periods=18 --neutral_rate=auto
Generation complete, saving results...
Generation's Best Results
(trend_ema) VS Buy and Hold: -7.48 End Balance: 9581.62505662
=== Simulating generation 2 ===
Backfilling (might take some time) ...
./zenbot.sh backfill --days=1 gdax.LTC-USD
Generation complete, saving results...
Generation's Best Results
/mnt/d/work/3rdparty/zenbot/scripts/genetic_backtester/node_modules/geneticalgorithm/index.js:121
},scored[0]).phenotype
^
TypeError: Cannot read property 'phenotype' of undefined
at Object.best (/mnt/d/work/3rdparty/zenbot/scripts/genetic_backtester/node_modules/geneticalgorithm/index.js:121:19)
at /mnt/d/work/3rdparty/zenbot/scripts/genetic_backtester/darwin.js:576:35
at Array.forEach (<anonymous>)
at parallel (/mnt/d/work/3rdparty/zenbot/scripts/genetic_backtester/darwin.js:575:24)
at end (/mnt/d/work/3rdparty/zenbot/scripts/genetic_backtester/node_modules/run-parallel-limit/index.js:17:15)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
Issue still remain with latest version
I can reproduce this in the latest release with @pursehouse's command:
./scripts/genetic_backtester/darwin.js --selector="gdax.LTC-USD" --days=1 --currency_capital=10000 --use_strategies=trend_ema --population=1 --order_type=maker
# ./scripts/genetic_backtester/darwin.js --selector="gdax.LTC-USD" --days=1 --currency_capital=10000 --use_strategies=trend_ema --population=1 --order_type=maker
--==Zenbot 4 Genetic Backtester v0.2==--
Thu, 28 Dec 2017 17:00:01 GMT
Backtesting strategy trend_ema ...
Creating population of 1 ...
=== Simulating generation 1 ===
Backfilling (might take some time) ...
./zenbot.sh backfill --days=1 gdax.LTC-USD
[ 1/1 ] ./zenbot.sh sim gdax.LTC-USD --days=1 --currency_capital=10000 --filename none --strategy=trend_ema --periodLength=86m --min_periods=57 --markup_pct=0.9412225723906631 --order_type=maker --sell_stop_pct=13 --buy_stop_pct=11 --profit_stop_enable_pct=9 --profit_stop_pct=11 --trend_ema=20 --oversold_rsi=28 --oversold_rsi_periods=15 --neutral_rate=auto
Bad output detected TypeError: Cannot read property '1' of null
2017-12-28 10:37:59 247.310 LTC-USD +2.02% 32022 67 +++ 0.53000000 LTC 10000.00 USD -0.07% +4.82%
{
"asset_capital": 0.53,
"avg_slippage_pct": 0,
"buy_pct": 99,
"buy_stop_pct": 11,
"currency_capital": 10000,
"days": 1,
"filename": "none",
"markdown_buy_pct": 0,
"markup_pct": 0.9412225723906631,
"markup_sell_pct": 0,
"max_sell_loss_pct": 5000,
"max_slippage_pct": 5,
"min_periods": 57,
"mode": "sim",
"neutral_rate": "auto",
"order_adjust_time": 60000,
"order_type": "maker",
"oversold_rsi": 28,
"oversold_rsi_periods": 15,
"period": "86m",
"periodLength": "86m",
"profit_stop_enable_pct": 9,
"profit_stop_pct": 11,
"rsi_periods": 15,
"selector": {
"exchange_id": "gdax",
"product_id": "LTC-USD",
"asset": "LTC",
"currency": "USD",
"normalized": "gdax.LTC-USD"
},
"sell_pct": 99,
"sell_stop_pct": 13,
"show_options": true,
"start": 1514332800000,
"stats": false,
"strategy": "trend_ema",
"trend_ema": 20,
"verbose": false
}
end balance: 10128.98080000 (-0.09%)
buy hold: 9510.26910808 (-6.19%)
vs. buy hold: 6.50%
0 trades over 2 days (avg 0.00 trades/day)
Generation complete, saving results...
> Finished writing generation csv to simulations/backtesting_1514482185.csv
> Finished writing generation json to simulations/generation_data_1514482185_gen_2.json
Generation's Best Results
(trend_ema) Sim Fitness undefined, VS Buy and Hold: undefined End Balance: undefined, Wins/Losses undefined/undefined.
/root/zenbot/scripts/genetic_backtester/darwin.js:552
input = input.params.replace("module.exports =","");
^
TypeError: Cannot read property 'params' of undefined
at generateCommandParams (/root/zenbot/scripts/genetic_backtester/darwin.js:552:17)
at selectedStrategies.forEach (/root/zenbot/scripts/genetic_backtester/darwin.js:651:29)
at Array.forEach (<anonymous>)
at saveGenerationData (/root/zenbot/scripts/genetic_backtester/darwin.js:640:28)
at fs.writeFile.err (/root/zenbot/scripts/genetic_backtester/darwin.js:580:5)
at /root/zenbot/scripts/genetic_backtester/node_modules/graceful-fs/graceful-fs.js:43:10
at FSReqWrap.oncomplete (fs.js:135:15)
The test command is great to reproduce it, thanks for that. Will try to look at it when I have a chance.