Skip to content

Commit 0851a88

Browse files
avhzavhz
authored andcommitted
feat: SABR model volatility and fitting
1 parent 9fec79f commit 0851a88

27 files changed

Lines changed: 448 additions & 169 deletions

File tree

book/src/Modules/autodiff.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# `autodiff`
2+
3+
The `autodiff` module can be used to differentiate scalar output functions of the form:
4+
5+
\\[f : \mathbb{R}^n \rightarrow \mathbb{R} \\]
6+
7+
8+
Simple expressions are differentiated as follows:
9+
10+
```rust,noplayground
11+
{{#include ../../../examples/examples/autodiff.rs:simple_expressions}}
12+
```
13+
14+
Block expressions are also supported:
15+
16+
```rust,noplayground
17+
{{#include ../../../examples/examples/autodiff.rs:block_expressions}}
18+
```
19+
20+
Closures and functions are also supported:
21+
22+
```rust,noplayground
23+
{{#include ../../../examples/examples/autodiff.rs:closures}}
24+
```
25+
26+
```rust,noplayground
27+
{{#include ../../../examples/examples/autodiff.rs:functions}}
28+
```
29+

book/src/Modules/autodiff/autodiff.md

Lines changed: 0 additions & 117 deletions
This file was deleted.

book/src/Modules/cashflows/cashflows.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,12 @@ That is, anything that can be observed, either in markets or derived from market
66

77
Another form of data is contextual (or reference) data. These are things such as calendars and date conventions. While there are facilities to handle these data inside the `data` module, the underlying implementations are in other modules, such as the `time` module.
88

9+
## Curves
10+
11+
Curves can be fit to market data. Here we include an example of a spot curve being fitted.
12+
13+
![`Spot curve`](../assets/spotcurve.png)
14+
15+
```rust
16+
{{#include ../../../examples/examples/curves_spot.rs}}
17+
```

book/src/Modules/data/curves.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

book/src/Modules/error.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

book/src/Modules/instruments.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# `instruments`
2+
3+
4+
## European Vanilla Options
5+
6+
To price a vanilla European option, we begin by defining the option itself:
7+
8+
```rust,noplayground
9+
{{#include ../../../examples/examples/option_pricing_vanilla.rs:option_definition}}
10+
```
11+
12+
Then we need to define a model to price the option with:
13+
14+
```rust,noplayground
15+
{{#include ../../../examples/examples/option_pricing_vanilla.rs:model_definitions}}
16+
```
17+
18+
Lastly, we construct an `AnalyticOptionPricer`, from which we can generate a report.
19+
The report simply prints the option, model, price, and Greeks.
20+
21+
```rust,noplayground
22+
{{#include ../../../examples/examples/option_pricing_vanilla.rs:option_pricing}}
23+
```
24+
25+
The output will look something like this:
26+
27+
```rust,noplayground
28+
{{#include ../../../examples/examples/option_pricing_vanilla.rs:output}}
29+
```

book/src/Modules/instruments/instruments.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

book/src/Modules/instruments/options.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

book/src/Modules/iso/iso.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)