9 ms·
Collection of Jupyter notebooks for quantitative finance
- ptd 7y agoI just worked on a project to predict significant(greater than 3 std) changes in the market and my biggest pain point was the lack of open source resources for quantitative finance(QF). It makes sense given the industry, but then I remind myself QF brought us Pandas! Thank you for making this publicly available.
- throwaway8291 7y agoIt's interesting that open source lives off transparency and equality (e.g. with git, anyone can at least start to put a patch together), whereas many other vital parts of society like finance, business, politics only work, when you explicitly do not share, what you know.
- NOGDP 7y agoPolitics would work a lot better if everything was out in the open.
- Ma8ee 7y agoIt doesn't seem to make much of a difference, does it?
- epa 7y agoThis is why computer science has evolved so fast, especially over the last 20 years, because of the open aspect of the code.
- 1996 7y agoopen source finance is crypto. arbitrage provides information everyone can use. Practical example: get free price every minute from cryptomarketplot.com/api.json then you can figure out the EUR/USD spot using BTC/USD and BTC/EUR without ever needing yahoo finance or anything
- arthurcolle 7y agoif you're interested in pricing of securities, QuantLib is amazing.
- throwlaplace 7y agoHoly shit more gold! Thank you for posting this!
- arthurcolle 7y agoIf you want to collaborate I am working on a lot of cool qfin related projects. Hit me at my email in the profile. Cheers
- ptd 7y agoThanks for sharing!
- bigmit37 7y agoExcellent, an area I am really interested in. Thank you for sharing.
- throwlaplace 7y agoHoly shit this is literally gold. I just went through this paper ("porting" to python) https://epubs.siam.org/doi/abs/10.1137/s0036144500378302 https://epubs.siam.org/doi/abs/10.1137/s0036144500378302 I was planning on moving on to his book but now I'll just read this. Kudos to you Nicola for putting in the work and then releasing. If I were you I would typeset this and approach publishers because I bet you would sell many copies. edit: i'll take this opportunity to poll the audience: does anyone know a good explanation of girsanov? i know a fair amount of measure theory but i'm still looking for a good, detailed, practical explanation of its use in the context of changing to risk-free measure for black-scholes.
- mjfl 7y agocool paper, thanks
- Cantaro86 7y agoThanks a lot!
- backlash875 7y agoAre you looking for a proof of Girsanov's theorem or an explanation of how it is used to price? A good reference is Oksendal [0], but it's still quite tough going. As for how it's used, a good reference is Shreve's second volume [1], which also contains a proof of Girsanov's theorem. Joshi's book [2] is a little bit lighter on the mathematical rigour. A quick explanation of how it's used: Taking the stochastic differential equation for geometric Brownian motion, apply Girsanov's theorem to change measure via a drift change such that we now have a discounted stock price that is a martingale. The discounted stock price is the stock price divided by a short term bond or cash account asset. In this new measure the discounted short term bond/cash account asset is also trivially a martingale since it's being divided by itself. So we have that our two key assets (discounted) are martingales. We then define the time zero price of the option (divided by the time zero price of the bond/cash asset) to be the discounted expected value of its value at maturity in this newly constructed measure. By construction this discounted option price is a martingale and we now have three assets that are all martingales which implies there is no arbitrage possible. With this option price, called the "risk neutral" price, no arbitrage is possible under our newly constructed measure, but, because the original measure is an equivalent measure no arbitrage is possible here in the "real world" either and so this is our actual price. I appreciate there are a few steps here that seem like a bit of a leap. It took me a while to appreciate them. The key things to appreciate are: How everything being a martingale implies a lack of arbitrage. Girsanov allows you to make your (discounted) underlying a martingale. How you can then just make the option price a martingale by construction. And then how lack of arbitrage under one measure means lack of arbitrage in any equivalent measure. The discounting can also be a little confusing, but it's really just incorporating the time value of money into the calculations. [0] Oksendal B . Stochastic Differential Equations. [1] Shreve S E. Stochastic Calculus for Finance II. [2] Joshi M S. The Concepts and Practice of Mathematical Finance
- arvinaminpour 7y agoI'm always surprised at how people utilize Jupyter notebooks. What kinds of platforms/software do these firms use to perform the analysis?
- kfk 7y agoIt’s a bit of a mess right now. AWS is eating this market but frankly their products are not that great. Their ETL tool which does parallel execution and all is called Glue which is a cloud version of Spark. Glue is supposed to integrate with SageMaker which is basically your standard jupyter notebook experience. Spark though not that intuitive and is not the tool data scientists use for exploration. So data scientists explore and build model and then they rebuild them to run in Spark. Basically we would need a way to seamlessly scale pandas or R dataframes across clusters. Dask looks promising but it is facing an uphill battle vs aws and company and their inferior but convenient tooling.
- infinite8s 7y agoA friend of mine is trying to build the databricks of dask for exactly that reason.
- caffeine 7y agoProprietary software. This is mostly stuff used for options procing. Every options trading house has a substantial investment in proprietary options pricing software, mostly using customized adaptations of these models rather than what you would find in the literature.
- lalaland1125 7y agoOne thing to keep in mind before starting any finance project is the efficient market hypothesis. In order for you to make a profit relative to the market, you must by definition be better at modeling than everyone else. (There are certain caveats in terms of liquidity and leverage, but the general theme is correct). I'll only note that beating everyone else is quite challenging, especially when you are competing against very well funded trading firms. EDIT: Slight fix of wording as suggested by comment below.
- ditonal 7y agoThe joke is, two economists are walking down the street, and one sees a $100 bill on the ground, and the other says don't bother going to pick it up, if it was really $100, someone would have already picked it up.
- sandoooo 7y agoA million pairs of economists walked down a million streets in a million possible worlds, but no jokes were made there because they didn't find squat.
- throwlaplace 7y agothe efficient market hypothesis is an axiom use to simplify models not an empirical fact. that's why it's a hypothesis not a law.
- fancyfredbot 7y agoThe models here actually assume efficient markets and no arbitrage. You calibrate them to market, and if you use them to price a market traded derivative you hope they give you the market price you put in (if not then by definition they've gone wrong). They are useful for pricing or replicating other derivatives without available prices, but not really aimed at getting an edge on the market.
- smabie 7y agoSure they are. If the price you calculated and the price in the market is significantly different, the law of no arbitrage is violated and therefore you have can fulfill your sworn duty as a market participant and arbitrage it away until everything is hunkydory again.
- KloudTrader 7y agoThis is an incredible piece of work, kudos for releasing it!
- Cantaro86 7y agoThanks a lot!
- daleroberts 7y agoAlso useful is a Quant finance cheat sheet if you are going to sit an exam: https://github.com/daleroberts/math-finance-cheat-sheet https://github.com/daleroberts/math-finance-cheat-sheet
- xvilka 7y agoAnother useful resource, albeit more beginner level - Quant Economy course. It has both Julia[1] and Python[2] flavors. Recently they even added a small introduction to the data science[3]. And all of this - open-source project at GitHub[4]! [1] https://julia.quantecon.org/ https://julia.quantecon.org/ [2] https://python.quantecon.org/ https://python.quantecon.org/ [3] https://datascience.quantecon.org/ https://datascience.quantecon.org/ [4] https://github.com/QuantEcon/ https://github.com/QuantEcon/
- lngnmn1 7y agoWow, disconnected from reality (actual causes) abstract bullshit. No wonder it crashed in 2008 and will crash again.
- jbredeche 7y agoShameless plug, at Quantopian we have a bunch of materials (usually notebooks, sometimes also videos) covering introductory material in quant finance and Python: https://www.quantopian.com/lectures https://www.quantopian.com/lectures (I work at Quantopian)