{"id":15898394,"url":"https://github.com/pppw/stock-portfolio-optimizer","last_synced_at":"2026-01-21T21:33:04.973Z","repository":{"id":35174337,"uuid":"146462834","full_name":"PPPW/stock-portfolio-optimizer","owner":"PPPW","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-08T02:47:43.000Z","size":3498,"stargazers_count":1,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-07T21:51:34.697Z","etag":null,"topics":["flask","scipy","vuejs","vuex"],"latest_commit_sha":null,"homepage":null,"language":"Vue","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/PPPW.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}},"created_at":"2018-08-28T14:50:13.000Z","updated_at":"2019-12-11T04:44:36.000Z","dependencies_parsed_at":"2023-01-15T15:20:56.941Z","dependency_job_id":null,"html_url":"https://github.com/PPPW/stock-portfolio-optimizer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PPPW/stock-portfolio-optimizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PPPW%2Fstock-portfolio-optimizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PPPW%2Fstock-portfolio-optimizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PPPW%2Fstock-portfolio-optimizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PPPW%2Fstock-portfolio-optimizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PPPW","download_url":"https://codeload.github.com/PPPW/stock-portfolio-optimizer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PPPW%2Fstock-portfolio-optimizer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28644076,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T21:29:11.980Z","status":"ssl_error","status_checked_at":"2026-01-21T21:24:31.872Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["flask","scipy","vuejs","vuex"],"created_at":"2024-10-06T10:03:05.483Z","updated_at":"2026-01-21T21:33:04.960Z","avatar_url":"https://github.com/PPPW.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stock Portfolio Optimizer: a Vue.js App Example\n\nThis web app optimizes your stock portfolio and displays the performance. To define your portfolio, you can select the date range, stock tickers and allocations. A pie chart shows the original stock allocations. The optimized allocations are calculated, the original and optimized portfolio performances are displayed as a line chart. All tables and charts will be updated if any changes are made, e.g., changing date, tickers, allocations. \n\nThis web app uses Vue.js as frontend, Flask as backend. \n\n## Demo\n\n![](images/demo.GIF)\n\n## Frontend \n\n### How to run\n\nThe frontend is created by running the official tool [Vue CLI 3](https://cli.vuejs.org/) under \"app/static/\":\n\n```sh\n$ vue vue-app\n```\n\nTo install dependencies, in \"app/static/vue-app\":\n\n```sh\n$ npm install\n```\n\nTo run for development, in \"app/static/vue-app\":\n\n```sh\n$ npm run serve\n```\n\nA frontend dev server with hot-reload will start. You also need to start the backend API server to handle requests. Because we have two servers in this case, requests to the backend API server will cause [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) error. This can be solved by setting [dev server proxy](https://vuejs-templates.github.io/webpack/proxy.html) to the URL of the backend server in `vue.config.js`. \n\nTo test, in \"app/static/vue-app\":\n\n```sh\n$ npm test\n```\n\nTo compile and minify for production, in \"app/static/vue-app\":\n\n```sh\n$ npm run build\n```\n\nAfter this, you can start the backend server to run the app. \n\n### The app structure\n\n`vue.config.js`: most of the configurations are set up by the Vue cli during app creation, this file contains additional configurations. Refer to [here](https://cli.vuejs.org/config/) for a complete list of options. \n\n`src/main.js`: creates the Vue instance, set up plugins. \n\n`src/App.vue`: the root component. It contains a dashboard on the left and a charting part on the right. \n\n`src/components/`: the single file components. \n\n`src/store/`: Vuex's states, mutations and actions. [Vuex](https://vuex.vuejs.org/) is used in here for state management. States contain data that can be shared between components. \n\n### Other libraries\n\n[Element UI](http://element-cn.eleme.io/#/en-US/) is used for the UI components, e.g., the date picker, the tab pane, etc. \n\n[vue-chartjs](https://vue-chartjs.org/) is used for chartting. Its reactive props make the charts reactive, i.e., charts will automatically reload when the associated data changes. \n\n\n## Backend\n\n### How to run \n\nThe backend is created from this template: \n\n[Flask-Web-App-Template](https://github.com/PPPW/Flask-Web-App-Template)\n\nTo install dependencies:\n```sh\n$ pip install -r requirements.txt\n```\n\nTo run:\n\n```sh\n$ python manage.py runserver\n```\n\nTo test:\n\n```sh\n$ python manage.py test\n```\n\nThe server API: \n\n```\n/api/opt : get portfolio performance and optimize. \n/api/ticker : check whether a ticker exist.\n/api/autocomplete : autocomplete a ticker using S\u0026P 500 (2017) tickers.\n/api/test : for testing the API\n```\n\nIf any other URLs are requested, the server will check whether the files exist, if so, it will serve the requested files. Otherwise, it will redirect to the index page (i.e., `static/vue-app/dist/index.html`, the built result of the frontend). \n\n### Portfolio optimization\n\nGiven a set of tickers and a date range, the optimized portfolio allocations are calculated by maximizing the Sharp ratio. `scipy.optimize.minimize` is used for optimization. \n\nThe stock data is obtained by `pandas_datareader`, the data source is \"quandl\" (\"yahoo\" and \"google\" not working now). \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpppw%2Fstock-portfolio-optimizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpppw%2Fstock-portfolio-optimizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpppw%2Fstock-portfolio-optimizer/lists"}