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


C# ConstructGen.GetColumnValues方法代码示例

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


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

示例1: expandToFullUniverse

    private static ConstructGen<double> expandToFullUniverse(ConstructGen<double> input_)
    {
      if (input_.ArrayLength == Singleton<FXIDs>.Instance.Count)
        return input_;

      System.Diagnostics.Debug.Assert(input_.ColumnHeadings != null, "Column Headings not set on ConstructGen<double> wts, therefore can't ascertain securities");

      ConstructGen<double> ret = new ConstructGen<double>(Singleton<FXIDs>.Instance.Count);
      ret.ColumnHeadings = Singleton<FXIDs>.Instance.ColumnHeadings;

      for (int i = 0; i < input_.ArrayLength; ++i)
      {
        Currency c = Singleton<FXIDs>.Instance[input_.ColumnHeadings[i]];

        ret.SetColumnValues(c.ArrayIndex, input_.Dates.ToArray<DateTime>(), input_.GetColumnValues(i));
      }
      return ret;
    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:18,代码来源:WtsAnalysisCompareControl.cs

示例2: doPnl

    protected override SI.ReturnsEval.DataSeriesEvaluator doPnl(TraderArgs args_, ConstructGen<double> wts_)
    {
      ConstructGen<double> allCcys = new ConstructGen<double>(Singleton<FXIDs>.Instance.ColumnHeadings);

      for (int i = 0; i < args_.Products.Count; ++i)
      {
        ProductFX prod = (ProductFX)args_.Products[i];
        allCcys.SetColumnValues(prod.CoreProduct.ArrayIndex, wts_.Dates.ToArray(), wts_.GetColumnValues(i));
      }

      var result = ReturnsFromFXWeights.DoIt_DailyWeights(allCcys);
      var eval = new ReturnsEval.DataSeriesEvaluator("FX pnl", ReturnsEval.DataSeriesType.Returns);

      if (args_.WtIndicators.Any())
        eval.Name = string.Format("FX : {0}", args_.WtIndicators[0].ToString());
      
      eval.AddInnerSeries(result.CombinedPnl.Dates.ToArray(), result.CombinedPnl.ToArray(), result.CombinedPnl.ColumnHeadings);

      return eval;
    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:20,代码来源:TraderFX.cs

示例3: Create

    public override void Create(ConstructGen<double> wts_, ConstructGen<double> c2v_, ConstructGen<double> perf_)
    {
      var indicies =
        Singleton<FXIDs>.Instance.Where<Currency>(x => x.IsGroup(FX_Group))
          .Select<Currency, int>(x => x.ArrayIndex)
          .ToArray();


      var wtsForGroup = wts_.GetColumnValues(indicies);
      var c2vForGroup = c2v_.GetColumnValues(indicies);
      var perfForGroup = perf_.GetColumnValues(indicies);

      base.Create(wtsForGroup, c2vForGroup, perf_);

      double[] ctvDaily = new double[c2vForGroup.Dates.Count];
      for (int i = 0; i < c2vForGroup.Dates.Count; ++i)
        ctvDaily[i] = Statistics.Sum(c2vForGroup.GetValues(c2vForGroup.Dates[i]));
      C2V = new DataEncapsValue(new DatedDataCollectionGen<double>(c2vForGroup.Dates.ToArray(), ctvDaily),"C2V");

      double[] perfDaily = new double[perfForGroup.Dates.Count];
      for (int i = 0; i < perfForGroup.Dates.Count; ++i)
        perfDaily[i] = Statistics.Sum(perfForGroup.GetValues(perfForGroup.Dates[i]));
      Return = new DataEncapsValue(new DatedDataCollectionGen<double>(perfForGroup.Dates.ToArray(), perfDaily), DataEncapsDispValueType.Sum, "Return");
    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:24,代码来源:WtsAnalyzerFXGroup.cs

示例4: Create

    public void Create(ConstructGen<double> con_)
    {
      setupDataTable();

      double cumulative = 0d;

      Side lastSide = Side.None;

      foreach (var date in con_.Dates)
      {
        var values = con_.GetValues(date);

        var wt = values[(int)Headings.Weight];
        var dailyPnl = values[(int)Headings.Pnl];
        var ccyrate = values[(int)Headings.Spot];

        cumulative += dailyPnl;

        dt.LoadDataRow(new object[] { date, cumulative, ccyrate, wt }, true);

        if (wt > 0d)
        {
          if (lastSide != Side.Long)
          {
            dtLongPoints.LoadDataRow(new object[] { date, ccyrate }, true);
            lastSide = Side.Long;
          }
        }
        else if (wt < 0d)
        {
          if (lastSide != Side.Short)
          {
            dtShortPoints.LoadDataRow(new object[] { date, ccyrate }, true);
            lastSide = Side.Short;
          }
        }
        else
        {
          if (lastSide != Side.Flat)
          {
            dtFlatPoints.LoadDataRow(new object[] { date, ccyrate }, true);
            lastSide = Side.Flat;
          }
        }
      }

      {
        var ccyAxix = ultraChart.CompositeChart.ChartAreas[0].Axes.FromKey("y_axis_ccyRate");

        ccyAxix.RangeType = AxisRangeType.Custom;
        var ccyValues = con_.GetColumnValues((int)Headings.Spot);
        ccyAxix.RangeMin = ccyValues.Min();
        ccyAxix.RangeMax = ccyValues.Max();
      }

      m_con = con_;
    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:57,代码来源:WtPnlAnalysis3.cs

示例5: Create

    public void Create(ConstructGen<double> con_)
    {
      setupDataTable();

      double cumulative = 0d;

      double? prevWt=null;

      foreach (var date in con_.Dates)
      {
        var values = con_.GetValues(date);

        var wt = values[(int)Headings.Weight];
        var dailyPnl = values[(int)Headings.Pnl];
        var ccyrate = values[(int)Headings.Spot];

        cumulative += dailyPnl;

        var objArr = new object[dt.Columns.Count];

        objArr[0] = date;
        objArr[1] = cumulative;

        var indexForWt = getIndexForWt(wt);
        objArr[indexForWt] = ccyrate;

        if (prevWt.HasValue)
        {
          var indexForPrevWt = getIndexForWt(prevWt.Value);

          if (indexForWt != indexForPrevWt)
            objArr[indexForPrevWt] = ccyrate;
        }


        objArr[5] = wt > 0d ? wt : 0d;
        objArr[6] = wt < 0d ? wt : 0d;

        dt.LoadDataRow(objArr, true);

        prevWt = wt;
      }

      {
        var ccyAxix = ultraChart.CompositeChart.ChartAreas[0].Axes.FromKey("y_axis_ccyRate");

        ccyAxix.RangeType = AxisRangeType.Custom;
        var ccyValues = con_.GetColumnValues((int)Headings.Spot);
        ccyAxix.RangeMin = ccyValues.Min();
        ccyAxix.RangeMax = ccyValues.Max();
      }

      m_con = con_;
    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:54,代码来源:WtPnlAnalysis2.cs

示例6: GetSumFlow

    public static ConstructGen<double> GetSumFlow(ConstructGen<double> fxWts_)
    {
      var ret = new ConstructGen<double>(fxWts_.ColumnHeadings);

      for (int i = 0; i < fxWts_.ArrayLength; ++i)
      {
        ret.SetValue(DateTime.Today, i, fxWts_.GetColumnValues(i).ToDiffs().ToAbs().Sum());
      }

      return ret;
    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:11,代码来源:BacktestHelper.cs

示例7: ComputeAvgsAndProb

        public Tuple<double[], double[]> ComputeAvgsAndProb(ConstructGen<double> con, Tuple<ConstructGen<double>, int, DateTime> conForProbability, int EventDayShift)
        {
            double[] avgs = new double[con.ArrayLength];
            var Probs = new double[conForProbability.Item1.ArrayLength];
            for (int i = 0; i < avgs.Length; ++i)
            {
                var validNumberSeries = con.GetColumnValues(i).Where(x => double.IsNaN(x) == false);

                if (!validNumberSeries.Any()) continue;

                avgs[i] = validNumberSeries.ToArray().Average();

                var alldiffs = conForProbability.Item1.GetColumnValues(i).Where(x => double.IsNaN(x) == false).ToList();
                Probs[i] = ProbabilityCalc.CalcProb(alldiffs, ProbCalcMethod);
            }
            EventReturns[con.Name] = new Tuple<double[], int>(avgs, EventDayShift);
            return new Tuple<double[], double[]>(avgs, Probs);
        }
开发者ID:heimanhon,项目名称:researchwork,代码行数:18,代码来源:CompositeViewModel.cs

示例8: Build

    public static void Build(BindingList<PnlPosRow> structure_, ReturnsEval.DataSeriesEvaluator parentEval_, ConstructGen<double> wts_, string[] wtsKeys_)
    {
      structure_.Clear();

      if (parentEval_.InnerSeries.Count != wts_.ArrayLength)
        return;

      List<DateTime> pnlDates = new List<DateTime>(parentEval_.Daily.Dates);

      for(int i=0;i<parentEval_.InnerSeries.Count;++i)
      {
        ReturnsEval.DataSeriesEvaluator eval = parentEval_.InnerSeries[i];

        PnlPosRow row = new PnlPosRow(eval.Name);

        int indexInWts = -1;
        for(int j=0;j<wtsKeys_.Length;++j)
          if (string.Compare(eval.Name, wtsKeys_[j]) == 0)
          {
            indexInWts = j;
            break;
          }

        if (indexInWts == -1)
          continue;

        double[] wtsColumn = wts_.GetColumnValues(indexInWts);

        DateTime startOfPeriod = wts_.Dates[0];

        for (int j = 1; j < wts_.Dates.Count; ++j)
        {
          // has weight flipped
          if (Statistics.AreSameSign(wtsColumn[j], wtsColumn[j - 1]) == false)
          {
            DateTime endOfPeriod = wts_.Dates[j];

            int indexOfStart = (startOfPeriod==wts_.Dates[0]) ? 0 : pnlDates.IndexOf(startOfPeriod);
            int indexOfEnd = pnlDates.IndexOf(endOfPeriod);

            double pnlOverPeriod = eval.Daily.CumulativeReturnSeries[indexOfEnd] - eval.Daily.CumulativeReturnSeries[indexOfStart];

            row.Add(new PnlPosPeriodRow(
              getSide(wtsColumn[j-1]),
              pnlDates[indexOfStart],
              pnlDates[indexOfEnd],
              pnlOverPeriod), false);

            startOfPeriod = endOfPeriod;
          }
        }

        int indStart = pnlDates.IndexOf(startOfPeriod);
        int indEnd = pnlDates.Count-1;

        // need to add int last item
        row.Add(new PnlPosPeriodRow(
          getSide(wtsColumn[wtsColumn.Length - 1]),
          pnlDates[indStart],
          pnlDates[indEnd],
          eval.Daily.CumulativeReturnSeries[indEnd] - eval.Daily.CumulativeReturnSeries[indStart]), true);

        structure_.Add(row);
      }
    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:65,代码来源:PnlPosRow.cs


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