QuantLibでダウンキャストする際の関数一覧。QuantLib 1.30で確認。たぶん完成しないので随時更新。
メソッド一覧
キャッシュフロー
| メソッド | キャスト先 | 備考 |
|---|---|---|
| as_capped_floored_yoy_inflation_coupon | ||
| as_coupon | Coupon | as_redemptionは無い |
| as_cpi_cashflow | ||
| as_cpi_coupon | ||
| as_fixed_rate_coupon | FixedRateCoupon | |
| as_floating_rate_coupon | FloatingRateCoupon | |
| as_indexed_cashflow | ||
| as_inflation_coupon | ||
| as_overnight_indexed_coupon | ||
| as_sub_periods_coupon | ||
| as_yoy_inflation_coupon | ||
| as_zero_inflation_cash_flow |
インデックス
| メソッド | キャスト先 | 備考 |
|---|---|---|
| as_iborindex | IborIndex | |
| as_overnight_swap_index | ||
| as_swap_index | ||
| as_zero_inflation_index |
ヘルパー
| メソッド | キャスト先 | 備考 |
|---|---|---|
| as_black_helper | ||
| as_constnotionalcrosscurrencybasisswapratehelper | ||
| as_depositratehelper | ||
| as_fraratehelper | ||
| as_mtmcrosscurrencybasisswapratehelper | ||
| as_oisratehelper | ||
| as_swapratehelper | ||
| as_swaption_helper |
その他
| メソッド | キャスト先 | 備考 |
|---|---|---|
| as_gsr_process | ||
| as_plain_vanilla_payoff |
使用例
債券キャッシュフローからクーポンキャッシュフローのみを抽出
input
import QuantLib as ql
bond = ql.FixedRateBond(
2, # settlementDays
ql.TARGET(), # calendar
100.0, # faceAmount
ql.Date(15,12,2020), # startDate
ql.Date(15,12,2022), # maturityDate
ql.Period(6, ql.Months),# tenor
[0.05], # coupon
ql.Actual365Fixed() # paymentConvention
)
[(cf.date(), cf.amount()) for cf in bond.cashflows() if ql.as_coupon(cf) is not None]
output
[(Date(15,6,2021), 2.4931506849315),
(Date(15,12,2021), 2.5068493150684823),
(Date(15,6,2022), 2.4931506849315),
(Date(15,12,2022), 2.5068493150684823)]
変動利付債から金利指標を取り出す
ql.as_floating_rate_coupon(cashdlow).indexで金利指標を取り出す。さらに、ql.as_iborindex()でiborに。