Skip to content
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

Doc enhancements #163

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,22 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Transducers = "28d57a85-8fef-5791-bfe6-a80928e7c999"
UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"

[weakdeps]
MakieCore = "20f20a25-4f0e-4fdf-b5d1-57303727442b"

[extensions]
# name of extension to the left
# extension dependencies required to load the extension to the right
# use a list for multiple extension dependencies
FinanceModelsMakieCoreExt = "MakieCore"

[compat]
julia = "1.9" #Bsplinekit 0.16 is 1.8 or above and AccessibleOptimization's deps is 1.9
FinanceCore = "^2"
BSplineKit = "^0.16"
IntervalSets = "^0.7"
Transducers = "^0.4"
MakieCore = "0.6"
Optimization = "^3.15"
OptimizationMetaheuristics = "^0.1.2"
OptimizationOptimJL = "^0.1.9"
Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,31 @@ However, `Projection`s allow one to combine three elements which can be extended
- the **model** which includes assumptions of how the contract will behave
- a `ProjectionKind` which indicates the kind of output desired (cashflow stream, amortization schedule, etc...)

#### Examples

A fixed bond that needs no valuation model (`NullModel()`) to define its projected gross cashflows:

```julia
Projection(Bond.Fixed(0.04,Periodic(2),3),NullModel(),CashflowProjection())
```

#### Plotting Projections

