-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
55 lines (45 loc) · 1.36 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# fcl
<!-- badges: start -->
[![R-CMD-check](https://github.com/shrektan/fcl/workflows/R-CMD-check/badge.svg)](https://github.com/shrektan/fcl/actions)
[![CRAN status](https://www.r-pkg.org/badges/version/fcl)](https://CRAN.R-project.org/package=fcl)
[![Coverage Status](https://coveralls.io/repos/github/shrektan/fcl/badge.svg?branch=main)](https://coveralls.io/github/shrektan/fcl?branch=main)
<!-- badges: end -->
A financial calculator written in Rust. It provides simple calculations for bond YTM, Duration, etc.
## Installation
You'll need the rust toolchain to compile this package from the source.
## Example
```{r example}
library(fcl)
## basic example code
bond <- fixed_bond(
value_date = 210101,
mty_date = c(250101, 300201),
redem_value = 100,
cpn_rate = c(0.05, 0.03),
cpn_freq = c(0, 1)
)
bond$ytm_dur(
ref_date = c(220101, 220201),
clean_price = 100
)
bond$cf(
ref_date = c(220101, 220131)
)
rtn <- make_rtn(date = c(210101, 210105, 210110), mv = c(100, 123, 140), pl = c(0, 3, 7))
rtn$twrr_cr(210102, 210110)
rtn$twrr_dr(210102, 210110)
rtn$dietz(210102, 210110)
rtn$dietz_avc(210102, 210110)
```