Python - Calculate Adjusted Current Yield/Interest on Bonds

by matt392 in Circuits > Software

45 Views, 1 Favorites, 0 Comments

Python - Calculate Adjusted Current Yield/Interest on Bonds

adjustedcurrentyield.jpg
print ("Calculating Adjusted Current Yield/Interest/Income/Flat/Market/Running Yield for onds/Gilts")

# AdjustedCurrentYield = ((AnnualCouponPayments/CleanPrice)*100) +
# ((((100-CleanPrice)/YearsToMaturity)/CleanPrice)*100)

EnteredAnnualCouponPayments = input ("Enter the Annual Coupon Payments: ")
EnteredCleanPrice = input ("Enter the Clean Price: ")
EnteredYearsToMaturity = input ("Enter the Years To Maturity: ")

# Convert entered numbers to float
AnnualCouponPayments = float(EnteredAnnualCouponPayments)
CleanPrice = float(EnteredCleanPrice)
YearsToMaturity = float(EnteredYearsToMaturity)

LeftSideOfFormula = ((AnnualCouponPayments/CleanPrice)*100)
RightSideOfFormula = ((((100-CleanPrice)/YearsToMaturity)/CleanPrice)*100)
AdjustedCurrentYield = LeftSideOfFormula + RightSideOfFormula

print ("The Adjusted Current Yield is: ", AdjustedCurrentYield)

print ("Thank you to fxsolver.com for assistance with this equation.")