{"id":13415633,"url":"https://github.com/cantaro86/Financial-Models-Numerical-Methods","last_synced_at":"2025-03-14T23:30:59.005Z","repository":{"id":40625886,"uuid":"207623149","full_name":"cantaro86/Financial-Models-Numerical-Methods","owner":"cantaro86","description":"Collection of notebooks about quantitative finance, with interactive python code.","archived":false,"fork":false,"pushed_at":"2024-10-22T08:53:04.000Z","size":24402,"stargazers_count":5768,"open_issues_count":6,"forks_count":1035,"subscribers_count":146,"default_branch":"master","last_synced_at":"2025-03-11T22:03:23.694Z","etag":null,"topics":["american-options","brownian-motion","econometrics","financial-engineering","financial-mathematics","fourier-inversion","heston-model","jump-diffusion-mertons-model","jupyter-notebooks","kalman-filter","levy-processes","linear-regression","linear-systems-equations","monte-carlo-methods","option-pricing","partial-differential-equations","python","quantitative-finance","stochastic-differential-equations","stochastic-processes"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cantaro86.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"cantaro86","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2019-09-10T17:35:01.000Z","updated_at":"2025-03-11T17:05:48.000Z","dependencies_parsed_at":"2022-07-16T02:00:34.341Z","dependency_job_id":"1e167859-785c-4b4a-9860-9b79d3a996d4","html_url":"https://github.com/cantaro86/Financial-Models-Numerical-Methods","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cantaro86%2FFinancial-Models-Numerical-Methods","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cantaro86%2FFinancial-Models-Numerical-Methods/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cantaro86%2FFinancial-Models-Numerical-Methods/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cantaro86%2FFinancial-Models-Numerical-Methods/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cantaro86","download_url":"https://codeload.github.com/cantaro86/Financial-Models-Numerical-Methods/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243663353,"owners_count":20327299,"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","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":["american-options","brownian-motion","econometrics","financial-engineering","financial-mathematics","fourier-inversion","heston-model","jump-diffusion-mertons-model","jupyter-notebooks","kalman-filter","levy-processes","linear-regression","linear-systems-equations","monte-carlo-methods","option-pricing","partial-differential-equations","python","quantitative-finance","stochastic-differential-equations","stochastic-processes"],"created_at":"2024-07-30T21:00:50.928Z","updated_at":"2025-03-14T23:30:58.993Z","avatar_url":"https://github.com/cantaro86.png","language":"Jupyter Notebook","readme":"Financial-Models-Numerical-Methods \n==================================\n\n\nThis is a collection of [Jupyter notebooks](https://jupyter.org/) based on different topics in the area of quantitative finance.\n\n\n### Is this a tutorial?\n\nAlmost! :) \n\nThis is just a collection of topics and algorithms that in my opinion are interesting.     \n\nIt contains several topics that are not so popular nowadays, but that can be very powerful. \nUsually, topics such as PDE methods, Lévy processes, Fourier methods or Kalman filter are not very popular among practitioners, who prefers to work with more standard tools.     \nThe aim of these notebooks is to present these interesting topics, by showing their practical application through an interactive python implementation.\n\n\n### Who are these notebooks for?\n\nNot for absolute beginners. \n\nThese topics require a basic knowledge in stochastic calculus, financial mathematics and statistics. A basic knowledge of python programming is also necessary.\n\nIn these notebooks I will not explain what is a call option, or what is a stochastic process, or a partial differential equation.     \nHowever, every time I will introduce a concept, I will also add a link to the corresponding wiki page or to a reference manual.\nIn this way, the reader will be able to immediately understand what I am talking about. \n\nThese notes are for students in science, economics or finance who have followed at least one undergraduate course in financial mathematics and statistics.       \nSelf-taught students or practicioners should have read at least an introductiory book on financial mathematics. \n\n\n### Why is it worth to read these notes?  \n\nFirst of all, this is not a book!      \nEvery notebook is (almost) independent from the others. Therefore you can select only the notebook you are interested in!\n\n```diff\n- Every notebook contains python code ready to use!     \n```\n\nIt is not easy to find on internet examples of financial models implemented in python which are ready to use and well documented.    \nI think that beginners in quantitative finance will find these notebooks very useful!  \n\nMoreover, Jupyter notebooks are interactive i.e. you can run the code inside the notebook. \nThis is probably the best way to study!\n\nIf you open a notebook with Github or [NBviewer](https://nbviewer.ipython.org), sometimes mathematical formulas are not displayed correctly. \nFor this reason, I suggest you to clone/download the repository. \n\n\n### Is this series of notebooks complete?\n\n**No!**    \nI will upload more notebooks from time to time. \n\nAt the moment, I'm interested in the areas of stochastic processes, Kalman Filter, statistics and much more. I will add more interesting notebooks on these topics in the future. \n\nIf you have any kind of questions, or if you find some errors, or you have suggestions for improvements, feel free to contact me.      \n\n\n\n### Contents\n\n1.1) **Black-Scholes numerical methods**\n*(lognormal distribution, change of measure, Monte Carlo, Binomial method)*.\n\n1.2) **SDE simulation and statistics**\n*(paths generation, Confidence intervals, Hypothesys testing, Geometric Brownian motion, Cox-Ingersoll-Ross process, Euler Maruyama method, parameters estimation)*\n\n1.3) **Fourier inversion methods**\n*(inversion formula, numerical inversion, option pricing, FFT, Lewis formula)*\n\n1.4) **SDE, Heston model**\n*(correlated Brownian motions, Heston paths, Heston distribution, characteristic function, option pricing)*\n\n1.5) **SDE, Lévy processes** \n*(Merton, Variance Gamma, NIG, path generation, parameter estimation)*\n\n2.1) **The Black-Scholes PDE** \n*(PDE discretization, Implicit method, sparse matrix tutorial)*\n\n2.2) **Exotic options**\n*(Binary options, Barrier options, Asian options)*\n\n2.3) **American options**\n*(PDE, Early exercise, Binomial method, Longstaff-Schwartz, Perpetual put)*\n\n3.1) **Merton Jump-Diffusion PIDE**\n*(Implicit-Explicit discretization, discrete convolution, model limitations, Monte Carlo, Fourier inversion, semi-closed formula )*\n\n3.2) **Variance Gamma PIDE**\n*(approximated jump-diffusion PIDE, Monte Carlo, Fourier inversion, Comparison with Black-Scholes)*\n\n3.3) **Normal Inverse Gaussian PIDE** \n*(approximated jump-diffusion PIDE, Monte Carlo, Fourier inversion, properties of the Lévy measure)*\n\n4.1) **Pricing with transaction costs** \n*(Davis-Panas-Zariphopoulou model, singular control problem, HJB variational inequality, indifference pricing, binomial tree, performances)*\n\n4.2) **Volatility smile and model calibration**\n*(Volatility smile, root finder methods, calibration methods)*\n\n5.1) **Linear regression and Kalman filter** \n*(market data cleaning, Linear regression methods, Kalman filter design, choice of parameters)*\n\n5.2) **Kalman auto-correlation tracking - AR(1) process** \n*(Autoregressive process, estimation methods, Kalman filter, Kalman smoother, variable autocorrelation tracking)*\n\n5.3) **Volatility tracking** \n*(Heston simulation, hypothesis testing, distribution fitting, estimation methods, GARCH(1,1), Kalman filter, Kalman smoother)*\n\n6.1) **Ornstein-Uhlenbeck process and applications**\n*(parameters estimation, hitting time, Vasicek PDE, Kalman filter, trading strategy)*\n\n7.1) **Classical MVO**\n*(mean variance optimization, quadratic programming, only long and long-short, closed formula)*\n\nA.1) **Appendix: Linear equations** \n*(LU, Jacobi, Gauss-Seidel, SOR, Thomas)*\n  \nA.2) **Appendix: Code optimization** \n*(cython, C code)*\n\nA.3) **Appendix: Review of Lévy processes theory**\n*(basic and important definitions, derivation of the pricing PIDE)*\n\n\n\n## How to run the notebooks \n\n\n**Virtual environment:**\n\nHere I explain how to create a virtual environment with [Anaconda](https://www.anaconda.com/distribution/) and with the python module [venv](https://docs.python.org/3.7/tutorial/venv.html). \n\n- Option 1:\n\nYou can recreate my tested conda virtual environment with:\n\n```bash\nconda env create -f environment.yml\npip install -e .\n```\n\nThe first line recreates the virtual environment and installs all the packages.    \nWith the second line we just install the local package `FMNM`.\n\n- Option 2:\n\nIf you want to create a new environment with the latest python version, you can do: \n\n```bash\nconda create -n FMNM python\nconda activate FMNM\nPACKAGES=$(tr '\\n' ' ' \u003c list_of_packages.txt | sed \"s/arch/arch-py/g\")\nconda install ${PACKAGES[@]}\npip install -e .\n```\n\nwhere in the third line we replace the package name `arch` with the `arch-py`, which is the name used by conda.   \n\n- Option 3:\n\nIf you prefer to create a `venv` that uses python 3.11.4, you can do it as follows:\n\n```bash\npython3.11.4 -m venv --prompt FMNM python-venv\nsource python-venv/bin/activate\npython3 -m pip install --upgrade pip\npip install --requirement requirements.txt\npip install -e .\n```\n\n- Option 4:\n\nIf you prefer to use the python version already installed in your system, you just need to run     \n\n```bash\npip install --requirement list_of_packages.txt\npip install -e .\n```     \n\nand then enter in the shell `jupyter-notebook` or `jupyter-lab`:\n\n\nHowever, if you are using old versions, there could be compatibility problems.\n\n**Docker:**\n\nHere we run the notebooks with jupyterlab:\n\n- Option 1:\n\nYou can use docker-compose to build a container:\n\n```bash\ndocker-compose up --build -d\n```\n\nAnd then stop the container with\n\n```bash\ndocker-compose down\n```\n\nAnd open the browser at `http://localhost:8888/lab`\n\n- Option 2:\n\nAlternatively, you can\n\n```bash\ndocker build -t fmnm .\ndocker run --rm -d -p 8888:8888 --name Numeric_Finance fmnm\n```\n\n### Enjoy!","funding_links":["https://github.com/sponsors/cantaro86"],"categories":["Jupyter Notebook","金融股票"],"sub_categories":["网络服务_其他"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcantaro86%2FFinancial-Models-Numerical-Methods","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcantaro86%2FFinancial-Models-Numerical-Methods","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcantaro86%2FFinancial-Models-Numerical-Methods/lists"}