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

Add strategy: forex.analytics, an genetic optimization algorithm for TA-lib stats #389

Merged
merged 15 commits into from
Jul 27, 2017
Merged

Add strategy: forex.analytics, an genetic optimization algorithm for TA-lib stats #389

merged 15 commits into from
Jul 27, 2017

Conversation

crubb
Copy link
Contributor

@crubb crubb commented Jul 16, 2017

See #385 and see https://github.com/mkmarek/forex.analytics

Furthermore:

  • Add option to sim to disable output of option
  • Add option to sim to disable writing HTML results
  • Add a 'noop' strategy, which just does nothing. It is used to generate candlestick data for model training.

It seems to work, but I have no idea what the proper default training options or candlestick length periods should be.

I have not yet done any in-depth training and optimizations, but out of the box and in the current market conditions at least I get some % above buy/hold ;)

First, you have to backfill, then you train a model, e.g.
$ ./zenbot.sh train kraken.XETH-ZEUR --days_training 28 --days_test 7 --period 20m

Running train automatically runs simulations on the training and test periods (--days_test can be 0 (default)) and outputs the results.

You can then use the model automatically saved in models/ for trading
$ ./zenbot.sh trade kraken.XETH-ZEUR --modelfile models/forex.model_kraken.XETH-ZEUR_period-20m_from-20170704_020000_to-20170709_020000.json --period 20m --paper

Again, this needs optimization on the default parameters and I would love to get feedback from knowledgeable people (@arpheno, @gelotus, @infatrus, ...?).

-- crubb

@tuxitor
Copy link
Contributor

tuxitor commented Jul 16, 2017

Could separating data fetching and training be an idea? Reason is the exchanges that don't provide trade history, like Bitstamp, BTCe and probably more. Then data fetching (possibly without any screen output) could be running uninterupted even if trade stops for shorter or longer periods. Program name could be fill.js as an alternative to backfill.js

@crubb crubb changed the title Add forex.analytics (an genetic optimization algorithm for TA-lib stats) Add strategy: forex.analytics, an genetic optimization algorithm for TA-lib stats Jul 16, 2017
@crubb
Copy link
Contributor Author

crubb commented Jul 16, 2017

As discussed on #developers/Discord:

This is a general problem for these exchanges, since simulations will also not work properly in the moment, just --paper trading. We should be able to play around with this strategy in the other exchanges. If we achieve stellar performance, we should piece together some kind of database-filling method to train the model for these exchanges.

Thank you!

- Limit width of progressbar in training to 80 cols
@crubb
Copy link
Contributor Author

crubb commented Jul 17, 2017

Some example ;)

bildschirmfoto 2017-07-17 um 21 51 12

Running --paper since a few hours, so far -1.1%/-1.9%, though :/

crubb added 3 commits July 18, 2017 12:18
- Fixed hang when not using a test dataset
- Changed default indicators
@infatrus
Copy link

Model files are overwritten each time, when training with the same parameters. It would be nice to have sim/test results as pct. gain/loose as a part of a filename - that would solve the issue with overwriting, and would let easily find the best model.

@crubb
Copy link
Contributor Author

crubb commented Jul 19, 2017

D'oh.. That does explain some of the variance in my results :D
Fixed.

@infatrus
Copy link

;) Yeah, same with me - I had some promising model for BTC-USDT, then just realized, that files are overwritten... Retard me... I could make a copy.

@@ -0,0 +1,87 @@
var z = require('zero-fill')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be really awesome to get a brief commented rundown of what this strategy does.

@infatrus
Copy link

crubb, can you add "--reverse" option to allow trades with reversed buy/sell signals?
Some models could probably deal better with such option.

2017-07-21 05:00:00 0.00000717 STR-BTC -0.8% 2.18m 57 ++ 0.1106 0.0337 buy
2017-07-21 05:10:00 0.00000701 STR-BTC -2.2% 4.91m - 46 -0.0653 0.0415 sell
2017-07-21 05:20:00 0.00000722 STR-BTC +3.0% 4.45m 57 ++ 0.1596 0.0752 buy

Repository owner deleted a comment from sandroid10 Jul 26, 2017
Repository owner deleted a comment from sandroid10 Jul 26, 2017
Copy link
Owner

@DeviaVir DeviaVir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only real comment I have is that I would expect an entry in the /docs/ on how to use the training model, at least with a simple usage example. Other than that I think this code is fine and is ready to be used by more people so we can get more eyes and comments on it.

commands/sim.js Outdated
@@ -63,6 +64,7 @@ module.exports = function container (get, set, clear) {
so.start = d.subtract(so.days).toMilliseconds()
}
so.stats = !!cmd.enable_stats
so.show_options = !!!cmd.disable_options
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL :)

@crubb
Copy link
Contributor Author

crubb commented Jul 26, 2017

Documentation added.

@DeviaVir DeviaVir merged commit 2fe7741 into DeviaVir:master Jul 27, 2017
christian452 pushed a commit to christian452/zenbot that referenced this pull request Aug 4, 2017
…os8f-master

* 'master' of https://github.com/carlos8f/zenbot:
  Improve command help for train command (DeviaVir#436)
  Support for missing win/loss and error rate from output (DeviaVir#426)
  Fix docker builds for forex.analytics (DeviaVir#424)
  Minor fixes for Quadriga trading API (DeviaVir#421)
  xmpp for trading alarms (DeviaVir#333)
  Strategies: TA (ema+macd) and Trust/Distrust (DeviaVir#285)
  Fixed docker build (DeviaVir#349)
  updated c.default_selector to c.selector in README.md (DeviaVir#418)
  added check for message before doing anything with it (DeviaVir#412)
  FIX: Properly check for unknown indicators in forex_analytics (DeviaVir#408)
  Added support for the BTCe exchange (DeviaVir#388)
  Add strategy: forex.analytics, an genetic optimization algorithm for TA-lib stats (DeviaVir#389)

# Conflicts:
#	.gitignore
#	commands/sim.js
#	extensions/exchanges/bittrex/exchange.js
#	extensions/exchanges/quadriga/exchange.js
#	lib/engine.js
#	scripts/auto_backtester/backtester.js
supersabbath pushed a commit to supersabbath/zenbot that referenced this pull request Oct 2, 2017
…TA-lib stats (DeviaVir#389)

* Add a 'noop' strategy, which just does nothing. Can be used to generate e.g. candlestick data for model training.

* - Add option to `sim` to disable output of option
- Add option to `sim` to disable writing HTML results

* Add forex_analytics training, simulation and strategy (see https://github.com/mkmarek/forex.analytics and DeviaVir#385)

* - .gitignore trained models
- Limit width of progressbar in training to 80 cols

* - Added timezone to datetime displays
- Fixed hang when not using a test dataset
- Changed default indicators

* Windows fixes for sim spawn

* Write a final model including sim results (output while training less pretty)

* Made train pretty again. Also write simulation Results as HTML files in models/

* Speed up parseSimulation()

* Properly name simulation result HTML files after training

* - Use the defaults of the forex.analytics project for training
- Add a check for unknown indicators

* forex_analytics documentation

* !!! -> !
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants