{"id":13499877,"url":"https://github.com/boundedvariation/quantfin","last_synced_at":"2026-02-22T05:35:34.329Z","repository":{"id":27890541,"uuid":"31382033","full_name":"boundedvariation/quantfin","owner":"boundedvariation","description":"quant finance in pure haskell","archived":false,"fork":false,"pushed_at":"2019-04-06T10:30:31.000Z","size":128,"stargazers_count":138,"open_issues_count":0,"forks_count":12,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-12-08T11:36:24.644Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boundedvariation.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}},"created_at":"2015-02-26T18:30:02.000Z","updated_at":"2025-09-21T21:41:58.000Z","dependencies_parsed_at":"2022-08-20T22:00:48.435Z","dependency_job_id":null,"html_url":"https://github.com/boundedvariation/quantfin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/boundedvariation/quantfin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boundedvariation%2Fquantfin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boundedvariation%2Fquantfin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boundedvariation%2Fquantfin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boundedvariation%2Fquantfin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boundedvariation","download_url":"https://codeload.github.com/boundedvariation/quantfin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boundedvariation%2Fquantfin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29705536,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T03:17:42.375Z","status":"ssl_error","status_checked_at":"2026-02-22T03:17:31.622Z","response_time":110,"last_error":"SSL_read: 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":[],"created_at":"2024-07-31T22:00:45.323Z","updated_at":"2026-02-22T05:35:34.313Z","avatar_url":"https://github.com/boundedvariation.png","language":"Haskell","funding_links":[],"categories":["Haskell"],"sub_categories":["Data Visualization"],"readme":"# quantfin\nQuant Finance in Pure Haskell.\n\nInitially I'm focusing on a Monte Carlo engine, but plenty more to come.\n\n```haskell\n\n\nimport Quant.Time\nimport Data.Monoid\nimport Quant.MonteCarlo\nimport Quant.YieldCurve\nimport Quant.ContingentClaim\nimport Quant.Models.Black\nimport Quant.Models.Heston\n\n--create a flat yield curve with a 5% rate\nbaseYC :: FlatCurve\nbaseYC = FlatCurve 0.05 \n\nblack :: Black\nblack = Black \n\t\t\t100     --initial stock price\n\t\t\t0.2     --volatility\n\t\t\tbaseYC  --forward generator\n\t\t\tbaseYC  --discount function\n\n--make a vanilla put, struck at 100, maturing at time 1\nvanopt :: ContingentClaim1\nvanopt = vanillaOption Call 100 (Time 1) --built in function\n\nvanopt' :: ContingentClaim1\nvanopt' = specify $ do\n\tx \u003c- monitor (Time 1)\n\treturn $ CashFlow (Time 1) (max (x - 100) 0) --roll your own\n\n--Run a Monte Carlo on opt in a a black model with 10000 trials\nvanoptPrice :: Double\nvanoptPrice = quickSim black vanopt 100000 \n\nvanoptPrice' :: Double\nvanoptPrice' = quickSim black vanopt' 100000 \n\n\n--Make a call spread with a 100 unit notional, using some handy combinators.\ncs :: ContingentClaim1\ncs =  multiplier 100 \n   $  vanillaOption Call 100 (Time 1) \n   \u003c\u003e short (vanillaOption Call 120 (Time 1)) \n\n--Run a Monte Carlo on the call spread; use antithetic variates\ncsPrice :: Double\ncsPrice = quickSim black' cs 100000 \n\nblack' :: Black\nblack' = Black \n\t\t\t100     --initial stock price\n\t\t\t0.2     --volatility\n\t\t\t(NetYC (FlatCurve 0.05) (FlatCurve 0.02))  --forward generator, now with a 2% dividend yield\n\t\t\tbaseYC  --discount rate\n\ncallSpreadAnti :: Double\ncallSpreadAnti = quickSimAnti black' cs 100000\n\n--Let's try it with a Heston model\nheston :: Heston\nheston = Heston\n\t\t100\n\t\t0.04       --initial variance\n\t\t0.04       --final variance\n\t\t0.2        --volvol\n\t\t(-0.7)     --correlation between processes\n\t\t1.0        --mean reversion speed\n\t\tbaseYC     --forward generator\n\t\tbaseYC     --discount function\n\n--price the call spread in the Heston model\ncsHeston :: Double\ncsHeston = quickSimAnti heston cs 100000\n\n--create an option that pays off based on the square of its underlying\nsquareOpt :: ContingentClaim1\nsquareOpt = terminalOnly (Time 1) $ \\x -\u003e x*x  --using the built in function\n\nsquareOpt' :: ContingentClaim1\nsquareOpt' = specify $ do --roll your own\n\tx \u003c- monitor (Time 1)\n\treturn $ CashFlow (Time 1) $ x*x\nsquareOptPrice :: Double\nsquareOptPrice = quickSimAnti black squareOpt 100000\n\nsquareOptPrice' :: Double\nsquareOptPrice' = quickSimAnti black squareOpt' 100000\n\n\n--create an option with a bizarre payoff\nbizarre :: ContingentClaim1\nbizarre = specify $ do\n  x \u003c- monitor (Time 1)   --check the price of asset 0 @ time 1\n  y \u003c- monitor (Time 2)   --check the price of asset 0 @ time 2\n  z \u003c- monitor (Time 3)   --check the price of asset 0 @ time 3\n  return $ CashFlow (Time 4) $ sin x * cos y / (z ** sin x) --payoff @ time 4\nbizarrePrice :: Double\nbizarrePrice = quickSimAnti black bizarre 100000\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboundedvariation%2Fquantfin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboundedvariation%2Fquantfin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboundedvariation%2Fquantfin/lists"}