public async Task<BondMeasureCalcSpreadsOverCurve> CreateFullMeasuresCalculator(SwapCurve curve_, CarbonClient cc_) { return await BondMeasureCalcSpreadsOverCurve.Create( bond_: m_bond, swapcurve_: curve_, updateThis_: new BondMeasures(m_bond), listenToThis_: m_measures, cc_: cc_, settleDate_: SettleDate, dateContext_: DateContext); }
private BondMeasureCalcSpreadsOverCurve( Bond bond_, SwapCurve swapcurve_, AsOfAndSpotSettle dateContext_, DateTime settleDate_, BondMeasures updateThis_, BondMeasures listenToThis_ ) : base(bond_,dateContext_,settleDate_,updateThis_) { SwapCurve = swapcurve_; m_listenToThisDisp = listenToThis_.Subscribe(listenToUpdated); m_myMeasuresDisp = updateThis_.Subscribe(myMeasuresUpdated); }
private async Task initiate(BondMarket market_, SwapCurve curve_, CarbonClient cc_) { m_priceYields = market_.Bonds.Where(x => x.Value.Maturity > SettleDate) .Select(x => x.Value.CreatePriceYield(DateContext, SettleDate)); var list = new List<BondMeasureCalcSpreadsOverCurve>(); foreach (var v in m_priceYields) list.Add(await v.CreateFullMeasuresCalculator(curve_, cc_)); m_spreads = list; //m_spreads = m_priceYields.Select(x => x.CreateFullMeasuresCalculator(curve_, cc_)); m_values = m_spreads.ToDictionary(x => x.Measures.Bond.Isin, x => x.Measures); }
public static double CalcMMS(Bond bond_, SwapCurve swapCurve_, DateTime settleDate_, Tuple<DateTime[], double[]> fcs, Tuple<DateTime[], double[]> dis) { var conv = swapCurve_.GetConventions(); return BondAnalytics.CalcMMS( startDate: settleDate_, maturityDate: bond_.Maturity, dctType: conv.DayCount, fixedFreq: conv.FixedFreq, floatFreq: conv.FloatFreq, discCurveDates: dis.Item1, discDfs: dis.Item2, fcstCurveDates: fcs.Item1, fcstDfs: fcs.Item2, holidays: null, stubExpiries: null, stubTenors: null, stubValues: null, fixingTenors: null, fixings: null, firstCpnDate: bond_.FirstCouponDate, blendIndex: 0); }
public CMT CreateCMTImpl(BondMeasure field_, BondMarketPricer pricer_, SwapCurve curve_) { return new CMT( structure_: this, initialField_: field_, curve_: curve_, pricer_: pricer_); }
public async Task<CMT> CreateCMTImpl(BondMeasure field_, AsOfAndSpotSettle asOfAndSpotSettle_, DateTime settleDate_, SwapCurve curve_, CarbonClient cc_) { var pricer = await BondMarketPricer.Create(Market, curve_, asOfAndSpotSettle_, settleDate_, cc_); return new CMT( structure_: this, initialField_: field_, curve_: curve_, pricer_: pricer ); }
public static double CalcMMS(Bond bond_, SwapCurve swapCurve_, DateTime settleDate_, IRCurveImpl forecastCurve_, IRCurveImpl discountCurve_) { return CalcMMS(bond_, swapCurve_, settleDate_, forecastCurve_.GetValues(), discountCurve_.GetValues()); }
public static async Task<BondMeasureCalcSpreadsOverCurve> Create( Bond bond_, SwapCurve swapcurve_, AsOfAndSpotSettle dateContext_, DateTime settleDate_, BondMeasures updateThis_, BondMeasures listenToThis_, CarbonClient cc_ ) { var impl = new BondMeasureCalcSpreadsOverCurve(bond_, swapcurve_, dateContext_, settleDate_, updateThis_, listenToThis_); await impl.initiate(cc_,listenToThis_); return impl; }
public static async Task<BondMarketPricer> Create(BondMarket market_, SwapCurve curve_, AsOfAndSpotSettle dateContext_, DateTime settleDate_, CarbonClient cc_) { var ret = new BondMarketPricer(dateContext_, settleDate_); await ret.initiate(market_, curve_, cc_); return ret; }