{"id":16105583,"url":"https://github.com/charlesyuan02/reinforcement-learning-stock-trader","last_synced_at":"2026-05-17T09:31:42.947Z","repository":{"id":222214225,"uuid":"611874964","full_name":"CharlesYuan02/reinforcement-learning-stock-trader","owner":"CharlesYuan02","description":"A reinforcement learning stock trader for the S\u0026P 500. ","archived":false,"fork":false,"pushed_at":"2023-04-16T01:29:38.000Z","size":555164,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-31T13:33:13.954Z","etag":null,"topics":["deep-reinforcement-learning","openai-gym","reinforcement-learning","stock-trading","yahoo-finance"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CharlesYuan02.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-03-09T18:09:48.000Z","updated_at":"2023-09-28T00:55:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"879cf0cb-110c-4c6b-8f28-f011f3e1eced","html_url":"https://github.com/CharlesYuan02/reinforcement-learning-stock-trader","commit_stats":null,"previous_names":["chubbyman2/reinforcement-learning-stock-trader","charlesyuan02/reinforcement-learning-stock-trader"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CharlesYuan02/reinforcement-learning-stock-trader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesYuan02%2Freinforcement-learning-stock-trader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesYuan02%2Freinforcement-learning-stock-trader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesYuan02%2Freinforcement-learning-stock-trader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesYuan02%2Freinforcement-learning-stock-trader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CharlesYuan02","download_url":"https://codeload.github.com/CharlesYuan02/reinforcement-learning-stock-trader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesYuan02%2Freinforcement-learning-stock-trader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33133482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T09:28:26.183Z","status":"ssl_error","status_checked_at":"2026-05-17T09:27:52.702Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-reinforcement-learning","openai-gym","reinforcement-learning","stock-trading","yahoo-finance"],"created_at":"2024-10-09T19:10:05.180Z","updated_at":"2026-05-17T09:31:42.926Z","avatar_url":"https://github.com/CharlesYuan02.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# reinforcement-learning-stock-trader\n\u003cimg src=\"https://compote.slate.com/images/926e5009-c10a-48fe-b90e-fa0760f82fcd.png?width=1200\u0026rect=680x453\u0026offset=0x30\"\u003e\n\n## Prerequisites\nAll code was written in Python 3.10. Please see \u003ca href=\"https://github.com/Chubbyman2/reinforcement-learning-stock-trader/blob/main/requirements.txt\"\u003erequirements.txt\u003c/a\u003e for dependencies.\n```\ngym==0.26.2\ngym-anytrading==1.3.2\npandas-datareader==0.10.0\nscipy==1.10.1\nstable_baselines3==1.8.0\ntensorflow\u003e=2.11.0\ntqdm==4.65.0\nyfinance==0.2.12\n```\n\n## Description of Files\n### \u003ca href=\"https://github.com/Chubbyman2/reinforcement-learning-stock-trader/blob/main/data_extractor.py\"\u003edata_extractor.py\u003c/a\u003e\nThis file contains all the code used to extract the list of stocks on the S\u0026P 500 and their respective financial data. It also contains a dataloader function for loading the correct data in the training scripts. See doc strings for details.\n\n### \u003ca href=\"https://github.com/Chubbyman2/reinforcement-learning-stock-trader/blob/main/single_feature_model.py\"\u003esingle_feature_model.py\u003c/a\u003e and \u003ca href=\"https://github.com/Chubbyman2/reinforcement-learning-stock-trader/blob/main/multi_feature_model.py\"\u003emulti_feature_model.py\u003c/a\u003e\nThis is where the deep Q-learning models are defined, along with the trade and batch_train methods used in the training scripts. The single feature model only takes in the closing price as a feature, while the multi-feature model takes in as many features as is defined in the training script. Modifications were made accordingly to the multi-feature model methods.\n\n### \u003ca href=\"https://github.com/Chubbyman2/reinforcement-learning-stock-trader/blob/main/train_single_feature.py\"\u003etrain_single_feature.py\u003c/a\u003e and \u003ca href=\"https://github.com/Chubbyman2/reinforcement-learning-stock-trader/blob/main/train_multi_feature.py\"\u003etrain_multi_feature.py\u003c/a\u003e\nThis is where the training for the model actually happens. Note that for the multi-feature model's training, we defined the function to allow for multiple stocks to be used, as a further improvement on the single-feature training.\n\n## Description of Files - Post-Interim Report\n### \u003ca href=\"https://github.com/Chubbyman2/reinforcement-learning-stock-trader/blob/main/custom_environment.py\"\u003ecustom_environment.py\u003c/a\u003e and \u003ca href=\"https://github.com/Chubbyman2/reinforcement-learning-stock-trader/blob/main/custom_environment_multistock.py\"\u003ecustom_environment_multistock.py\u003c/a\u003e\nImplementations of training environments with continuous action spaces. Both follow the format that OpenAI Gym uses, and are compatible with the off-the-shelf models A2C and PPO obtained from stable baselines. \n\n### \u003ca href=\"https://github.com/Chubbyman2/reinforcement-learning-stock-trader/blob/main/train_single_stock.py\"\u003etrain_single_stock.py\u003c/a\u003e and \u003ca href=\"https://github.com/Chubbyman2/reinforcement-learning-stock-trader/blob/main/train_multi_stock.py\"\u003etrain_multi_stock.py\u003c/a\u003e\nThe training and evaluation code for A2C and PPO, leveraging our custom environments. One is used for training on one stock at at time, while the other is used for a portfolio of multiple stocks. \n\n## License\nThis project is licensed under the MIT License - see the \u003ca href=\"https://github.com/Chubbyman2/reinforcement-learning-stock-trader/blob/main/LICENSE\"\u003eLICENSE\u003c/a\u003e file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlesyuan02%2Freinforcement-learning-stock-trader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharlesyuan02%2Freinforcement-learning-stock-trader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlesyuan02%2Freinforcement-learning-stock-trader/lists"}