{ "info": { "author": "Gautier Pialat", "author_email": "g.pialat@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Financial and Insurance Industry", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.7", "Topic :: Office/Business :: Financial" ], "description": "[![PyPI status](https://img.shields.io/pypi/status/ansicolortags.svg)](https://pypi.python.org/pypi/ansicolortags/)\n[![Build Status](https://travis-ci.org/gaugau3000/mc_sim_fin.svg?branch=master)](https://travis-ci.com/gaugau3000/mc_sim_fin)\n[![codecov](https://codecov.io/gh/gaugau3000/mc_sim_fin/branch/master/graph/badge.svg)](https://codecov.io/gh/gaugau3000/mc_sim_fin)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/37f78d31316241e4b97126c340975652)](https://www.codacy.com/manual/gaugau3000/mc_sim_fin?utm_source=github.com&utm_medium=referral&utm_content=gaugau3000/mc_sim_fin&utm_campaign=Badge_Grade)\n[![Maintainability](https://api.codeclimate.com/v1/badges/5aeaf6091ec31dd12b60/maintainability)](https://codeclimate.com/github/gaugau3000/mc_sim_fin/maintainability)\n[![PyPI](https://img.shields.io/pypi/v/mc-sim-fin)](https://pypi.org/project/mc-sim-fin/)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/gaugau3000/mc_sim_fin/graphs/commit-activity)\n[![PyPI license](https://img.shields.io/pypi/l/ansicolortags.svg)](https://pypi.python.org/pypi/ansicolortags/)\n\n# Montecarlo simulations/analysis for finance (equity simulator)\n\nAn inspiration of the book [BUILDING WINNING ALGORITHMIC TRADING SYSTEMS](https://www.amazon.com/Building-Winning-Algorithmic-Trading-Systems/dp/1118778987) of 'Kevin J. Davey' (chapter 7 detailed analysis)\n\nWhat's happened if your trades happened in an other order and you iterate many times to extract statistics ? What are your chances to be ruin ? What's max drawdown you may met ?\n\nPass the trade results to the library and it will help you to manage the risk.\n\nCAUTION : The simulator include assumption that your trades are independent one of the others (you use a durbin watson statistic from [statsmodels library](https://www.statsmodels.org/dev/generated/statsmodels.stats.stattools.durbin_watson.html) to see that)\n\n## Installation\n\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install montecarlo simulation finance.\n\n```bash\npip install mc-sim-fin\n```\n\n## Usage\n\nFor the code example below you have 5000 dollar for trading, you stop trading if you capital go below 4000. Your backtest results show that you bot make one trade per day and alternate a win trade of 200 then a lose trade of 150 during the 2017 year.\n\nBy default it simulate 1 year of trading with 10000 iterations (look at the documentation to modify this params).\n\n```python\nimport pandas as pd\nimport numpy as np\nfrom mc_sim_fin.mc import mc_analysis\n\n\ndate_results = pd.date_range(start='1/1/2017', end='31/12/2017').tolist()\nprofit_results = np.resize([200, -150], 365)\n\nresults = pd.DataFrame({'date_results': date_results, 'profit_results': profit_results})\n\nmc_sims_results = mc_analysis(results, start_equity=5000, ruin_equity=4000)\n\n\nprint(mc_sims_results)\n\n# print output\n{\n'risk_of_ruin_percent': 0.156,\n'med_max_drawdown_percent': 0.36,\n'med_profit_percent': 1.83,\n'prob_profit_is_positive': 0.9979\n}\n\n```\n\nOk so seems like I have 15.6% changes to be ruin, I can expect 36% max drawdown and 183% profit and I have 99.79% change to win money the first year.\n\n## Documentation\n\nYou need more information about how the simulation work? You would like to contribute ?\n\nLook at the [documentation](https://gaugau3000.github.io/mc_sim_fin/)\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/gaugau3000/montecarlo_simulation_finance", "keywords": "finance montecarlo simulations backtest risk management", "license": "", "maintainer": "", "maintainer_email": "", "name": "mc-sim-fin", "package_url": "https://pypi.org/project/mc-sim-fin/", "platform": "", "project_url": "https://pypi.org/project/mc-sim-fin/", "project_urls": { "Homepage": "https://github.com/gaugau3000/montecarlo_simulation_finance" }, "release_url": "https://pypi.org/project/mc-sim-fin/0.1.1b2/", "requires_dist": null, "requires_python": ">=3.7, <4", "summary": "montecarlo simulations/analysis library for finance", "version": "0.1.1b2" }, "last_serial": 5956275, "releases": { "0.1.1b1": [ { "comment_text": "", "digests": { "md5": "1decf5739850f2d13b8e89a5178a9920", "sha256": "f72588b7730b0cfd989cd5b1a0014ace9fc25eca98aa22b180448c649cdbffa4" }, "downloads": -1, "filename": "mc-sim-fin-0.1.1b1.tar.gz", "has_sig": false, "md5_digest": "1decf5739850f2d13b8e89a5178a9920", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7, <4", "size": 6709, "upload_time": "2019-10-08T15:46:53", "url": "https://files.pythonhosted.org/packages/3f/11/68400e9f9045f29098585af3e2e2a277b12db9f3f002f1eab760e5cfccf8/mc-sim-fin-0.1.1b1.tar.gz" } ], "0.1.1b2": [ { "comment_text": "", "digests": { "md5": "741e5b5f8bee920a07c57de0818ee476", "sha256": "c7af3f99c06484e3bf151975d73138ed601babdd8e30e6a4fdcb66e622861298" }, "downloads": -1, "filename": "mc-sim-fin-0.1.1b2.tar.gz", "has_sig": false, "md5_digest": "741e5b5f8bee920a07c57de0818ee476", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7, <4", "size": 7324, "upload_time": "2019-10-10T18:38:38", "url": "https://files.pythonhosted.org/packages/97/b7/3ec12cdc93d8a583c3bf1933877f4cb59f36a16c945b8986df39493b8a03/mc-sim-fin-0.1.1b2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "741e5b5f8bee920a07c57de0818ee476", "sha256": "c7af3f99c06484e3bf151975d73138ed601babdd8e30e6a4fdcb66e622861298" }, "downloads": -1, "filename": "mc-sim-fin-0.1.1b2.tar.gz", "has_sig": false, "md5_digest": "741e5b5f8bee920a07c57de0818ee476", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7, <4", "size": 7324, "upload_time": "2019-10-10T18:38:38", "url": "https://files.pythonhosted.org/packages/97/b7/3ec12cdc93d8a583c3bf1933877f4cb59f36a16c945b8986df39493b8a03/mc-sim-fin-0.1.1b2.tar.gz" } ] }