public SmoothCurveAndSettingsGroup(FitPhases phases_, CountryBondSource source_, BondField timeToMaturity_, Focus focus_, BondField minusField_, BondField minusFieldFitted_, int recalcNumber_, bool fitOnEvent_ = true) : this(phases_, source_, timeToMaturity_, focus_, recalcNumber_, fitOnEvent_) { // explanation of logic of last 2 arguments // false => don't want to continually recalc on the recalc cycle, but only once // true => if the MinusOffset changes, we want to recalculate DateTime thirtyYearsTime = DateTime.Today.AddYears(30); MinusCMT = new CMTLine(source_.Market,focus_); MinusCalculator = new SmoothCurveCalculator( cml_: MinusCMT, cmlStartTenor_: 1, cmlEndTenor_: 34, list_: source_.Lines.Where(x => x.Maturity <= thirtyYearsTime).ToList(), timeToMaturityField_: timeToMaturity_, valueField_: minusField_, fittedValueField_: minusFieldFitted_, recalcNumber_: recalcNumber_, updateOnCalcEvent_: false, updateOnMinusOffsetChange_: true, settings_: Settings); }
public LivePointUpdater(DataRow row_, CMTLine line_, int point_) { m_row = row_; m_line = line_; m_propName = string.Format("Y{0}", point_); m_point = point_; subscribe(true); }
public CMTLineDiff(CMTLine a_, CMTLine b_) : base(a_.Market,a_.Focus) { m_a = a_; m_b = b_; subscribe(); reread(); }
public SmoothCurveAndSettingsGroup(FitPhases phases_, CountryBondSource source_, BondField timeToMaturity_, Focus focus_, int recalcNumber_, bool fitOnEvent_=true) { m_settings = new SmoothCurveSettings(phases_); LiveCMT = new CMTLine(source_.Market,focus_); DateTime thirtyYearsTime = DateTime.Today.AddYears(34); LiveCalculator = new SmoothCurveCalculator( cml_: LiveCMT, cmlStartTenor_: 1, cmlEndTenor_: 34, list_: source_.Lines.Where(x => x.Maturity <= thirtyYearsTime).ToList(), timeToMaturityField_: timeToMaturity_, valueField_: BondAnalysisLineHelper.GetFieldForFocusAndType(focus_,FieldType.Live), fittedValueField_: BondAnalysisLineHelper.GetFieldForFocusAndType(focus_,FieldType.FittedLive), recalcNumber_: recalcNumber_, updateOnCalcEvent_: fitOnEvent_, settings_: Settings); }
public void Dispose() { subscribe(false); m_line = null; m_row = null; }
public SmoothCurveCalculator( CMTLine cml_, int cmlStartTenor_, int cmlEndTenor_, IList<BondAnalysisLine> list_, BondField timeToMaturityField_, BondField valueField_, BondField fittedValueField_, SmoothCurveSettings settings_, int recalcNumber_, bool updateOnCalcEvent_=true, bool updateOnMinusOffsetChange_=false) { m_bondList = list_; m_timeToMaturityField = timeToMaturityField_; m_valueField = valueField_; m_fittedValueField = fittedValueField_; m_settings = settings_; m_cmlStartTenor = cmlStartTenor_; m_cmlEndTenor = cmlEndTenor_; m_fitter = new Symmetry.Analytics.NelsonSiegelFunctions(); m_cml = cml_; //m_settings.PropertyChanged += (a, b) => RebuildCurve(reReadSetup_: true); reReadSetup(); m_applyCycleNumber = recalcNumber_; #if DEBUG Logger.Debug(string.Format("{0} fit will be generated on cycle {1}", m_cml.Market, m_applyCycleNumber), typeof(SmoothCurveCalculator)); #endif m_updateOnCalcEvent = updateOnCalcEvent_; subscribeToCentralEvent(); // if the curve build settings change then want to recalc everything settings_.PropertyChanged += (a, b) => { Logger.Debug(string.Format("Args changed - recalcing {0} fit", m_valueField), typeof (SmoothCurveCalculator)); RebuildCurveAndApplyResults(); }; if (updateOnMinusOffsetChange_) { m_updateOnMinusOffsetChange = true; GlobalSettings.Instance().PropertyChanged += (a, b) => { if (String.Compare(b.PropertyName, "MinusOffset", StringComparison.OrdinalIgnoreCase) == 0) { // this will mean this will get updated on the next cycle subscribeToCentralEvent(true); } }; } foreach (var bond in m_bondList) bond.PropertyChanged += (x, y) => { if (String.Compare("IncludeInFit", y.PropertyName, StringComparison.OrdinalIgnoreCase) == 0) { RebuildCurve(reReadSetup_: true); ApplyBuildResults(); } }; ; }
protected CMTLineDerivation(CMTLine source_) : this(new[] { source_}) { }