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


C# IContext.GetData方法代码示例

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


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

示例1: Run

 public void Run(IContext ctx)
 {
     results = new DataSet();
     DataTable table = new DataTable("TEST_LOOP_RESULTS_OUT");
     table.Columns.Add("n");
     table.Columns.Add("value");
     table.Columns.Add("col_count");
     var tbl = ctx.GetData(loopName).Tables[0];
     DataRow r = table.NewRow();
     r["n"] = -1;
     r["value"] = tbl.Rows.Count;
     table.Rows.Add(r);
     for (int i = 0; i < tbl.Rows.Count; i++)
     {
         string varVal = tbl.Rows[i]["value"].ToString();
         DataSet nodeResult = (DataSet)tbl.Rows[i][nodeName];
         DataTable t = nodeResult.Tables[tableName];
         int colCount = t.Columns.Count;
         DataRow row = table.NewRow();
         row["n"] = i;
         row["value"] = varVal;
         row["col_count"] = colCount;
         table.Rows.Add(row);
     }
     results.Tables.Add(table);
 }
开发者ID:AnDDen,项目名称:Hydrology,代码行数:26,代码来源:Class2.cs

示例2: generateEMA

 public static IList<double> generateEMA(IContext ctx, IList<double> source, int period)
 {
     return ctx.GetData(
         "EMA" + period.ToString(),
         new[] {period.ToString()}, delegate {
             return Series.EMA(source, period);
         }
     );
 }
开发者ID:sherman,项目名称:onTSLab,代码行数:9,代码来源:DataHelpers.cs

示例3: generateATR

 public static IList<double> generateATR(IContext ctx, ISecurity source, int period)
 {
     return ctx.GetData(
         "ATR" + period.ToString(),
         new[] {period.ToString()}, delegate {
             return Series.AverageTrueRange(source.Bars, period);
         }
     );
 }
开发者ID:sherman,项目名称:onTSLab,代码行数:9,代码来源:DataHelpers.cs

示例4: generateADX

        public static IList<double> generateADX(IContext ctx, ISecurity source, int period)
        {
            ADXFull generator = new ADXFull();
            generator.Context = ctx;
            generator.Period = period;

            return ctx.GetData(
                "ADX" + period.ToString(),
                new[] {period.ToString()}, delegate {
                    return generator.Execute(source);
                }
            );
        }
开发者ID:sherman,项目名称:onTSLab,代码行数:13,代码来源:DataHelpers.cs

示例5: Run

        public void Run(IContext ctx)
        {
            resultSet = new DataSet();
            DataTable kTable = new DataTable() { TableName = "Coefficient" };
            kTable.Columns.Add("Period");
            kTable.Columns.Add("K_srednee");
            kTable.Columns.Add("K_sigma");
            kTable.Columns.Add("K_cv");
            kTable.Columns.Add("K_cs");
            kTable.Columns.Add("K_eta");

            DataTable paramsTable = data.Tables["params"];
            var attrs = typeof(RepresentationCheck).GetCustomAttributes<ParameterAttribute>();

            int n = (int)attrs.First((param) => { return param.Name == "n"; }).DefaultValue;

            foreach (DataRow row in paramsTable.Rows)
            {
                switch (row["Name"].ToString())
                {
                    case "n":
                        n = int.Parse(row["Value"].ToString());
                        break;
                }
            }

            DataTable X_Table = ctx.GetData("FlowSequenceGeneration").Tables["FlowSequence"];

            List<double> k1 = CoefAvg(X_Table, new statistics(), n);
            List<double> k2 = CoefSigma(X_Table, new statistics(), n);
            List<double> k3 = Coef_Cv(X_Table, new statistics(), n);
            List<double> k4 = Coef_Cs(X_Table, new statistics(), n);
            List<double> k5 = Coef_Eta(X_Table, new statistics(), n);
            for (int i = 0; i < k1.Count; i++)
            {
                DataRow row = kTable.NewRow();
                row["Period"] = i + ".." + (i + n);
                row["K_srednee"] = k1[i];
                row["K_sigma"] = k2[i];
                row["K_cv"] = k3[i];
                row["K_cs"] = k4[i];
                row["K_eta"] = k5[i];
                kTable.Rows.Add(row);
            }
            resultSet.Tables.Add(kTable);
        }
开发者ID:AnDDen,项目名称:Hydrology,代码行数:46,代码来源:Represent.cs

示例6: draw

        public PnLReport draw(IContext context)
        {
            IPane profitPane = context.CreatePane("Profit", 20.0, true);

            if (null != profitSource) {
                profitPane.AddList(
                    "ProfitPerMonth",
                    profitSource,
                    ListStyles.HISTOHRAM,
                    0x336699,
                    LineStyles.SOLID,
                    PaneSides.VSIDE_LAST
                );
            }

            if (null != maxLossSource) {
                profitPane.AddList(
                    "MaxLossPerMonth",
                    maxLossSource,
                    ListStyles.HISTOHRAM,
                    0xff00000,
                    LineStyles.SOLID,
                    PaneSides.VSIDE_LAST
                );
            }

            if (null != profitSource) {
                IList<double> profitSma = context.GetData(
                    "ProfitSma",
                    new[] {"3"}, delegate {
                        return Series.SMA(profitSource, 3);
                    }
                );

                profitPane.AddList(
                    "ProfitPerMonthSma",
                    profitSma,
                    ListStyles.LINE,
                    0xff0000,
                    LineStyles.SOLID,
                    PaneSides.LEFT
                );
            }

            return this;
        }
