Ejemplo n.º 1
0
    public static void Go(ComID[] commodities_, bool dispBW_=false)
    {
      var wts = CalculateWeights(commodities_);
      //wts.DisplayInGrid("weightings");
      var pnl = DoPnl(commodities_, wts);
      //pnl.DisplayInGrid("pnl");
      //return;

      var eval = new ReturnsEval.DataSeriesEvaluator("blah", ReturnsEval.DataSeriesType.Returns);

      var weightedBW = !dispBW_ ? null : DoBW(commodities_, wts);

      for (int i = 0; i < pnl.ArrayLength; ++i)
      {
        var comPnl = pnl.GetColumnValuesAsDDC(i);
        eval.AddInnerSeries(comPnl.Dates, comPnl.Data, pnl.ColumnHeadings[i]);

        if (weightedBW != null)
        {
          var chart = new SI.Controls.LineChartDataDisplay();
          chart.AddSeries(
            dates_: comPnl.Dates,
            values_: comPnl.ToCumulative().Data,
            desc_: "pnl",
            yAxisExtent_: 40,
            yLabelFormat_: "##0.0#%",
            yAxisLeft_: true);

          var com = weightedBW.GetColumnValuesAsDDC(i);

          com = new DatedDataCollectionGen<double>(wts.Dates.ToArray(), wts.Dates.Select(x => com.ValueOnDate(x)).ToArray());

          chart.AddSeries(
            dates_: com.Dates,
            values_: com.Data,
            desc_: "bw",
            yAxisExtent_: 40,
            yLabelFormat_: "##0.0###%",
            yAxisLeft_: false);

          chart.DisplayInShowForm(commodities_[i].Mnemonic);
        }
      }

      eval.Evaluate();

      eval.Display();
    }
Ejemplo n.º 2
0
    private void showFXRegion(Data.FXGroup group_)
    {
      ReturnsEval.DataSeriesEvaluator eval = new ReturnsEval.DataSeriesEvaluator(group_.ToString(), m_evaluator.DataType);

      foreach (ReturnsEval.DataSeriesEvaluator innerEval in m_evaluator.InnerSeries)
      {
        Data.Currency ccy = Singleton<Data.FXIDs>.Instance[innerEval.Name];

        if (ccy == null)
          continue;

        if (ccy.IsGroup(group_))
          eval.AddInnerEvaluator(innerEval);
      }

      eval.Evaluate(eval.All.MinDate, eval.All.MaxDate);

      ReturnsDisplay rd = new ReturnsDisplay();
      rd.Bind(eval);
      SI.Controls.ShowForm.Show(rd, FormBorderStyle.Sizable, null, FindForm().Text + " - " + group_.ToString());
    }