{"id":26486807,"url":"https://github.com/mattjhawken/deep-rl-trading","last_synced_at":"2026-05-19T03:09:14.291Z","repository":{"id":234226462,"uuid":"725757217","full_name":"mattjhawken/deep-rl-trading","owner":"mattjhawken","description":"A transformer-based deep RL trading bot built with PyTorch.","archived":false,"fork":false,"pushed_at":"2025-01-16T18:40:30.000Z","size":6255,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-20T06:33:08.053Z","etag":null,"topics":["deep-learning","deep-q-learning","deep-reinforcement-learning","trading-algorithms","transformer"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mattjhawken.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-30T20:11:22.000Z","updated_at":"2025-02-17T12:53:28.000Z","dependencies_parsed_at":"2025-03-20T06:43:16.467Z","dependency_job_id":null,"html_url":"https://github.com/mattjhawken/deep-rl-trading","commit_stats":null,"previous_names":["mattjhawken/transforming-stonks","mattjhawken/deeptradetransformer","mattjhawken/deep-rl-trading"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mattjhawken/deep-rl-trading","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattjhawken%2Fdeep-rl-trading","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattjhawken%2Fdeep-rl-trading/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattjhawken%2Fdeep-rl-trading/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattjhawken%2Fdeep-rl-trading/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattjhawken","download_url":"https://codeload.github.com/mattjhawken/deep-rl-trading/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattjhawken%2Fdeep-rl-trading/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266614309,"owners_count":23956342,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["deep-learning","deep-q-learning","deep-reinforcement-learning","trading-algorithms","transformer"],"created_at":"2025-03-20T06:29:57.437Z","updated_at":"2026-05-19T03:09:14.228Z","avatar_url":"https://github.com/mattjhawken.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## A Deep-RL Transformer-Based Trading Agent in PyTorch\n\nThis repository contains a trading agent that leverages deep-Q learning (RL) and an encoder-based transformer, built in PyTorch.\n\n## Quickstart Guide\n\n#### Requirements\n- Python 3.9 or later\n\n#### Clone the repository:\n```bash\ngit clone https://github.com/mattjhawken/DeepTradeTransformer.git\ncd DeepTradeTransformer\n```\n\n#### Set up a virtual environment (optional but recommended):\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows use `venv\\Scripts\\activate`\n```\n\n#### Install dependencies:\n```bash\npip install -r requirements.txt\n```\n\n### Running the Agent\nTo run the agent and start training, use the following command:\n\n```bash\npython main.py\n```\n\n### Key Input Parameters\nThe agent's behavior is controlled by several key parameters, detailed below:\n\n#### Machine Learning Parameters\n- **embeddings**: The size of the embedding layer in the transformer model.\n- **layers**: The number of transformer layers used in the model.\n- **heads**: The number of attention heads in each transformer layer.\n- **fwex**: Forward expansion size of the transformer's feed-forward network.\n- **dropout**: Dropout rate used in the transformer model to prevent overfitting.\n- **neurons**: The number of neurons in the fully connected layers of the network.\n- **lr (Learning Rate)**: Controls how much to change the model in response to the estimated error each time the model weights are updated.\n\n#### Reinforcement Learning Parameters\n- **gamma**: The discount factor used in the reinforcement learning update rule.\n- **mini_batch_size**: Size of batches taken from the replay memory for training.\n- **epsilon_max**: Initial value of ε for the ε-greedy policy, controlling exploration.\n- **epsilon_min**: Minimum value of ε after decay, determining the amount of exploration.\n- **epsilon_decay**: The factor by which ε is decreased during training.\n- **discount**: Discount factor for future rewards in the Q-learning update.\n- **capacity**: The capacity of the replay memory.\n- **n_eps**: Number of episodes to train over.\n- **update_freq**: Frequency (in steps) at which the target network is updated.\n- **show_every**: Frequency (in episodes) at which training episodes are rendered/visualized.\n- **render**: Boolean flag to turn on/off rendering of the trading environment.\n\n#### Trading Parameters\n- **tickers**: List of stock symbols to be used for trading simulations, e.g., [\"AAPL\", \"GOOGL\"].\n- **model_name**: A unique identifier for saving/loading trained models.\n- **fee**: Trading fee percentage used in simulations.\n- **trading_period**: Number of time steps each trading episode lasts.\n\n### Disclaimer:\nThis project was not intended for public use, as a result the degree of commenting and organization is likely horrible (non-existent). I will try and go through it ASAP to clean it up and make some improvements.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattjhawken%2Fdeep-rl-trading","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattjhawken%2Fdeep-rl-trading","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattjhawken%2Fdeep-rl-trading/lists"}