{"id":16391415,"url":"https://github.com/karelze/mc-var-sim","last_synced_at":"2025-09-24T02:15:51.417Z","repository":{"id":96678792,"uuid":"125202791","full_name":"KarelZe/MC-VAR-Sim","owner":"KarelZe","description":"Monte Carlo Sim of a stock portfolio using c++ AMP","archived":false,"fork":false,"pushed_at":"2018-05-01T18:16:05.000Z","size":5072,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-14T19:09:57.042Z","etag":null,"topics":["amp","cmp202","risk","sim","stock-portfolio"],"latest_commit_sha":null,"homepage":null,"language":"C++","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/KarelZe.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":"2018-03-14T11:31:59.000Z","updated_at":"2018-05-01T18:16:07.000Z","dependencies_parsed_at":"2023-04-11T15:46:23.058Z","dependency_job_id":null,"html_url":"https://github.com/KarelZe/MC-VAR-Sim","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/KarelZe/MC-VAR-Sim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarelZe%2FMC-VAR-Sim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarelZe%2FMC-VAR-Sim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarelZe%2FMC-VAR-Sim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarelZe%2FMC-VAR-Sim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KarelZe","download_url":"https://codeload.github.com/KarelZe/MC-VAR-Sim/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarelZe%2FMC-VAR-Sim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276678995,"owners_count":25684831,"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-09-24T02:00:09.776Z","response_time":97,"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":["amp","cmp202","risk","sim","stock-portfolio"],"created_at":"2024-10-11T04:46:03.074Z","updated_at":"2025-09-24T02:15:51.384Z","avatar_url":"https://github.com/KarelZe.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# MC Sim\nThis Visual Studio project is my coursework for ```CMP 202``` at Abertay University, Scotland.\n\n## underlying concept\nUsing a Value at Risk approach we try to make a statement similar to this:\nI am X percent certain there will not be a loss of more than V dollars in the next N days. (Hull, 2012)\nSo X is the confidence level, where V is the loss and n is the holding period.\n```\ndS = μ S dt + σ S ds\n\nS = stock price\nμ = exp. return\nσ = volatility\n```\n## approach\n```\nrepeat n times\n  repeat t times\n    generate normal distributed number\n    update end price\n  save end price to path array  \nextract the 0th quantile\nprint results\n```\n## boundary\n- Assuming a stock without dividend payments\n- single stock portfolio\n- using C++ AMP\n- extents that don't require padding\n- optimized for a NVIDIA GeForce 940MX\n\n## dependencies\n- Commandline parsing is handled through [TCLAP](http://tclap.sourceforge.net/)\n- Concurrency Visualizer Marker through [Visual Studio Extension](https://marketplace.visualstudio.com/items?itemName=Diagnostics.ConcurrencyVisualizer2017)\n- Random number generation through [amprng](https://archive.codeplex.com/?p=amprng)\n\n## usage\nUsing the program is simple:\n```\ncd path\nREM access help for explanation on cl arguments\nC:\\path\u003eConsoleApplication3 --help\nREM sample usage of calculation with a tile size of 16 and 512k paths\nC:\\path\u003eConsoleApplication3 -x 16 -p 524288 -i 10 -r 0.05 -v 0.04 -d 300 -t 300\n```\nsample output:\n![sample output](./img/screenshot.jpg)\n\n## Todos\n- [x] Prepare proposal\n- [x] Implement MC kernel\n- [x] Implement path array to value at risk functionality\n- [x] Optimize memory access, ~~loop unrolling~~ etc.\n- [x] measure performance\n- [x] Prepare presentation\n- [ ] Enhance to a multi stock portfolio (optional)\n- [ ] Download historical data from quandl (optional)\n- [ ] Calculate volatility using EWMA method (optional)\n## Contact\nFeel free to send me a  [mail](mailto:1705042@abertay.ac.uk)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarelze%2Fmc-var-sim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarelze%2Fmc-var-sim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarelze%2Fmc-var-sim/lists"}