{"id":13528681,"url":"https://github.com/notadamking/RLTrader","last_synced_at":"2025-04-01T14:32:46.508Z","repository":{"id":34954265,"uuid":"183808954","full_name":"notadamking/RLTrader","owner":"notadamking","description":"A cryptocurrency trading environment using deep reinforcement learning and OpenAI's gym","archived":false,"fork":false,"pushed_at":"2022-01-22T05:01:41.000Z","size":17747,"stargazers_count":1764,"open_issues_count":42,"forks_count":541,"subscribers_count":131,"default_branch":"master","last_synced_at":"2025-03-31T19:08:09.012Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://discord.gg/ZZ7BGWh","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/notadamking.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"notadamking","patreon":"notadamking","custom":["https://www.blockchain.com/btc/address/1Lc47bhYvdyKGk1qN8oBHdYQTkbFLL3PFw","https://www.blockchain.com/eth/address/0x9907A0cF64Ec9Fbf6Ed8FD4971090DE88222a9aC"]}},"created_at":"2019-04-27T18:35:15.000Z","updated_at":"2025-03-29T08:27:41.000Z","dependencies_parsed_at":"2022-08-08T03:01:11.358Z","dependency_job_id":null,"html_url":"https://github.com/notadamking/RLTrader","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notadamking%2FRLTrader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notadamking%2FRLTrader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notadamking%2FRLTrader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notadamking%2FRLTrader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/notadamking","download_url":"https://codeload.github.com/notadamking/RLTrader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246655215,"owners_count":20812600,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T07:00:22.713Z","updated_at":"2025-04-01T14:32:46.479Z","avatar_url":"https://github.com/notadamking.png","language":"Python","funding_links":["https://github.com/sponsors/notadamking","https://patreon.com/notadamking","https://www.blockchain.com/btc/address/1Lc47bhYvdyKGk1qN8oBHdYQTkbFLL3PFw","https://www.blockchain.com/eth/address/0x9907A0cF64Ec9Fbf6Ed8FD4971090DE88222a9aC"],"categories":["Environments","Python","Applications","Machine Learning for Trading","Social Processing"],"sub_categories":["Sentiment Analysis"],"readme":"# RLTrader — The Predecessor to [TensorTrade](https://github.com/notadamking/tensortrade)\n\n[![Build Status](https://travis-ci.org/notadamking/RLTrader.svg?branch=master)](https://travis-ci.org/notadamking/RLTrader)\n[![Contributions Welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg)](http://makeapullrequest.com)\n[![GPL License](https://img.shields.io/github/license/notadamking/RLTrader.svg?color=brightgreen)](https://opensource.org/licenses/GPL-3.0/)\n[![Discord](https://img.shields.io/discord/592446624882491402.svg?color=brightgreen)](https://discord.gg/ZZ7BGWh)\n[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)\n[![Github Release](https://img.shields.io/github/release/notadamking/RLTrader.svg)](https://github.com/notadamking/RLTrader)\n\nDevelopment on this library has slowed down, in favor of working on TensorTrade - a framework for trading with RL: https://github.com/notadamking/tensortrade\n\nIf you'd like to learn more about how we created this agent, check out the Medium article: https://towardsdatascience.com/creating-bitcoin-trading-bots-that-dont-lose-money-2e7165fb0b29\n\nLater, we optimized this repo using feature engineering, statistical modeling, and Bayesian optimization, check it out:\nhttps://towardsdatascience.com/using-reinforcement-learning-to-trade-bitcoin-for-massive-profit-b69d0e8f583b\n\nDiscord server: https://discord.gg/ZZ7BGWh\n\nData sets: https://www.cryptodatadownload.com/data/northamerican/\n\n![Live trading visualization](https://github.com/notadamking/RLTrader/blob/master/visualization.gif)\n\n# Getting Started\n\n### How to find out if you have nVIDIA GPU?\n\nLinux:\n\n```bash\nsudo lspci | grep -i --color 'vga\\|3d\\|2d' | grep -i nvidia\n```\n\nIf this returns anything, then you should have an nVIDIA card.\n\n### Basic usage\n\nThe first thing you will need to do to get started is install the requirements. If your system has an nVIDIA GPU that you should start by using:\n\n```bash\ncd \"path-of-your-cloned-rl-trader-dir\"\npip install -r requirements.txt\n```\n\nMore information regarding how you can take advantage of your GPU while using docker: https://github.com/NVIDIA/nvidia-docker\n\nIf you have another type of GPU or you simply want to use your CPU, use:\n\n```bash\npip install -r requirements.no-gpu.txt\n```\n\nUpdate your current static files, that are used by default:\n\n```bash\n python ./cli.py update-static-data\n```\n\nAfterwards you can simply see the currently available options:\n\n```bash\npython ./cli.py --help\n```\n\nor simply run the project with default options:\n\n```bash\npython ./cli.py optimize\n```\n\nIf you have a standard set of configs you want to run the trader against, you can specify a config file to load configuration from. Rename config/config.ini.dist to config/config.ini and run\n\n```bash\npython ./cli.py --from-config config/config.ini optimize\n```\n\n```bash\npython ./cli.py optimize\n```\n\n### Testing with vagrant\n\nStart the vagrant box using:\n\n```bash\nvagrant up\n```\n\nCode will be located at /vagrant. Play and/or test with whatever package you wish.\nNote: With vagrant you cannot take full advantage of your GPU, so is mainly for testing purposes\n\n### Testing with docker\n\nIf you want to run everything within a docker container, then just use:\n\n```bash\n./run-with-docker (cpu|gpu) (yes|no) optimize\n```\n\n- cpu - start the container using CPU requirements\n- gpu - start the container using GPU requirements\n- yes | no - start or not a local postgres container\n  Note: in case using yes as second argument, use\n\n```bash\npython ./ cli.py --params-db-path \"postgres://rl_trader:rl_trader@localhost\" optimize\n```\n\nThe database and it's data are pesisted under `data/postgres` locally.\n\nIf you want to spin a docker test environment:\n\n```bash\n./run-with-docker (cpu|gpu) (yes|no)\n```\n\nIf you want to run existing tests, then just use:\n\n```bash\n./run-tests-with-docker\n```\n\n# Fire up a local docker dev environment\n\n```bash\n./dev-with-docker\n```\n\n# Windows 10 installation, no CUDA installation needed\n\nconda create --name rltrader python=3.6.8 pip git\nconda activate rltrader\nconda install tensorflow-gpu\ngit clone https://github.com/notadamking/RLTrader\npip install -r RLTrader/requirements.txt\n\n# Optimizing, Training, and Testing\n\nWhile you could just let the agent train and run with the default PPO2 hyper-parameters, your agent would likely not be very profitable. The `stable-baselines` library provides a great set of default parameters that work for most problem domains, but we need to better.\n\nTo do this, you will need to run `optimize.py`.\n\n```bash\npython ./optimize.py\n```\n\nThis can take a while (hours to days depending on your hardware setup), but over time it will print to the console as trials are completed. Once a trial is completed, it will be stored in `./data/params.db`, an SQLite database, from which we can pull hyper-parameters to train our agent.\n\nFrom there, agents will be trained using the best set of hyper-parameters, and later tested on completely new data to verify the generalization of the algorithm.\n\nFeel free to ask any questions in the Discord!\n\n# Google Colab\nEnter and run the following snippet in the first cell to load RLTrader into a Google Colab environment. Don't forget to set hardware acceleration to GPU to speed up training! \n\n```\n!git init \u0026\u0026 git remote add origin https://github.com/notadamking/RLTrader.git \u0026\u0026 git pull origin master\n!pip install -r requirements.txt\n```\n\n# Common troubleshooting\n\n##### The specified module could not be found.\n\nNormally this is caused by missing mpi module. You should install it according to your platorm.\n\n- Windows: https://docs.microsoft.com/en-us/message-passing-interface/microsoft-mpi\n- Linux/MacOS: https://www.mpich.org/downloads/\n\n# Contributing\n\nContributions are encouraged and I will always do my best to get them implemented into the library ASAP. This project is meant to grow as the community around it grows. Let me know if there is anything that you would like to see in the future or if there is anything you feel is missing.\n\n**Working on your first Pull Request?** You can learn how from this _free_ series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)\n\n![https://github.com/notadamking/rltrader/graphs/contributors](https://contributors-img.firebaseapp.com/image?repo=notadamking/rltrader)\n\n# Support\n\nWant to show your support for this project and help it grow?\n\nHead over to the successor framework: https://github.com/notadamking/tensortrade\n\nSupporters:\n\n* Ap9944\n* KILLth\n* Nex\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotadamking%2FRLTrader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnotadamking%2FRLTrader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotadamking%2FRLTrader/lists"}