{"id":39698059,"url":"https://github.com/andleb/derivatives","last_synced_at":"2026-01-18T10:18:46.850Z","repository":{"id":126954771,"uuid":"168835005","full_name":"andleb/derivatives","owner":"andleb","description":"Derivatives pricing in modern C++.","archived":false,"fork":false,"pushed_at":"2022-08-22T16:10:28.000Z","size":2747,"stargazers_count":16,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-09T06:42:20.763Z","etag":null,"topics":["derivatives","derivatives-pricing","finance","monte-carlo","quantitative-finance","trees"],"latest_commit_sha":null,"homepage":"","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/andleb.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-02-02T13:33:37.000Z","updated_at":"2025-08-12T16:15:14.000Z","dependencies_parsed_at":"2023-06-19T06:04:17.467Z","dependency_job_id":null,"html_url":"https://github.com/andleb/derivatives","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/andleb/derivatives","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andleb%2Fderivatives","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andleb%2Fderivatives/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andleb%2Fderivatives/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andleb%2Fderivatives/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andleb","download_url":"https://codeload.github.com/andleb/derivatives/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andleb%2Fderivatives/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28534316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T10:13:46.436Z","status":"ssl_error","status_checked_at":"2026-01-18T10:13:11.045Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["derivatives","derivatives-pricing","finance","monte-carlo","quantitative-finance","trees"],"created_at":"2026-01-18T10:18:46.518Z","updated_at":"2026-01-18T10:18:46.820Z","avatar_url":"https://github.com/andleb.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# derivatives\nBased on [M. Joshi's C++ Design Patterns and Derivatives Pricing](https://www.amazon.com/gp/product/0521721628) (a practical companion to his [Concepts and Practice of Mathematical Finance](https://www.amazon.com/gp/product/0521514088)), making use of updated paradigms wherever possible. \n\n*C++17* strongly recommended.\n\n## Dependencies \u0026 installation\n[*cmake*](https://github.com/andleb/cmake) repository for the *CMake* scripts; included as a **submodule**.\n\n[*common*](https://github.com/andleb/common) repository for utility classes \u0026 functions.\n\nThe project is built via *CMake*. One can, of course, modify the *CMake* configuration at will or use one's own.\nThe documentation is to be built with *Doxygen* from the provided *doxyfile*.\n\n## Overview\nThe project roughly follows the second edition of the aforementioned book, which was published in 2008. While the numerics and mathematics haven't changed, *C++* has gone through quite a bit of a revolution in the time since. Due to this fact, the original book includes some now archaic elements, such as a self-implemented smart pointer. All such were replaced with their modern equivalents. Some chapters do not correspond to a concrete problem and have been excluded; in others, the sub-problems have often been consolidated/handled in a more generic way.\n\nThe code itself is separated into two directories:\n * **src**: the library itself - this contains all the actual relevant code\n * **mains**: auxiliary driver/playground code - this merely calls the above for some toy examples\n\nThe *mains* correspond to each relevant chapter. Take a look at the list of includes corresponding to each executable in *CMakeLists.txt*, to follow along with the development of the library as the book progresses. \n\n\n#### Ch. 1 - 5:\nThese perform *Monte-Carlo* pricing of various derivatives, with an increasing degree of software architecture.\n\n#### Ch. 6:\nThis chapter implements custom random number generators and integrates them with the architecture developed in preceding chapters.\n\n#### Ch. 7:\nDeals with the pricing of exotic, more specifically, path-dependent, options via *Monte-Carlo* using all the preceding infrastructure.\n\n#### Ch. 8:\nSwitches gears and introduces pricing on *trees* (or *lattices*). For this, I have developed a helper static recombinant tree class that is found in the [*common*](https://github.com/andleb/common) repository (see above). This allows us to price early-exercise options.\n\n#### Ch. 9:\nDeals with the concept of *implied volatility* and introduces two simple numerical root-finding routines.\n\n#### Ch. 10, 14:\nIntroduce the factory pattern \u0026 apply it to the existing architecture. The latter improves on the former by making the factory completely generic.\n\n#### Final\nAs an exercise, I added pricing on trinomial trees. In the future, I might add low-level parallelization as an additional feature (c.f. the *barrier* class in *common*).\n\n\nNOTE: I have stayed away from *C*-like input/output parameters and have replaced them with *rvalue* reference inputs that get moved into, modified in place, and returned by value (moved out). I feel that this syntax is clearer and also mirrors the approach popular *Python* numerics packages, such as *Pandas*, are taking with regards to in-place modification. There is also the added benefit of zero additional performance costs, afforded to us by modern *C++*.\n\n\n## Acknowledgments\nDr. Mark Joshi (RIP)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandleb%2Fderivatives","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandleb%2Fderivatives","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandleb%2Fderivatives/lists"}