kylchiu / exoticmontecarloengine Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Design is based on Mark Joshi's book.
There is currently no way to specify random number seed in the python Exotic Monte Carlo Engine. Without the ability to set seeds, we cannot generate a same set of random variables (rv's). This is problematic as:
Rough plan:
PseudoRandom
?), inheriting from RandomBase
. It should be able to set seed when generating pseudo rv's.set_seed()
, get_gaussians()
, and get_uniforms()
methodsAllow pricer to terminate via three different config options:
Very simple change to hold the previous variable when calculating powers during polynomial evaluation.
It is well known that using quasi-random numbers (QRN) improves convergence speed of a Monte Carlo pricer. This issues aims to support QRN in our random number generator (RNG).
See here for the current implementation of the RNG.
Would be nice to then add a notebook to perform convergence speed analysis - comparing performance of our pricer with either QRN or pseudo random numbers (PRN).
Thanks to #38, we now have the ability to compute first order Greeks using FDM.
The current implementation is agnostic to the type of risk that is being computed. This may not be ideal as different types of risk should be subject to different bump styles (for both numerical stability and financial reasons). E.g. rho should be computed via an absolute bump, rather than a relative one.
Further more, theta is a special type of risk that should not be computed via bumping, but rather via "rolling". To explain what I mean by that, theoretically, we compute theta as
In the context of finite differencing, this means that the "bumped state" should account for the time effects of the other model parameters as well. E.g. rates and equity spot should be rolled along its forward curve, i.e.
PS: not sure if what I said above it 100% legit...will update as I understand the problem better.
Rough plan: (will enrich to give more context on design)
This change is building on the work in PR #30:
Rough Plan:
See #14 for background.
vol_surface_interpolation
abstract base class:interpolate()
implied_vol_surface
abstract base classimplied_vol()
to get IV any given T and K: equity_BS_implied_vol_surface
child class that takes in object vol_surface_interpolation
as input in ctorlocal_vol_surface
abstract base classlocal_vol()
BS_local_vol
child class that takes in object equity_BS_implied_vol_surface
as input in ctorlocal_vol_surface
BS_local_vol
object in our GBM analytical stock price long stepping simulatorlambda
Start with building a (re-usable and extendible) risk engine that computes sensitivities using finite difference method.
If feeling fancy: try to ensure the design is compatible with adjoint algorithmic differentiation (AAD), as implementing AAD usually requires considerable re-engineering of the library.
Currently the C++ project is https://en.wikipedia.org/wiki/Header-only. This typically has the benefit of simplicity and better enabling link time optimisation BUT leads to longer compilation times. This becomes more of an issue as most functions in our code require compilation on both host + device side - i.e. even longer times. We can package this properly as a static/shared library instead.
Moreover, some paths are not correct and reference (incorrect) relative paths. These need to be fixed.
Cannot capture vol skew in the python Exotic Monte Carlo Engine. To do:
Ideally will have both implemented. Keep in mind the design should support any volatility model, making it extendible.
Design in a way that supports correlated random normals.
Potentially requires significant refactoring of the RNG. Suggestions are welcome.
The payoff structure of simple rainbow options (e.g. best-of) is fairly simple. The challenge in pricing these multi-asset exotic is the difficulty in incorporating correlation in the multi-asset simulation model.
A rough roadmap:
A pricing engine is useless without the ability to calibrate to data.
We start with adding two different numerical inversion solvers (root finders):
Then we implement a calibration routine using the solvers to build a (naive) BS vol surface.
This change is building on the work in PR #30:
Rough Plan:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.