Coconote
AI notes
AI voice & video notes
Try for free
📊
C++ and Quantitative Finance Lecture
Jul 16, 2024
Lecture on C++ and Quantitative Finance
Introduction
Presenter: 4th-year full-time instructor in the Computational Finance & Risk Management program at the University of Washington.
Experience: 24 years in quantitative development in finance.
Focus: Needs of end-users like quants and developers of financial libraries.
Themes: Easy-to-use tools in C++ for powerful results.
Key Topics
Efficiency Gains with C++
Quants often use languages like VBA, MATLAB, Python leading to long run times.
Example: MATLAB model takes 2-3 days, rewrites in C++ complete in under 5 minutes.
Importance in Finance
C++ used in building financial libraries for option pricing models, risk management models, etc.
Essential C++ Features
Move Semantics
Help in making code more efficient, readable, and maintainable.
Example: Use of unique pointer.
Parallel STL Algorithms (C++17)
Significant efficiency gains with minimal changes.
Open-source Math Libraries
Libraries like Eigen and Armadillo are popular in finance.
Advanced decompositions necessary for financial modeling.
Upcoming Features
C++ 20: New date class, important for finance.
C++ 23: Potential introduction of linear algebra.
Boost Library
Intuitive and useful but some parts lack user-friendliness.
Practical Application: Monte Carlo Option Pricing
Example to demonstrate use of modern C++ features.
Option
: Tradeable contract to buy/sell stock at a predetermined price in the future.
Monte Carlo Simulation
: Generate multiple random scenarios to project stock prices.
Payoffs
: Discounted back to present value to compute option price.
Example setup: European call option with a strike price of $105, current price $100.
Steps in a Monte Carlo Simulation
Generate random stock price scenario using stochastic process (from Black-Scholes theory).
Iteratively calculate new stock prices at each time step.
Generate multiple scenarios to compute the expected payoff.
Use task-based concurrency for efficient scenario generation.
Discount payoffs back to present time and average them for the final option price.
Use Eigen or Armadillo for matrix and linear algebra operations.
Utilize Boost for probability distributions, numerical integration, and specialized data structures.
Development and Execution of C++ Code
Equity Price Generator Class
: Store construction inputs like volatility, interest rate, initial price, etc.
Random Number Generation
: Use Mersenne Twister and Normal Distribution classes.
Task-based Concurrency
: Create multiple future objects to generate scenarios in parallel.
Option Pricer Class
: Compute option prices using generated scenarios.
Results
: Significant runtime improvements on multi-core systems.
Teaching and Resources
Issue with outdated teaching materials and textbooks.
Emphasis on using modern C++ features for more efficient quantitative development.
Key References: Scott Meyers' "Effective Modern C++", Nico Josuttis' "The C++ Standard Library".
Boost Libraries
Boost Math Toolkit
: Statistical distributions and numerical integration are intuitive and useful.
Other Libraries
: Circular buffers for live data feeds, accumulators for statistical analysis, multi-array for lattice models.
Conclusion
Summary of modern C++ features and their application in quantitative finance.
Emphasis on the importance of efficiency and maintainability in financial modeling.
Encouragement to leverage new tools and libraries in C++.
References and Contact
Website, email, LinkedIn, GitHub for sample code.
Final note: Open to questions and further discussion.
📄
Full transcript