Code Monkey home page Code Monkey logo

ml4trade-rl's Introduction

ml4trade-rl

Aim of this repository is solving ml4trade gym environment using reinforcement learning algorithms (specifically A2C and PPO).

Requirements

  • python 3.7 - 3.10
  • pip requirements
  • data to process by the environment

The data used by ml4trade by default can be retrieved via provided bash script download_all.sh. This is described in Installation step.

Instalation

Pip-install requirements:

pip install -r requirements.txt

Download default required data (~1.5GB in total):

bash data/download_all.sh

Necessary files will be downloaded, unpacked and stored in automatically created .data/ directory.

Testing

You can run tests stored in test/ directory to see if everything works as expected:

python -m unittest discover test

Usage

Start by using run.py script. Arguments are handled by Hydra framework: by default arguments are taken from conf/ directory. They are proven to give good results, but you can override them if needed. Seed can be optionally provided by +run.seed=your_seed_here, otherwise it is acquired from current datetime.

For example, given you want to run A2C algorithm for 1,000,000 time steps with n_steps parameter set to 50 and seed set to 42:

python run.py agent=a2c run.train_steps=1e6 agent.n_steps=50 +run.seed=42

All parameters stored in conf/ are configurable.

Other things worth mentioning:

  • results are stored in outputs/ directory, during each run Hydra creates there a new directory where logs and artifacts are stored
  • artifacts mentioned previously include: saved best model according to the performance on the test env, history of the actions on the test env, various logs, performance plots
  • consider using TensorBoard, TensorBoard logs are written during runs

Note

run.py was meant to be flexible and frequently changed according to needs. Feel free to tinker with it.

ml4trade-rl's People

Contributors

skalermo avatar

Watchers

Łukasz Lepak avatar  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.