-
-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add notebook to see payment and accrual dates
- Loading branch information
Showing
1 changed file
with
129 additions
and
0 deletions.
There are no files selected for viewing
129 changes: 129 additions & 0 deletions
129
notebooks/products/credit/FINCDS_ForwardAndBackward.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"####################################################################\n", | ||
"# FINANCEPY BETA Version 0.300 - This build: 30 Jun 2023 at 19:34 #\n", | ||
"# This software is distributed FREE AND WITHOUT ANY WARRANTY #\n", | ||
"# Report bugs as issues at https://github.com/domokane/FinancePy #\n", | ||
"####################################################################\n", | ||
"\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"from financepy.utils import *\n", | ||
"from financepy.products.credit import *" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"effective_date = Date(20, 2, 2009)\n", | ||
"maturity_date = Date(20, 3, 2010)\n", | ||
"running_coupon = 0.01" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"OBJECT TYPE: CDS\n", | ||
"STEP-IN DATE: 20-FEB-2009\n", | ||
"MATURITY: 20-MAR-2010\n", | ||
"NOTIONAL: 1000000\n", | ||
"RUNNING COUPON: 100.0bp\n", | ||
"DAYCOUNT: DayCountTypes.ACT_360\n", | ||
"FREQUENCY: FrequencyTypes.QUARTERLY\n", | ||
"CALENDAR: CalendarTypes.WEEKEND\n", | ||
"BUSDAYRULE: BusDayAdjustTypes.FOLLOWING\n", | ||
"DATEGENRULE: DateGenRuleTypes.BACKWARD\n", | ||
"ACCRUED DAYS: 60.0\n", | ||
"PAYMENT_DATE, YEAR_FRAC, FLOW, ACCRUAL_START, ACCTUAL_END\n", | ||
"20-MAR-2009, 0.244444, 2444.444444, 22-DEC-2008, 19-MAR-2009\n", | ||
"22-JUN-2009, 0.261111, 2611.111111, 20-MAR-2009, 21-JUN-2009\n", | ||
"21-SEP-2009, 0.252778, 2527.777778, 22-JUN-2009, 20-SEP-2009\n", | ||
"21-DEC-2009, 0.252778, 2527.777778, 21-SEP-2009, 20-DEC-2009\n", | ||
"22-MAR-2010, 0.250000, 2500.000000, 21-DEC-2009, 20-MAR-2010\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"# Reference: https://www.cdsmodel.com/assets/cds-model/docs/Standard%20CDS%20Examples.pdf\n", | ||
"cds_backward = CDS(effective_date, maturity_date, running_coupon, date_gen_rule_type=DateGenRuleTypes.BACKWARD)\n", | ||
"print(cds_backward)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"OBJECT TYPE: CDS\n", | ||
"STEP-IN DATE: 20-FEB-2009\n", | ||
"MATURITY: 20-MAR-2010\n", | ||
"NOTIONAL: 1000000\n", | ||
"RUNNING COUPON: 100.0bp\n", | ||
"DAYCOUNT: DayCountTypes.ACT_360\n", | ||
"FREQUENCY: FrequencyTypes.QUARTERLY\n", | ||
"CALENDAR: CalendarTypes.WEEKEND\n", | ||
"BUSDAYRULE: BusDayAdjustTypes.FOLLOWING\n", | ||
"DATEGENRULE: DateGenRuleTypes.FORWARD\n", | ||
"ACCRUED DAYS: 0.0\n", | ||
"PAYMENT_DATE, YEAR_FRAC, FLOW, ACCRUAL_START, ACCTUAL_END\n", | ||
"20-MAY-2009, 0.247222, 2472.222222, 20-FEB-2009, 19-MAY-2009\n", | ||
"20-AUG-2009, 0.255556, 2555.555556, 20-MAY-2009, 19-AUG-2009\n", | ||
"20-NOV-2009, 0.255556, 2555.555556, 20-AUG-2009, 19-NOV-2009\n", | ||
"22-FEB-2010, 0.261111, 2611.111111, 20-NOV-2009, 21-FEB-2010\n", | ||
"22-MAR-2010, 0.075000, 750.000000, 22-FEB-2010, 20-MAR-2010\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"cds_forward = CDS(effective_date, maturity_date, running_coupon, date_gen_rule_type=DateGenRuleTypes.FORWARD)\n", | ||
"print(cds_forward)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "env", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.6" | ||
}, | ||
"orig_nbformat": 4 | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |