{"id":19501814,"url":"https://github.com/gregyjames/aiportfolio","last_synced_at":"2025-08-12T05:08:35.957Z","repository":{"id":38129721,"uuid":"363712125","full_name":"gregyjames/AIPortfolio","owner":"gregyjames","description":"Use AI to generate a optimized stock portfolio","archived":false,"fork":false,"pushed_at":"2023-02-16T06:34:41.000Z","size":58,"stargazers_count":46,"open_issues_count":6,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-25T23:34:38.690Z","etag":null,"topics":["finance","numpy","pandas","portfolio","python","python3","scikit-learn","stock","stock-market","stocks","yahoo"],"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/gregyjames.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":"2021-05-02T17:37:49.000Z","updated_at":"2025-02-20T02:14:10.000Z","dependencies_parsed_at":"2024-11-10T22:14:10.153Z","dependency_job_id":"119c25b4-67b9-4d73-8369-255506dbfc77","html_url":"https://github.com/gregyjames/AIPortfolio","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gregyjames/AIPortfolio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregyjames%2FAIPortfolio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregyjames%2FAIPortfolio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregyjames%2FAIPortfolio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregyjames%2FAIPortfolio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregyjames","download_url":"https://codeload.github.com/gregyjames/AIPortfolio/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregyjames%2FAIPortfolio/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270005591,"owners_count":24510939,"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-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["finance","numpy","pandas","portfolio","python","python3","scikit-learn","stock","stock-market","stocks","yahoo"],"created_at":"2024-11-10T22:14:06.732Z","updated_at":"2025-08-12T05:08:35.934Z","avatar_url":"https://github.com/gregyjames.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Python application](https://github.com/gregyjames/AIPortfolio/actions/workflows/python-app.yml/badge.svg?branch=main)](https://github.com/gregyjames/AIPortfolio/actions/workflows/python-app.yml)\n\n![Logo](https://i.imgur.com/955FRvs.png)\nUse AI, Modern Portfolio Theory, and Monte Carlo simulation's to generate a optimized stock portfolio that minimizes risk while maximizing returns.\n\n\n[TRY HERE](https://ancient-headland-77389.herokuapp.com/)\n\n\n## How does it work?\nThe app works by pulling the stock close data from the yahoo finance api. We then calculate the log returns and the volatility of the data to see what the overall trend for the stocks look like. We then generate random portfolio weights and use scipy to maximize a function that calculates the best portfolio weights for a portfolio with a maximum return to volatility ration (this is known as the [Sharpe ratio](https://en.wikipedia.org/wiki/Sharpe_ratio)). This is effectively a Monte Carlo simulation to find the optimal stock portfolio.\n\n\n## Resources and Readings\n\n- [Why Log Returns](https://quantivity.wordpress.com/2011/02/21/why-log-returns/)\n- [Sharpe Ratio](https://www.investopedia.com/terms/s/sharperatio.asp)\n- [Efficient Frontier](https://www.investopedia.com/terms/e/efficientfrontier.asp)\n- [Markowitz Modern Portfolio Theory](https://www.investopedia.com/terms/m/modernportfoliotheory.asp)\n- [Monte Carlo Simulation](https://www.investopedia.com/terms/m/montecarlosimulation.asp)\n- [Volatility](https://www.investopedia.com/terms/v/volatility.asp)\n\n\n## License\nMIT License\n\nCopyright (c) 2021 Greg James\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n## DISCLAIMER\nThis project and it's generated portfolios are NOT investment advice. This is purely educational.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregyjames%2Faiportfolio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregyjames%2Faiportfolio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregyjames%2Faiportfolio/lists"}