GithubHelp home page GithubHelp logo

daniloaleixo / neuroevolutionmarkettrader Goto Github PK

View Code? Open in Web Editor NEW
34.0 1.0 18.0 14.24 MB

Neuro evolution agent to buy and sell stocks atumatically

Jupyter Notebook 97.17% Python 2.79% Dockerfile 0.04% Shell 0.01%
neuroscience neuroevolution finance notebook trading-bot trading trading-simulator deep-learning deep-neural-networks cnn

neuroevolutionmarkettrader's Introduction

Neuro Evolution Market Trader

Neuro evolution agent to trade

If you like this project you can support me.

Apoia.se

It took me several experiments to get to this agent. I tried several deep learning architectures and technical analysis parameters.

Agent v 3.0141

The agent has the following characteristics:

  • Using neuro evolution
  • Receives OHLC as parameters
  • Generates RSI and MACD technical indicators to be used as parameters
  • Also run through a pretrained CNN buy and sell classifier to get the last set of parameters

Running

# Building notebook
docker build -t my-notebook -f docker/Dockerfile .

# Running notebook
docker run --rm -p 8888:8888 -p 6006:6006 -e JUPYTER_ENABLE_LAB=yes -v "$PWD":/home/jovyan/work my-notebook

# Optional: Tensorboard
docker exec -it <container_id> /bin/bash
tensorboard --logdir work/GA/tensorboard_Market_v3.0141/

Results

Right now the best agent v3.0141, the agent uses OHLC, RSI and MACD inputs, as well as the output of a pretrained CNN buy and sell classifier. The agent has these results applied to EURUSD with 30M candles:

  • Mean over backtest returns: 14.17%
  • Points above buy and hold mean: 12.26%
  • Winning Percent mean: 80%

Training

img

Max fitness for each generation

img

Mean fitness for each generation

Backtesting

2016 15M candles

img

2017 30M candles

img

2018 30M candles

img

RUNINFO: v3.0141 - OHLC + CNN Classifier B/S w10 15x15 + RSI&MACD

Params
  • layers: 16, 32, 64, 32, 16
  • population_size: 256
  • generations: 100
  • episodes: 10
  • mutation_variance: 0.005
  • survival_ratio: 0.3
  • both_parent_percentage: 0.8
  • one_parent_percentage: 0.1
  • reward_function: SimpleProfit
  • initial_cash: 5.0
  • profit_window_size: 10
  • close_col: 0
  • large_holdings_penalty: 0
  • lost_all_cash_penalty: -1e2
  • inaction_penalty: 0
Results
  • After 100 generations
    • Max rewards: 2.508929
    • Mean rewards: 0.963821
    • Std rewrads: 1.400484
    • Best Profit (Env 10k - 50k): 37.23
    • Mean profit over all best genome (Env 10k - 50k): 14.35
  • Backtesting:
    • Mean of 2016 + 2017 + 2018 returns: 14.17
    • Points above BH mean: 12.26
    • Winning Percent mean: 80%
    • 2016 15M
      • Return [%] 24.8711
      • Buy & Hold Return [%] -3.144688847131627
      • Max. Drawdown [%] 2.58
      • Avg. Drawdown [%] 0.64
      • n Trades 7860
      • Win Rate [%] 81.40
      • Best Trade [%] 0.12363999999999997
      • Worst Trade [%] -0.08284999999999965
      • SQN 4.67
      • Sharpe Ratio 0.0
      • Sortino Ratio -2.1676
    • 2017 30M
      • Return [%] 8.5952
      • Buy & Hold Return [%] 13.862653618570775
      • Max. Drawdown [%] 3.55
      • Avg. Drawdown [%] 0.75
      • n Trades 3160
      • Win Rate [%] 80.54
      • Best Trade [%] 0.02414999999999967
      • Worst Trade [%] -0.04445000000000032
      • SQN 2.20
      • Sharpe Ratio 0.0
      • Sortino Ratio -2.3002
    • 2018 30M
      • Return [%] 9.0453
      • Buy & Hold Return [%] -5.008444957273516
      • Max. Drawdown [%] 2.72
      • Avg. Drawdown [%] 0.12
      • n Trades 3318
      • Win Rate [%] 78.99
      • Best Trade [%] 0.024970000000000603
      • Worst Trade [%] -0.038909999999999556
      • SQN 2.31
      • Sharpe Ratio 0.0
      • Sortino Ratio -2.8040

Next Steps

  • Develop an API
  • Develop a training API
  • Use socket inside API
  • Develop a front end to visualize the training

neuroevolutionmarkettrader's People

Contributors

daniloaleixo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.