protected override void OnClick(EventArgs e)
      {
        BindingList<WtsSeriesAnalyzer.WtRestriction> list = new BindingList<WtsSeriesAnalyzer.WtRestriction>();
        Array.ForEach(m_analyzer.SourceWts.ColumnHeadings, delegate(string name_) { list.Add(new WtsSeriesAnalyzer.WtRestriction(name_)); });

        ShowForm sf = new ShowForm();
        ApplyWeightRestrictionsControl con = new ApplyWeightRestrictionsControl(list);
        sf.Create(con);

        DialogResult result = DialogResult.Cancel;
        try
        {
          result = sf.ShowDialog();
        }
        catch
        {
          result = DialogResult.Cancel;
        }

        if (result == DialogResult.Cancel)
          return;

        ConstructGen<double> processWeights = m_analyzer.WhatIfTradingRestrictions(list.ToArray());

        var res = SI.Data.ReturnsFromFXWeights.DoIt_DailyWeights(processWeights);

        GetCov covDel = date_ => Singleton<CovarianceSource>.Instance.GetCovarianceForDateElesePrevious(date_);

        WtsSeriesAnalyzer w = new WtsSeriesAnalyzer(
          name_: string.Format("{0}_restricted",m_analyzer.Name),
          wts_: processWeights,
          dailyReturns_: res.CombinedPnl,
          covDelegate_: covDel
        );

        WtsSeriesAnalyzer original = new WtsSeriesAnalyzer(
          m_analyzer.Name,
          m_analyzer.SourceWts,
          m_analyzer.Performance,
          covDel);

        List<WtsSeriesAnalyzer> ll = new List<WtsSeriesAnalyzer>();
        ll.Add(original);
        ll.Add(w);



        WtsAnalysisCompareControl comparer = new WtsAnalysisCompareControl();
        comparer.Create(ll);
        comparer.DisplayInShowForm(string.Format("{0} before and after restricted weights", m_analyzer.Name));

      }
Ejemplo n.º 2
0
    public static ShowForm ShowDialog(IWin32Window owner_, Control c_, FormBorderStyle borderStyle_, Icon icon, string title_)
    {
      ShowForm sf = new ShowForm {FormBorderStyle = borderStyle_, Text = title_, Icon = icon};

      sf.Create(c_);

      if (icon == null && c_ is IFormIconProvider)
        sf.Icon = ((IFormIconProvider)c_).FormIcon;
      else
        sf.Icon = DefaultIcon;

      sf.ShowDialog(owner_);
      sf.BringToFront();
      return sf;
    }