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


C# data.AddpriceDataSumRow方法代码示例

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


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

示例1: AggregatePriceData

        //Agrregate date time for hourly,daily data...
        //public static DateTime AggregateDateTime(AppTypes.timeScales type, DateTime onDateTime, CultureInfo ci)
        //{
        //    switch (type)
        //    {
        //        case AppTypes.timeScales.Hour1:
        //             return onDateTime.Date.AddHours(onDateTime.Hour);
        //        case AppTypes.timeScales.Hour2:
        //             return onDateTime.Date.AddHours(onDateTime.Hour / 2);
        //        case AppTypes.timeScales.Hour4:
        //             return onDateTime.Date.AddHours(onDateTime.Hour / 4);
        //        case AppTypes.timeScales.Daily:
        //             return onDateTime.Date;
        //        case AppTypes.timeScales.Weekly:
        //             return common.dateTimeLibs.StartOfWeek(onDateTime, ci);
        //        case AppTypes.timeScales.Monthly:
        //             return common.dateTimeLibs.MakeDate(1, onDateTime.Month, onDateTime.Year);
        //        case AppTypes.timeScales.Yearly:
        //             return common.dateTimeLibs.MakeDate(1, 1, onDateTime.Year);
        //        default:
        //            common.system.ThrowException("Invalid argument in AggregateDateTime()");
        //            break;
        //    }
        //    return onDateTime;
        //}

        /// <summary>
        /// Agrregate a data row to hourly,daily data...
        /// </summary>
        /// <param name="priceRow"> source data arregated to [toSumTbl] </param>
        /// <param name="changeVolume"> volume qty changed and is cumulated to total volume </param>
        /// <param name="timeScale"> aggregate to hour,day,week... data </param>
        /// <param name="cultureInfo"> culture info that need to caculate the start of the week param>
        /// <param name="toSumTbl"> destination table</param>
        public static void AggregatePriceData(data.baseDS.priceDataRow priceRow, decimal changeVolume, AppTypes.TimeScale timeScale, 
                                              CultureInfo cultureInfo,data.baseDS.priceDataSumDataTable toSumTbl)
        {
            DateTime dataDate = AggregateDateTime(timeScale, priceRow.onDate, cultureInfo);
            int dataTimeOffset = common.dateTimeLibs.DateDiffInMilliseconds(dataDate, priceRow.onDate);

            data.baseDS.priceDataSumRow priceDataSumRow;
            priceDataSumRow = libs.FindAndCache(toSumTbl, priceRow.stockCode, timeScale.Code, dataDate);
            if (priceDataSumRow == null)
            {
                priceDataSumRow = toSumTbl.NewpriceDataSumRow();
                commonClass.AppLibs.InitData(priceDataSumRow);
                priceDataSumRow.type = timeScale.Code;
                priceDataSumRow.stockCode = priceRow.stockCode;
                priceDataSumRow.onDate = dataDate;
                priceDataSumRow.openPrice = priceRow.openPrice;
                priceDataSumRow.closePrice = priceRow.closePrice;
                toSumTbl.AddpriceDataSumRow(priceDataSumRow);
            }
            if (priceDataSumRow.openTimeOffset > dataTimeOffset)
            {
                priceDataSumRow.openPrice = priceRow.openPrice;
                priceDataSumRow.openTimeOffset = dataTimeOffset;
            }
            if (priceDataSumRow.closeTimeOffset <= dataTimeOffset)
            {
                priceDataSumRow.closePrice = priceRow.closePrice;
                priceDataSumRow.closeTimeOffset = dataTimeOffset;
            }
            if (priceDataSumRow.highPrice < priceRow.highPrice) priceDataSumRow.highPrice = priceRow.highPrice;
            if (priceDataSumRow.lowPrice > priceRow.lowPrice) priceDataSumRow.lowPrice = priceRow.lowPrice;
            priceDataSumRow.volume += changeVolume;
        }
开发者ID:oghenez,项目名称:trade-software,代码行数:67,代码来源:lib.cs


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