1个不稳定版本
0.1.0 | 2024年5月2日 |
---|
#90 在 财务
10KB
167 行
coupon_rs
描述
此包包含 价格 函数和 收益率 函数,类似于LibreOffice Calc或Microsoft Excel。该包还包含一些计算优惠券天数的函数。
语法和用法
首先,将包添加到 Cargo.toml
[dependencies]
coupon_rs = "0.1.0"
然后在rust代码中
use coupon_rs::{get_coupdaybs, get_coupdays, get_coupdaysnc, get_coupnum, get_price_, get_yield_, lcl_get_couppcd};
// PRICE(settlement, maturity, rate, yld, redemption, frequency, basis)
get_price_(n_settle, n_mat, f_rate, f_yield, f_redemp, n_freq, n_base)
// YIELD(settlement, maturity, coupon_rate, price, redemption, frequency, basis)
get_yield_(n_settle, n_mat, f_coup, f_price, f_redemp, n_freq, n_base)
// return payment date before settlement
lcl_get_couppcd(r_settle, r_mat, n_freq)
// return payment date after settlement
lcl_get_coupncd(r_settle, r_mat, n_freq)
// return number of days in one period
get_coupdays(n_settle, n_mat, n_freq, n_base)
// return number of days in period before settlement
get_coupdaybs(n_settle, n_mat, n_freq, n_base)
// return number of days after settlement until the next payment date
get_coupdaysnc(n_settle, n_mat, n_freq, n_base)
// return number of payment in one year
get_coupnum(n_settle, n_mat, n_freq, n_base)
许可证
本项目受以下许可证的约束
依赖关系
~1.5MB
~19K SLoC