-
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: SABR model volatility and fitting
- Loading branch information
avhz
authored and
avhz
committed
Nov 24, 2024
1 parent
9fec79f
commit 0851a88
Showing
27 changed files
with
448 additions
and
169 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# `autodiff` | ||
|
||
The `autodiff` module can be used to differentiate scalar output functions of the form: | ||
|
||
\\[f : \mathbb{R}^n \rightarrow \mathbb{R} \\] | ||
|
||
|
||
Simple expressions are differentiated as follows: | ||
|
||
```rust,noplayground | ||
{{#include ../../../examples/examples/autodiff.rs:simple_expressions}} | ||
``` | ||
|
||
Block expressions are also supported: | ||
|
||
```rust,noplayground | ||
{{#include ../../../examples/examples/autodiff.rs:block_expressions}} | ||
``` | ||
|
||
Closures and functions are also supported: | ||
|
||
```rust,noplayground | ||
{{#include ../../../examples/examples/autodiff.rs:closures}} | ||
``` | ||
|
||
```rust,noplayground | ||
{{#include ../../../examples/examples/autodiff.rs:functions}} | ||
``` | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# `instruments` | ||
|
||
|
||
## European Vanilla Options | ||
|
||
To price a vanilla European option, we begin by defining the option itself: | ||
|
||
```rust,noplayground | ||
{{#include ../../../examples/examples/option_pricing_vanilla.rs:option_definition}} | ||
``` | ||
|
||
Then we need to define a model to price the option with: | ||
|
||
```rust,noplayground | ||
{{#include ../../../examples/examples/option_pricing_vanilla.rs:model_definitions}} | ||
``` | ||
|
||
Lastly, we construct an `AnalyticOptionPricer`, from which we can generate a report. | ||
The report simply prints the option, model, price, and Greeks. | ||
|
||
```rust,noplayground | ||
{{#include ../../../examples/examples/option_pricing_vanilla.rs:option_pricing}} | ||
``` | ||
|
||
The output will look something like this: | ||
|
||
```rust,noplayground | ||
{{#include ../../../examples/examples/option_pricing_vanilla.rs:output}} | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# `math` | ||
|
||
## Numerical Integration | ||
|
||
Here we integrate the Gaussian density, which integrates to 1: | ||
|
||
\\[ | ||
\int_{\mathbb{R}} \frac{1}{\sqrt{2 \pi}} e^{\left( -\frac{x^2}{2} \right)} dx = 1 | ||
\\] | ||
|
||
```rust,noplayground | ||
{{#include ../../../examples/examples/numerical_integration.rs:numerical_integration}} | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# `stochastics` | ||
|
||
Many stochastic processes can be generated: | ||
|
||
```rust,noplayground | ||
{{#include ../../../examples/examples/stochastic_processes.rs:stochastic_processes}} | ||
``` | ||
|
||
Paths can be plotted via the `plot_vector!` macro or `plotly`: | ||
|
||
![Geometric Brownian Motion](../assets/gbm.png) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.