Node org.unizone.finance.interest.Bond

org.unizone.0.8535
Instance of TypeScriptInfo

Node dataValue
org.edgescript.TypeScriptInfo.prerequisiteParcelsList{}
org.edgescript.TypeScriptInfo.prerequisiteMethodsList{}
org.edgescript.TypeScriptInfo.script/* constructor() { InstrumentInterest:(); } Array[Symbol] defaultAspects() { #(#bid, #maturity, #coupon); } class Real dirtyPriceGreek(Time settlementDate, Time maturity, Real rate, Real coupon) { if (rate == null) return null; Time couponDate = maturity; if (maturity < settlementDate) return null; Real t = couponDate.subtractDate360(settlementDate) / 360.0; Real price = 100 / (1 + rate / 100) ^ t; while ((t = couponDate.subtractDate360(settlementDate) / 360.0) >= 0) { if (t < 1) t = couponDate.subtractDate(settlementDate) / 365.0; price = price + coupon / (1 + rate / 100) ^ t; couponDate = couponDate.addYears(-1); } price; } Real dirtyPriceGreek() { dirtyPriceGreek( Time{external cond_history}.settlement(settlementDays()), Time{aspectValue(#maturity)}, aspectReal(#value), aspectReal(#coupon)) } class Real cleanPriceQuote(Time settlementDate, Time maturity, Real rate, Real coupon) { Real price = dirtyPriceGreek(settlementDate, maturity, rate, coupon); if (price == null) return null; Time couponDate = maturity; Real t; while ((t = couponDate.subtractDate360(settlementDate) / 360.0) >= 1) couponDate = couponDate.addYears(-1); return ((price - (coupon * (1 - t))) * 1000).round / 1000.0; } class Real dirtyPriceQuote(Time settlementDate, Time maturity, Real rate, Real coupon) { Real clean = cleanPriceQuote(settlementDate, maturity, rate, coupon); if (clean == null) return null; Time couponDate = maturity; Real t; while ((t = couponDate.subtractDate360(settlementDate) / 360.0) >= 1) couponDate = couponDate.addYears(-1); return ((clean + coupon * (1 - t)) * 1000000).round / 1000000.0; } class Real delta(Time settlementDate, Time maturity, Real rate, Real coupon) { Real step = 0.01; 5000 * (dirtyPriceQuote(settlementDate, maturity, rate - step, coupon) - dirtyPriceQuote(settlementDate, maturity, rate + step, coupon)); } class Real convexity(Time settlementDate, Time maturity, Real rate, Real coupon) { Real step = 0.01; Real tmp = dirtyPriceQuote(settlementDate, maturity, rate + step, coupon) + dirtyPriceQuote(settlementDate, maturity, rate - step, coupon) - 2 * dirtyPriceQuote(settlementDate, maturity, rate, coupon); tmp / (step ^ 2); } class Real duration(Time settlementDate, Time maturity, Real rate, Real coupon) { if (rate == null) return null; Time couponDate = maturity; if (maturity < settlementDate) return null; Real t = couponDate.subtractDate360(settlementDate) / 360.0; Real price = 100 * t / (1 + rate / 100) ^ t; while ((t = couponDate.subtractDate360(settlementDate) / 360.0) >= 0) { if (t < 1) t = couponDate.subtractDate(settlementDate) / 365.0; price = price + coupon * t / (1 + rate / 100) ^ t; couponDate = couponDate.addYears(-1); } price / dirtyPriceGreek(settlementDate, maturity, rate, coupon); } class Real modDuration(Time settlementDate, Time maturity, Real rate, Real coupon) { duration(settlementDate, maturity, rate, coupon) / (1 + rate / 100) } */
org.edgescript.TypeScriptInfo.defineTypeorg.unizone.finance.interest.Bond
org.edgescript.TypeScriptInfo.prerequisiteScriptsList{}