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 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);
    }
Ejemplo n.º 3
0
    private SmoothCurveCalculator createModDurationFitter()
    {
      m_modDurFitter = new SmoothCurveCalculator(
        cml_: new CMTLine(Market,Focus.None),
        cmlEndTenor_: 34,
        cmlStartTenor_: 1,
        list_: Lines,
        timeToMaturityField_: BondField.TimeToMaturity,
        valueField_: BondField.ModDuration,
        fittedValueField_: BondField.None,
        settings_: new SmoothCurveSettings(FitPhases.Double),
        recalcNumber_: -1,
        updateOnCalcEvent_: false);

      m_modDurFitter.RebuildCurveAndApplyResults();

      return m_modDurFitter;
    }