A `CashflowProjection` or a vector of `Cashflow`s can be plotted with the [Makie](https://makie.org/) family of plotting packages. For example:

```julia
using FinanceModels, CairoMakie
proj = Projection(Bond.Fixed(0.10,Periodic(2),20),NullModel(),CashflowProjection())
# a stem plot:
stem(proj)
```

Will produce:

![A stem plot of bond cashflows](https://github.com/JuliaActuary/ActuaryUtilities.jl/assets/711879/29480ce2-9691-4eb5-b656-a05394f7a2c2)



### Fitting Models


Expand Down
4 changes: 4 additions & 0 deletions docs/docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
FinanceCore = "b9b1ffdd-6612-4b69-8227-7663be06e089"
FinanceModels = "77f2ae65-bdde-421f-ae9d-22f1af19dd76"
28 changes: 21 additions & 7 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using FinanceModels
using Documenter

makedocs(;
modules=[FinanceModels],
modules=[FinanceModels, FinanceCore],
authors="Alec Loudenback <[email protected]> and contributors",
repo="https://github.com/JuliaActuary/FinanceModels.jl/blob/{commit}{path}#L{line}",
sitename="FinanceModels.jl",
Expand All @@ -13,13 +13,27 @@ makedocs(;
),
pages=[
"Home" => "index.md",
"Guide" => "guide.md",
"Contracts" => "contracts.md",
"Models, Valuation, and Fitting" => "models.md",
"API Reference" => "api.md",
"Migration Guide" => "migration.md",
"Guide" => [
"Introduction" => "introduction.md",
"Models, Valuation, and Fitting" => "models.md",
"Contracts" => "contracts.md",
"Rates" => "Rates.md",
"Migration Guide" => "migration.md",
],
"Modules" => [
"FinanceModels" => "API/FinanceModels.md",
"FinanceCore" => "API/FinanceCore.md",
"Spline" => "API/Spline.md",
"Fit" => "API/Fit.md",
"Yield" => "API/Yield.md",
"Bond" => "API/Bond.md",
"Equity" => "API/Equity.md",
"Option" => "API/Option.md",
"Volatility" => "API/Volatility.md",
],
"FAQs" => "faq.md",
]
],
warnonly=true
)

deploydocs(;
Expand Down
19 changes: 19 additions & 0 deletions docs/src/API/Bond.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# FinanceModels.Bond API Reference

```@index
Modules = [FinanceModels.Bond]
```

## Exported API
```@autodocs
Modules = [FinanceModels.Bond]
Private = false
```

## Unexported API
```@autodocs
Modules = [FinanceModels.Bond]
Public = false
```

Please [open an issue](https://github.com/JuliaActuary/FinanceModels.jl/issues) if you encounter any issues or confusion with the package.
19 changes: 19 additions & 0 deletions docs/src/API/Equity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# FinanceModels.Equity API Reference

```@index
Modules = [FinanceModels.Equity]
```

## Exported API
```@autodocs
Modules = [FinanceModels.Equity]
Private = false
```

## Unexported API
```@autodocs
Modules = [FinanceModels.Equity]
Public = false
```

Please [open an issue](https://github.com/JuliaActuary/FinanceModels.jl/issues) if you encounter any issues or confusion with the package.
19 changes: 19 additions & 0 deletions docs/src/API/FinanceCore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# FinanceCore API Reference

```@index
Modules = [FinanceCore]
```

## Exported API
```@autodocs
Modules = [FinanceCore]
Private = false
```

## Unexported API
```@autodocs
Modules = [FinanceCore]
Public = false
```

Please [open an issue](https://github.com/JuliaActuary/FinanceModels.jl/issues) if you encounter any issues or confusion with the package.
19 changes: 19 additions & 0 deletions docs/src/API/FinanceModels.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# FinanceModels API Reference

```@index
Modules = [FinanceModels]
```

## Exported API
```@autodocs
Modules = [FinanceModels]
Private = false
```

## Unexported API
```@autodocs
Modules = [FinanceModels]
Public = false
```

Please [open an issue](https://github.com/JuliaActuary/FinanceModels.jl/issues) if you encounter any issues or confusion with the package.
19 changes: 19 additions & 0 deletions docs/src/API/Fit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# FinanceModels.Fit API Reference

```@index
Modules = [FinanceModels.Fit]
```

## Exported API
```@autodocs
Modules = [FinanceModels.Fit]
Private = false
```

## Unexported API
```@autodocs
Modules = [FinanceModels.Fit]
Public = false
```

Please [open an issue](https://github.com/JuliaActuary/FinanceModels.jl/issues) if you encounter any issues or confusion with the package.
19 changes: 19 additions & 0 deletions docs/src/API/Option.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# FinanceModels.Option API Reference

```@index
Modules = [FinanceModels.Option]
```

## Exported API
```@autodocs
Modules = [FinanceModels.Option]
Private = false
```

## Unexported API
```@autodocs
Modules = [FinanceModels.Option]
Public = false
```

Please [open an issue](https://github.com/JuliaActuary/FinanceModels.jl/issues) if you encounter any issues or confusion with the package.
19 changes: 19 additions & 0 deletions docs/src/API/Spline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# FinanceModels.Spline API Reference

```@index
Modules = [FinanceModels.Spline]
```

## Exported API
```@autodocs
Modules = [FinanceModels.Spline]
Private = false
```

## Unexported API
```@autodocs
Modules = [FinanceModels.Spline]
Public = false
```

Please [open an issue](https://github.com/JuliaActuary/FinanceModels.jl/issues) if you encounter any issues or confusion with the package.
19 changes: 19 additions & 0 deletions docs/src/API/Volatility.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# FinanceModels.Volatility API Reference

```@index
Modules = [FinanceModels.Volatility]
```

## Exported API
```@autodocs
Modules = [FinanceModels.Volatility]
Private = false
```

## Unexported API
```@autodocs
Modules = [FinanceModels.Volatility]
Public = false
```

Please [open an issue](https://github.com/JuliaActuary/FinanceModels.jl/issues) if you encounter any issues or confusion with the package.
19 changes: 19 additions & 0 deletions docs/src/API/Yield.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# FinanceModels.Yield API Reference

```@index
Modules = [FinanceModels.Yield]
```

## Exported API
```@autodocs
Modules = [FinanceModels.Yield]
Private = false
```

## Unexported API
```@autodocs
Modules = [FinanceModels.Yield]
Public = false
```

Please [open an issue](https://github.com/JuliaActuary/FinanceModels.jl/issues) if you encounter any issues or confusion with the package.
62 changes: 62 additions & 0 deletions docs/src/Rates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
## Rates

We should first discuss `Rate`s, which are reexported from [`FinanceCore.jl`](https://github.com/JuliaActuary/FinanceCore.jl)

Rates are types that wrap scalar values to provide information about how to determine `discount` and `accumulation` factors. These allow for explicit handling of rate compounding conventions which, if not explicit, is often a source of errors in practice.

There are two `Frequency` types:

- `Yields.Periodic(m)` for rates that compound `m` times per period (e.g. `m` times per year if working with annual rates).
- `Yields.Continuous()` for continuously compounding rates.

#### Examples

```julia
Continuous(0.05) # 5% continuously compounded
Periodic(0.05,2) # 5% compounded twice per period
```

These are both subtypes of the parent `Rate` type and are instantiated as:

```julia
Rate(0.05,Continuous()) # 5% continuously compounded
Rate(0.05,Periodic(2)) # 5% compounded twice per period
```

Broadcast over a vector to create `Rates` with the given compounding:

```julia
Periodic.([0.02,0.03,0.04],2)
Continuous.([0.02,0.03,0.04])
```

Rates can also be constructed by specifying the `CompoundingFrequency` and then passing a scalar rate:

```julia
Periodic(1)(0.05)
Continuous()(0.05)
```

#### Conversion

Convert rates between different types with `convert`. E.g.:

```julia
r = Rate(0.01,Periodic(12)) # rate that compounds 12 times per rate period (ie monthly)

convert(Yields.Periodic(1),r) # convert monthly rate to annual effective
convert(Yields.Continuous(),r) # convert monthly rate to continuous
```

To get the scalar value out of the `Rate`, use `FinanceModels.rate(r)`:

```julia-rel
julia> r = Rate(0.01,Periodic(12));
julia> rate(r)
0.01

```

#### Arithmetic

Adding, subtracting, multiplying, dividing, and comparing rates is supported.
43 changes: 0 additions & 43 deletions docs/src/api.md

This file was deleted.

Loading
Loading