Skip to content

Commit

Permalink
strict docs (#105)
Browse files Browse the repository at this point in the history
* strict docs

* more cleanup
  • Loading branch information
alecloudenback committed Oct 28, 2023
1 parent baf25a8 commit 9ee42ad
Show file tree
Hide file tree
Showing 12 changed files with 1,291 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ docs/site/
# It records a fixed state of all packages used by the project. As such, it should not be
# committed for packages, but should be committed for applications that require a static
# environment.
Manifest.toml
*Manifest.toml

settings.json
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ A collection of common functions/manipulations used in Actuarial Calculations.
- Calculate the `Macaulay`, `Modified`, or `DV01` durations for a set of cashflows
- Calculate the `KeyRate(time)` (a.k.a. `KeyRateZero`)duration or `KeyRatePar(time)` duration
- `convexity` for price sensitivity
- Flexible interest rate options via the [`Yields.jl`](https://github.com/JuliaActuary/Yields.jl) package.
- Flexible interest rate models via the [`FinanceModels.jl`](https://github.com/JuliaActuary/FinanceModels.jl) package.
- `internal_rate_of_return` or `irr` to calculate the IRR given cashflows (including at timepoints like Excel's `XIRR`)
- `breakeven` to calculate the breakeven time for a set of cashflows
- `accum_offset` to calculate accumulations like survivorship from a mortality vector
Expand All @@ -52,14 +52,14 @@ A collection of common functions/manipulations used in Actuarial Calculations.

### Typed Rates

- functions which return a rate/yield will return a `Yields.Rate` object. E.g. `irr(cashflows)` will return a `Rate(0.05,Periodic(1))` instead of just a `0.05` (`float64`) to convey the compounding frequency. This uses (and is fully compatible with) Yields.jl and can be used anywhere you would otherwise use a simple floating point rate.
- functions which return a rate/yield will return a `FinanceCore.Rate` object. E.g. `irr(cashflows)` will return a `Rate(0.05,Periodic(1))` instead of just a `0.05` (`float64`) to convey the compounding frequency. This is compatible across the JuliaActuary ecosystem and can be used anywhere you would otherwise use a simple floating point rate.

A couple of other notes:

- `rate(...)` will return the untyped rate from a `Yields.Rate` struct:
- `rate(...)` will return the scalar rate value from a `Rate` struct:

```julia-repl
julia> r = Yields.Rate(0.05,Yields.Periodic(1));
julia> r = Rate(0.05,Periodic(1));
julia> rate(r)
0.05
Expand All @@ -70,22 +70,20 @@ julia> rate(r)
```julia
discount(0.05,cashflows)

r = Yields.Rate(0.05,Yields.Periodic(1));
r = Rate(0.05,Periodic(1));
discount(r,cashflows)
```

- convert between rates with:

```julia
using Yields
r = Rate(0.05,Periodic(1));

r = Yields.Rate(0.05,Yields.Periodic(1));

convert(Yields.Periodic(2), r) # convert to compounded twice per timestep
convert(Yields.Continuous(2),r) # convert to compounded twice per timestep
convert(Periodic(2), r) # convert to compounded twice per timestep
convert(Continuous(2),r) # convert to compounded twice per timestep
```

For more, see the [Yields.jl](https://github.com/JuliaActuary/Yields.jl) which provides a rich and flexible API for rates and curves to use.
For more on Rates, see [FinanceCore.jl](https://github.com/JuliaActuary/FinanceCore.jl). [FinanceModels.jl](https://github.com/JuliaActuary/FinanceModels.jl) also provides a rich and flexible set of yield models to use.

## Documentation

Expand All @@ -99,8 +97,6 @@ See [JuliaActuary.org for instructions](https://juliaactuary.org/tutorials/cashf

[![Simple cashflow analysis with ActuaryUtilities.jl](https://user-images.githubusercontent.com/711879/95857181-d646a280-0d20-11eb-8300-a4c226021334.gif)](https://juliaactuary.org/tutorials/cashflowanalysis/)



## Useful tips

Functions often use a mix of interest_rates, cashflows, and timepoints. When calling functions, the general order of the arguments is 1) interest rates, 2) cashflows, and 3) timepoints.
Loading

0 comments on commit 9ee42ad

Please sign in to comment.