private async Task initiate(CarbonClient cc_, BondMeasures listenToThis_) { m_fcsCurve = await IRCurveImpl.Get(SwapCurve.GetForecastCurve(), DateContext, cc_); // if we're doing calcs on the forwards, then don't need to listen to the curve directly // as the forward price will be updated as a result of a change in curve and will trickle // through to us as a price update if (SettleDate == DateContext.SpotSettle) m_fcsCurveDisp = m_fcsCurve.GetMonitor()/*.Throttle(TimeSpan.FromSeconds(10),Scheduler.Default)*/.Subscribe(handleFcstCurveUpdate); if (SwapCurve.GetForecastCurve() == SwapCurve.GetDiscountCurve()) { m_disCurve = m_fcsCurve; } else { m_disCurve = await IRCurveImpl.Get(SwapCurve.GetForecastCurve(), DateContext, cc_); if (SettleDate == DateContext.SpotSettle) m_disCurveDisp = m_disCurve.GetMonitor()/*.Throttle(TimeSpan.FromSeconds(10), Scheduler.Default)*/.Subscribe(handleDiscCurveUpdate); } // var flds = new[] { BondMeasure.Price, BondMeasure.Yield }; Array.ForEach(flds, fld => { var d = listenToThis_.GetValue(fld); if (d.HasValue) m_measures.SetValue(fld, d.Value); }); calcMMS(); calcZSpread(); }
public BondMeasureCalcPriceYield(Bond bond_, AsOfAndSpotSettle context_, DateTime settleDate_, BondMeasures measures_) : base (bond_, context_, settleDate_, measures_) { m_measuresDisp = measures_.Subscribe(handleUpdate); { var px = measures_.GetValue(BondMeasure.Price); if (px.HasValue) handleUpdate(Tuple.Create(BondMeasure.Price, px.Value)); } }
public BondMeasureCalcFwdPriceYield(Bond bond_, AsOfAndSpotSettle dateContext_, DateTime settlDate_, BondMeasures spotMeasures_, BondMeasures measures_) : base(bond_, dateContext_, settlDate_,measures_) { m_spotMeasureDisp = spotMeasures_.Subscribe(handleSpotMeasureUpdated); { var px = spotMeasures_.GetValue(BondMeasure.Price); if (px.HasValue) handleSpotMeasureUpdated(Tuple.Create(BondMeasure.Price, px.Value)); } }