Giter Club home page Giter Club logo

cryptocom_rl-trading-bot's Introduction

Q Network RL Trading bot

This bot uses the DQN algorithm to learn a trading strategy based on relevant market data such as price, price history, and technicals. The trading strategy tries to optimize a policy ฯ€ which maps current knowledge (or s) to the best action a = ฯ€(s). This is determined by the reward that is received by this assignment Q(s,a). The bot will try to maximize the reward as much as possible by modifying the policy.

The challenge to making a successful RL trading bot is to construct an appropriate reward function and an appropriate state to learn from. What factors are more important and what factors matter less?

This project is based off of the tf_agents library, adhering to py_environment.PyEnvironment and dqn_agent.DqnAgent base classes.

For more info on Q-Learning https://en.wikipedia.org/wiki/Q-learning

Install

pip install -r requirements.txt 

Learn

modify hyper parameters in learner.py then run python3 learner.py make a folder asset_prices en use binance-prices.py to download data

python3 learner.py

RUN python3 cryptocom_trader.py to trade live

Live trading

export API_KEY=XXXXX
export API_SECRET=XXXXX
python trader.py

Get new price data

Generate a new prices csv file It will generate a new csv file with info loaded from binance make sure to set your .env vars for binance

CLIENT_KEY=XXXXX
CLIENT_SECRET=XXXXX
python scripts/binance-prices.py price BTCUSDT
python scripts/stock-prices.py price 

Improvements

  • Fine tuning hyper parameters
  • Improve reward function
  • Adding sentiment analysis to the state
  • Risk Management
  • CryptoCom exchange add perpetual env to trade perpetual symbols ,i tried bun no luck
  • feel free to help me inprove this RL_TRADING BOT

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.