Skip to content

Commit

Permalink
New spread fields for corporate bonds
Browse files Browse the repository at this point in the history
  • Loading branch information
open-source-modelling authored Nov 22, 2024
1 parent 44af918 commit 751a166
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 47 deletions.
6 changes: 4 additions & 2 deletions BondClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from CurvesClass import Curves
import logging


logger=logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

Expand All @@ -29,7 +28,10 @@ class CorpBond:
maturity_date: date
coupon_rate: float
notional_amount: float
spread_country: float
spread_sector: float
zspread: float
spread_stress: float
frequency: Frequency
recovery_rate: float
default_probability: float
Expand Down Expand Up @@ -79,7 +81,7 @@ def coupon_amount(self) -> float:
coupon = self.coupon_rate * self.notional_amount
return coupon

def generate_coupon_dates(self, modelling_date: date, end_date: date) -> date:
def generate_coupon_dates(self, modelling_date: date, end_date: date) -> dt.date:
"""
Generator yielding the coupon payment date starting from the first coupon
paid after the modelling date.
Expand Down
8 changes: 7 additions & 1 deletion ImportData.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ def get_corporate_bonds(filename: str) -> CorpBond:
issue_date=datetime.strptime(row["Issue_Date"], "%d/%m/%Y").date(),
maturity_date=datetime.strptime(row["Maturity_Date"], "%d/%m/%Y").date(),
coupon_rate=float(row["Coupon_Rate"]),
spread_country=float(row["Spread_Country"]),
spread_sector=float(row["Spread_Sector"]),
zspread=float(row["Z_Spread"]),
spread_stress=float(row["Spread_Stress"]),
notional_amount=float(row["Notional_Amount"]),
frequency=int(row["Frequency"]),
recovery_rate=float(row["Recovery_Rate"]),
Expand Down Expand Up @@ -183,7 +186,10 @@ def get_EquityShare(filename: str):
frequency=int(row["Frequency"]),
units = float(row["Units"]),
market_price=float(row["Market_Price"]),
growth_rate=float(row["Growth_Rate"]))
growth_rate=float(row["Growth_Rate"]),
spread_country=float(row["Spread_Country"]),
spread_sector=float(row["Spread_Sector"]),
spread_stress=float(row["Spread_Stress"]))
yield equity_share


Expand Down
Loading

0 comments on commit 751a166

Please sign in to comment.