public static Tuple<DatedDataCollectionGen<string>, DatedDataCollectionGen<double>> GetItemsFromCarbonFrame(
     ChartComponent cc,
     Func<RollResults, RollResultContractItem> GetGenerationResult,
     Func<RollResultContractItem, DatedDataCollectionGen<RollResultItem>> GetResult)
 {
     var identifier = cc.Component.ToString();
     return GetItemsFromCarbonFrame(identifier, cc.Multiplier, GetGenerationResult, GetResult);
 }
Exemplo n.º 2
0
    private Tuple<DatedDataCollectionGen<Bond>, DatedDataCollectionGen<double>> getItems(ChartComponent cc_, CTDValueGeneration generation_)
    {
      var dates = m_rawData[cc_.Curve].Select(x => x.MarkDate).ToArray();
      var spreadsObject = m_rawData[cc_.Curve].Select(x => x[cc_.Component, generation_]);
      var value = spreadsObject.Select(x => x == null ? 0d : x[cc_.SpreadType] * cc_.Multiplier * 10000d).ToArray();

      var bonds = m_rawBonds.Select(x => x[cc_.Component, generation_]).ToArray();

      // fill in zeroes

      for (int i = 1; i < value.Length; ++i)
        if (value[i].IsZero())
        {
          // if bonds haven't changed then can take the previous price
          //if (bonds[i].SymmetryCode.Equals(bonds[i - 1].SymmetryCode))
            value[i] = value[i - 1];
          //else
          //  value[i] = double.NaN;
        }

      return new Tuple<DatedDataCollectionGen<Bond>, DatedDataCollectionGen<double>>(
        new DatedDataCollectionGen<Bond>(dates, bonds),
        new DatedDataCollectionGen<double>(dates, value));
    }
Exemplo n.º 3
0
 public ChartDataSource(ChartComponent[] chartComponents_, IDictionary<BondCurves, List<CTDLine<BondSpreads>>> spreads_, List<CTDLine<Bond>> bonds_)
 {
   Components = chartComponents_;
   m_rawData = spreads_;
   m_rawBonds = bonds_;
 }