当前位置: 首页>>代码示例>>C#>>正文


C# ConstructGen.DisplayInGrid方法代码示例

本文整理汇总了C#中ConstructGen.DisplayInGrid方法的典型用法代码示例。如果您正苦于以下问题:C# ConstructGen.DisplayInGrid方法的具体用法?C# ConstructGen.DisplayInGrid怎么用?C# ConstructGen.DisplayInGrid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConstructGen的用法示例。


在下文中一共展示了ConstructGen.DisplayInGrid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GoMulti

    public static void GoMulti()
    {
      var data = DataRetriever.GetData(indexStart_: "ES", suffix_: "Index", contractIndex_: 1);

      var listOfEvals = new List<ReturnsEval.DataSeriesEvaluator>();

      foreach (var firstWindow in new[] {5, 10, 15, 20, 25, 50, })
      {
        var indic = new SI.Research.Technicals.MACross(firstWindow, firstWindow * 2);

        var signals = indic.GenerateWeightSeries(data, null);

        for (int i = 0; i < signals.Length; ++i)
          signals.Data[i] = signals.Data[i] < 0d ? -1d : 1d;

        signals = CollapseToChanges(signals);

        if (false)
        {
          var con = new ConstructGen<double>(new[] { "Signal", "CleanPrice" });
          con.SetColumnValues(0, signals);

          foreach (var date in con.Dates)
            con.SetValue(date, 1, data.ValueOnExactDate(date));

          con.DisplayInGrid("changes with price levels");
        }

        //signals.DisplayInGrid("changes");


        var pnl = GeneratePnl(data, signals);

        var eval = new ReturnsEval.DataSeriesEvaluator(pnl.Dates, pnl.Data, string.Format("ES_{0}", firstWindow), ReturnsEval.DataSeriesType.Returns);
        listOfEvals.Add(eval);

      }
      listOfEvals.Display("blah");
    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:39,代码来源:TryStuffOut.cs

示例2: Go

    public static void Go()
    {
      // var is like 'dim'

      // make an array of size 10 - each initalized to the default double value i.e. 0d

      var arr = new double[10];

      // I could 'initialise' the values of this array in one call:

      arr = new double[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

      // an expanding construct is a list

      // make a list that I can only put doubles into

      var list = new List<double>();
      list.Add(1);
      list.Add(2);
      list.Add(3);

      // this is exactly the same as using an intializer:

      list = new List<double> {1, 2, 3};

      // I can use in built stuff to convert this to an array really easily

      double[] arr2 = list.ToArray();

      // dictionaries are lookups or hashmaps with types

      var birthdays = new Dictionary<string, DateTime>();
      birthdays.Add("Ben", new DateTime(1979, 12, 11));
      //or
      birthdays["Jess"] = new DateTime(1985, 1, 19);

      // note, the first method (.Add) will throw an exception if the item already exists, the second method will just overwrite

      // might be better to:
      if (birthdays.ContainsKey("Ben"))
        birthdays.Add("Ben", new DateTime(1979, 12, 11));

      // as we're dealing with time series a lot, I have created some classes that make it easier to work with dates and associated values

      // first of these is DatedDataCollection<T> where T is normally 'double'.

      // these are created with an array of Dates, and an array of 'Ts', which obviously must be of the same length, as the values correspond


      // NOTE: creating array on 1st, 3rd, 5th

      var dtsArray = new DateTime[] {new DateTime(2001, 1, 1), new DateTime(2001, 1, 3), new DateTime(2001, 1, 5)};
      var valuesArray = new double[] {1.21, 1.45, 1.65};

      var ddc = new DatedDataCollectionGen<double>(dtsArray, valuesArray);

      // obviously you wouldn't put normally create ddc like this - it normally gets populated from calls the the database or bbg initially, but we'll 
      // look at that later

      var date4th = new DateTime(2001, 1, 4);

      var value = ddc.ValueOnExactDate(date4th);  // this will fail as I'm insisting on the date being exact and there's nothing for 4th

      var value2 = ddc.ValueOnDate(date4th); // this will give me a value equal to that on the 3rd, since that is value for max date that is before 4th

      var value3 = ddc.ValueOnExactDate_Zero(date4th); // this won't fail but will pass back zero if there isn't an exact date

      // I've extended the classes to make it really easy to plot and see stuff

      ddc.DisplayColumnChart("Values in column chart");
      ddc.DisplayInGrid("values in grid");
      ddc.DisplayLineChart("Line chart");

      // this might be a bit of a leap, but I could very quickly extract EUR values from bloomberg in the following way, and display in a graph

      BbgTalk.HistoryRequester.GetHistory(new DateTime(2001, 1, 1),"EUR Curncy","PX_CLOSE",true)
        .DisplayLineChart("EUR from bbg from 2001");

      // what's this done?

      // BbgTalk.HistoryRequest knows how to connect to bloomberg and pulls out the series as a DatedDataCollection (so long as you're logged into bloomberg)

      DatedDataCollectionGen<double> euroSeries = BbgTalk.HistoryRequester.GetHistory(new DateTime(2001, 1, 1),
        "EUR Curncy", "PX_CLOSE", true);

      // then we displayed in a line chart:

      euroSeries.DisplayLineChart("EUR");

      // what else could we do with this euro series?

      // convert to returns:
      var euroReturns = euroSeries.ToReturns();
      var cumulative = euroReturns.ToCumulative();

      var stdFromMean = euroSeries.ToStdevFromMean(meanWindowLength_: 21, sdWindowLength_: 126);

      // I've also done a load of stuff to transform this series, take a look at HelperMethods.
      
      // often, we don't deal with individual price series, though we need inline data
//.........这里部分代码省略.........
开发者ID:heimanhon,项目名称:researchwork,代码行数:101,代码来源:L1.cs

示例3: Go_multiMA3Complex_MR

    public static void Go_multiMA3Complex_MR(string futureStart_, string suffix_, int contractIndex_)
    {
      //var data = DataRetriever.GetData("ES", "Index", contractIndex_);
      var data = DataRetriever.GetData(futureStart_, suffix_, contractIndex_);
      DataRetriever.ChartData(futureStart_, suffix_, contractIndex_);

      //data = Singleton<SI.Data.FXSpots>.Instance.GetData(new DateTime(2003, 1, 1), DateTime.Today).GetColumnValuesAsDDC(SI.Data.Currency.TWD.ArrayIndex);
      //data = BbgTalk.HistoryRequester.GetHistory(new DateTime(2009, 1, 1), "ES1 Index", "PX_LAST", true);

      var listOfEvals = new List<ReturnsEval.DataSeriesEvaluator>();

      var mas = new int[] {5, 10, 15, 20, 25, 30, 35, 40, 45, 50};

      mas = new int[] {15};

      foreach (var firstWindow in mas )
      {
        var args = new SI.Research.Technicals.MA3ComplexArgs()
        {
          MA1Win = firstWindow,
          MA2Win = firstWindow*2,
          MA3Win = firstWindow*4,
          Long = -1d,
          Long_1MA = -0.5d,
          Long_2MA = 0.5d,
          Short = 1d,
          Short_1MA = 0.5d,
          Short_2MA = -0.5d
        };

        var indic = new SI.Research.Technicals.MA3ComplexIndicator(args);

        var signals = indic.GenerateWeightSeries(data, null);

        signals = CollapseToChanges(signals);

        if (true)
        {
          var con = new ConstructGen<double>(new[] { "Signal", "CleanPrice" });
          con.SetColumnValues(0, signals);

          foreach (var date in con.Dates)
            con.SetValue(date, 1, data.ValueOnExactDate(date));

          con.DisplayInGrid("changes with price levels");
        }

        //signals.DisplayInGrid("changes");


        var pnl = GeneratePnl(data, signals);

        var eval = new ReturnsEval.DataSeriesEvaluator(pnl.Dates, pnl.Data, string.Format("{2}_{0}_{1}", contractIndex_, args.ToString(),futureStart_), ReturnsEval.DataSeriesType.Returns);
        listOfEvals.Add(eval);
        //eval.Display(eval.Name);

        //pnl.ToCumulative().DisplayLineChart("ES");
      }
      listOfEvals.Display("blah");
    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:60,代码来源:TryStuffOut.cs

示例4: Compare

    public static void Compare(string indexStart_, string suffix_)
    {
      var closePrices = GetData(indexStart_, suffix_);
      var closePrices2 = GetData2(indexStart_, suffix_);

      var con = new ConstructGen<double>(new string[] { "First", "Second" });

      con.SetColumnValues(0, closePrices);
      con.SetColumnValues(1, closePrices2);

      if (con.NeedsToSortKeys())
        con.SortKeys();

      con.DisplayInGrid("Compare");

    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:16,代码来源:DataRetriever.cs


注:本文中的ConstructGen.DisplayInGrid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。