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);
    }
Пример #2
0
 public CountryCurveControl(CountryBondSource source_)
   : this()
 {
   m_countryBondSource = source_;
   dummyBondDisplay1.Create(source_.Market);
   dummyBondDisplay1.DummyBond.PropertyChanged += (x, y) =>
   {
     if (String.CompareOrdinal("IsLive", y.PropertyName) == 0 || String.CompareOrdinal("Maturity", y.PropertyName) == 0)
       reloadSmoothCurves();
   };
 }
    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);
    }
Пример #4
0
    private void add(BindingList<BondSpreadLine> list_, CountryBondSource src1_, CountryBondSource src2_, bool firstFirst_)
    {
      Array.ForEach(src1_.Lines.ToArray(), benchBond =>
      {
        var closestBond =
          src2_.Lines.Select(x => new { Diff = Math.Abs((benchBond.Maturity - x.Maturity).TotalDays), Item = x })
            .OrderBy(x => x.Diff)
            .First();

        if (closestBond.Diff > DaysDiffTolerance) return;

        var line = firstFirst_ ? new BondSpreadLine(benchBond, closestBond.Item) : new BondSpreadLine(closestBond.Item, benchBond);

        if (
          list_.Any(
            x => object.ReferenceEquals(x.Lines[0], line.Lines[0]) && object.ReferenceEquals(x.Lines[1], line.Lines[1])))
          line.Dispose();
        else
          list_.Add(line);
      });
    }
Пример #5
0
    private static void stage3_populateBondsWithFittedValues(CountryBondSource countrySource_, DateTime date_)
    {
      if (countrySource_ == null || countrySource_.Lines == null) 
        return;

      foreach (var cBond in countrySource_.Lines)
      {
        var v = cBond.UnderlyingBond.TimeSeries.ValueOnExactDate(date_);

        if (v == null) // this should never be the case
          continue;

        v.MM_Yield_Fit = cBond.GetValue(BondField.YieldLiveFitted);
        v.MM_ASW_Fit = cBond.GetValue(BondField.ASWLiveFitted);
        v.MM_ZSpread_Fit = cBond.GetValue(BondField.CASLiveFitted);
        v.AdjustedZSpread = cBond.GetValue(BondField.CASLive);

        cBond.UnderlyingBond.Changed = true;
      }
    }
Пример #6
0
    public void Create()
    {
      BbgTalk.Core.GUI_INVOKE_CONTROL = this;
      m_countryBondSource = m_countryBondSource;

      mainGrid.Create(m_localList);
      mainGrid.StatCellClicked += handleCellClicked;

      // smart markings on fit y axis
      swccVsFit.SetYAxixTickStyle(Infragistics.UltraChart.Shared.Styles.AxisTickStyle.Smart);

      // no labels on different x axis
      swccChange.Chart.Axis.X.Labels.ItemFormat = Infragistics.UltraChart.Shared.Styles.AxisItemLabelFormat.None;

      focusSwitchControl1.SelectedFocus = m_countryBondSource.Focus;
      focusSwitchControl1.FocusChanged += (x, y) => m_countryBondSource.Focus = y.Focus;

      rebuildLocalList();

      m_countryBondSource.PropertyChanged += (a, b) =>
      {
        switch (b.PropertyName)
        {
          case "Focus":
            reloadAllStats();
            break;
        }
      };

      m_countryBondSource.DisplayArgs.PropertyChanged += (a, b) =>
      {
        switch (b.PropertyName)
        {
          case "StartTenor":
          case "EndTenor":
            reloadSmoothCurves();
            break;
          case "ZScore1":
          case "ZScore2":
            reloadFocusZScores(false);
            break;
        }
      };

      m_countryBondSource.DisplayArgs.GetClusterArgs(0).PropertyChanged += (a, b) => reloadClusterFlyZScores(0, false);
      m_countryBondSource.DisplayArgs.GetClusterArgs(1).PropertyChanged += (a, b) => reloadClusterFlyZScores(1, false);


      tbFlyZ1_1.Bind(m_countryBondSource.DisplayArgs.GetClusterArgs(0), "ZScore1", new Validators.IntValidator());
      tbFlyZ1_2.Bind(m_countryBondSource.DisplayArgs.GetClusterArgs(0), "ZScore2", new Validators.IntValidator());

      tbFlyZ2_1.Bind(m_countryBondSource.DisplayArgs.GetClusterArgs(1), "ZScore1", new Validators.IntValidator());
      tbFlyZ2_2.Bind(m_countryBondSource.DisplayArgs.GetClusterArgs(1), "ZScore2", new Validators.IntValidator());

      tbfocusZ1.Bind(m_countryBondSource.DisplayArgs, "ZScore1", new Validators.IntValidator());

      tbHighLowWindow.Bind(m_countryBondSource.DisplayArgs, "HighLowAvgWindow", new Validators.IntValidator());

      tbStartTenor.Bind(m_countryBondSource.DisplayArgs, "StartTenor", new Validators.IntValidator());
      tbEndTenor.Bind(m_countryBondSource.DisplayArgs, "EndTenor", new Validators.IntValidator());

      tbRepoRate.Bind(m_countryBondSource, "RepoRate", new Validators.DoubleValidator(null));

#if DEBUG
      mainGrid.AddClickHandler("Bond", (a, b) =>
      {
        var line = b.ListObject as BondAnalysisLine;
        if (line == null) return;
        SI.Common.CBBExecute.Execute(string.Format("<home><blp-0>{0} <GOVT> <go> FLDS <go>", line.UnderlyingBond.Isin));
      });

      mainGrid.AddClickHandler("ModifiedDuration", (a, b) =>
      {
        var line = b.ListObject as BondAnalysisLine;
        if (line == null) return;
        var dt = line.ValuesAsDataTable((BondField[])Enum.GetValues(typeof(BondField)));
        var grid = new SI.Controls.BoundInfraGrid();
        grid.Bind(dt);
        grid.DisplayInShowForm(string.Format("{0} underlying values", line.Bond));
      });
#endif

      mainGrid.AddClickHandler("ImageIncludeInFit", (a, b) =>
      {
        var line = b.ListObject as BondAnalysisLine;
        if (line == null) return;
        line.IncludeInFit = !line.IncludeInFit;
        reloadSmoothCurves();
      });


      reloadAllStats();
    }
 public void Create(CountryBondSource analyser_, BondField field_, TimePeriod period_)
 {
   Create(analyser_.Lines, field_, period_);
 }