开发者ID:sherman,项目名称:onTSLab,代码行数:46,代码来源:PnLReport.cs

示例7: generateSub

 public static IList<double> generateSub(IContext ctx, IList<double> source, int period)
 {
     return ctx.GetData(
         "Diff" + period.ToString(),
         new[] {period.ToString()}, delegate {
             return Series.Sub(source, Series.Shift(source, period));
         }
     );
 }
开发者ID:sherman,项目名称:onTSLab,代码行数:9,代码来源:DataHelpers.cs

示例8: generateSMA

 public static IList<double> generateSMA(IContext ctx, IList<double> source, int period, string cacheLabel)
 {
     return ctx.GetData(
         "SMA" + period.ToString(),
         new[] { cacheLabel }, delegate {
             return Series.SMA(source, period);
         }
     );
 }
开发者ID:sherman,项目名称:onTSLab,代码行数:9,代码来源:DataHelpers.cs

示例9: Run

        public void Run(IContext ctx)
        {
            resultSet = new DataSet();
            DataTable kTable = new DataTable() { TableName = "Parameters" };
            kTable.Columns.Add("average");
            kTable.Columns.Add("deviation");
            kTable.Columns.Add("variation");
            kTable.Columns.Add("asymmetry");
            kTable.Columns.Add("correlation");
            kTable.Columns.Add("eta");

            DataTable sequenceTable = new DataTable() { TableName = "ModifiedSequence" };
            sequenceTable.Columns.Add("const");
            sequenceTable.Columns.Add("linear-1");
            //sequenceTable.Columns.Add("linear-2");
            sequenceTable.Columns.Add("parabola-1");
            sequenceTable.Columns.Add("parabola-2");

            DataTable paramsTable = data.Tables["params"];
            var attrs = typeof(Transformation).GetCustomAttributes<ParameterAttribute>();

            double[] lambda_items = new double[lam_len];
            /*double n = (int)attrs.First((param) => { return param.Name == "n"; }).DefaultValue;
            int size = (int)attrs.First((param) => { return param.Name == "size"; }).DefaultValue;
            lambda_items[0] = (int)attrs.First((param) => { return param.Name == "lam1"; }).DefaultValue;
            lambda_items[1] = (int)attrs.First((param) => { return param.Name == "lam2"; }).DefaultValue;
            lambda_items[2] = (int)attrs.First((param) => { return param.Name == "lam3"; }).DefaultValue;
            lambda_items[3] = (int)attrs.First((param) => { return param.Name == "lam4"; }).DefaultValue;
            lambda_items[4] = (int)attrs.First((param) => { return param.Name == "lam5"; }).DefaultValue;*/

            foreach (DataRow row in paramsTable.Rows)
            {
                switch (row["Name"].ToString())
                {
                    case "n":
                        n = double.Parse(row["Value"].ToString());
                        break;
                    case "size":
                        size = int.Parse(row["Value"].ToString());
                        break;
                    case "lam0":
                        lambda_items[0] = double.Parse(row["Value"].ToString());
                        break;
                    case "lam1":
                        lambda_items[1] = double.Parse(row["Value"].ToString());
                        break;
                    case "lam2":
                        lambda_items[2] = double.Parse(row["Value"].ToString());
                        break;
                    case "lam3":
                        lambda_items[3] = double.Parse(row["Value"].ToString());
                        break;
                    case "lam4":
                        lambda_items[4] = double.Parse(row["Value"].ToString());
                        break;
                    case "lam5":
                        lambda_items[5] = double.Parse(row["Value"].ToString());
                        break;
                }
            }

            stat = new Statistic(size);
            DataTable series_Table = ctx.GetData("FlowSequenceGeneration").Tables["FlowSequence"];

            double[] series = new double[size];
            series = GetTableValues(series_Table, 0);

            params1 = new double[index_size, lam_len, 6];

            //разбиение
            N = series.Length;
            int n1 = Convert.ToInt32(N * n);
            int n2 = N - n1;
            List<double> mods1 = new List<double>();
            List<double> mods2 = new List<double>();
            int negCount = 0;

            for (int index = 0; index < index_size; index++)
            {
                for (int i = 0; i < lam_len; i++)
                {
                    double lambda = lambda_items[i];
                    mods1 = transform(series, mods1, 0, n1, index, lambda, negCount);
                    mods2 = transform(series, mods2, n1, N, index, lambda, negCount);
                }

            }
            modifiers1 = new double[index_size, mods1.Count / index_size];
            modifiers2 = new double[index_size, mods2.Count / index_size];
            getModifiers(modifiers1, mods1, mods1.Count / index_size);
            getModifiers(modifiers2, mods2, mods2.Count / index_size);
            summods = new double[index_size, modifiers1.GetLength(1) + modifiers2.GetLength(1)];

            double[] tmpMods1 = new double[n1];
            double[] tmpMods2 = new double[n2];

            for (int index = 0; index < index_size; index++)
            {
                for (int j = 0; j < lam_len; j++)
                {
//.........这里部分代码省略.........
开发者ID:AnDDen,项目名称:Hydrology,代码行数:101,代码来源:Uniformity.cs


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