-
-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Monte-Carlo Engine, seed parameter implementation and new numerical schemes for SDEs #270
Open
yfnaji
wants to merge
18
commits into
avhz:main
Choose a base branch
from
yfnaji:monte-carlo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…wly added Milstein scheme and Strang Splitting
…ng in an additional seed parameter and price_monte_carlo with method parameter
I will hopefully review and merge this PR this weekend :) Thanks for this one ! |
Sorry it's taken me a while to have a look at this.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request was created to address issue 244.
Centralize Monte-Carlo functionality
Previously, the monte-carlo method needed to be implemented for each numerical method individually. Now there exists a private
monte_carlo()
function in theprocess.rs
module which can be utilised for each numerical method defined in theStochasticProcess
trait, removing the need for re-implementing the Monte-Carlo method every time.Consolidate seeded and "unseeded" numerical methods
The Euler Maruyama method had two implementations, one where a seed can be defined and another where the seed is "randomly" generated,
seedable_euler_maruyama
andeuler_maruyama
respectively.A
seed: Option<u64>
parameter is introduced intoStochasticProcessConfig
to give the user the ability to fix outcomes, other can be entered asNone
, removing the need for two implementations of the same numerical methods.Milstein's scheme & Strang Splitting
The Milstein's scheme and Strang Splitting are numerical methods for SDEs that have been implemented in
process.rs
as part of this PR (and utilizemonte_carlo()
mentioned before). As such,price_monte_carlo()
has been amended slightly to accomodate the new numerical methods.Their methodologies are outlined below.
Define the SDE
where$W_t\sim N\left(0, t\right)$ is the Wiener process. We define $t_n = t_0 + n\Delta t$ where $\Delta t = \frac{t_N-t_0}{M}$ .
Milstein's Scheme
The Milstein scheme at time$t_n\in\left[t_0, t_N\right]$ is defined as
with the initial condition$X_0 = x_0$ .
Strang Splitter
The Strang Splitter method can be split into three steps:
All appropriate unit tests have been added.
Future work
monte_carlo()
to handle stochastic volatility and jump diffusion modelsAlthough these points are relevant, they will not be addressed as part of this PR to avoid scope screep.