private void bindToEditorResult()
    {
      var def = m_structEditor.GenerateDefinition();

      if ((def == null && StructureDefinition != null) || (def != null && StructureDefinition == null) || string.Compare(StructureDefinition.Description, def.Description, true) != 0)
      {
        StructureDefinition = def;
        setTextOfStructures();
        OnStructureChanged(new StructureChangedEventArgs(StructureDefinition));
      }
    }
Example #2
0
    public CMTStructure(Focus focus_, CMTStructureDefinition definition_)
      :base(definition_.Points.Select(x=>x.Market).Select(mkt=>CountryBondSource.GetInstance(mkt).GetSmoothCurveGroupForFocus(focus_).LiveCMT) )
    {
      Definition = definition_;
      Focus = focus_;

      m_name = new TextSortableByDate(definition_.Description);

      m_lines =
        definition_.Points.Select(x => CountryBondSource.GetInstance(x.Market).GetSmoothCurveGroupForFocus(focus_).LiveCMT)
          .ToArray();

      // might need to change this later to cater for 'n' day change
      if (Levels != null && Levels.Length > 0)
        m_priorValue = Levels.LastDataValue;
    }
    public CMTStructure GetStructureImpl(Focus focus_, CMTStructureDefinition def_)
    {
      if (def_ == null) return null;

      var key = GetKey(focus_, def_);

      lock (_instance)
      {
        if (m_underlyingCache.ContainsKey(key))
          return m_underlyingCache[key];

        var o = new CMTStructure(focus_, def_);
        m_underlyingCache.Add(key, o);
        return o;
      }
    }
Example #4
0
 internal CMTStructure GetStructure(CMTStructureDefinition definition_, bool cached_)
 {
   return cached_
     ? CMTStructureCache.GetInstance().GetStructureImpl(Focus, definition_)
     : new CMTStructure(Focus, definition_);
 }
 public StructureChangedEventArgs(CMTStructureDefinition def_)
 {
   Definition = def_;
 }
Example #6
0
 public static DatedDataCollectionGen<double> GetHistoricalCMT(Focus focus_, CMTStructureDefinition definition_)
 {
   return definition_.Points.Aggregate<WeightedTenorPointReadonly, DatedDataCollectionGen<double>>(null,
       (collation, point) =>
         collation == null
           ? GetHistoricalCMT(point.Market, focus_, point.Tenor).MultiplyBy(point.Multiplier)
           : collation.Plus(
             GetHistoricalCMT(point.Market, focus_, point.Tenor).MultiplyBy(point.Multiplier)));
 }
 private static string GetKey(Focus focus_, CMTStructureDefinition def_)
 {
   return string.Join("_", focus_, def_);
 }