Skip to content

A custom OpenAI gym environment for simulating stock trades on historical price data.

License

Notifications You must be signed in to change notification settings

topshot99/Reinforcement-Learning-Stock-Trading

 
 

Repository files navigation

Reinforcement Learning Stock Trading

This repository contains a reinforcement learning-based agent designed to navigate the stock market effectively. The agent learns to make trading decisions by training on historical stock price data.

Getting Started

Follow these steps to set up and use the RL stock trading agent:

  1. Fetch Historical Data

    • Execute python data-fetch.py to fetch historical data for your desired stock. Replace the stock symbol and date range with your preferences in the script.
    python data-fetch.py 

    This script retrieves historical stock price data, which will be used for training and testing the model.

    • Next, run TradingEnv.py to train the reinforcement learning model using the fetched data. Ensure that you have all the required dependencies installed (see requirements.txt).
    python TradingEnv.py
    
  2. Using a Pretrained Model Alternatively, this repository provides a custom trained model (trading_agent.zip) that you can load and use directly if you prefer not to train your own model.

  3. Testing the Model with Live Data Run TestTradingEnv.py to evaluate the accuracy of the trained model when making trading decisions on live data.

python TestTradingEnv.py
  1. Render the model This custom trained model can be rendered by running the renderscript
python renderscript.py

image

Additional Resources

  • Open AI gym reference docs: https://gymnasium.farama.org/
  • Feel free to explore and adapt the code to your specific needs in stock trading and reinforcement learning.

About

A custom OpenAI gym environment for simulating stock trades on historical price data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%