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


C# TimeSeries类代码示例

本文整理汇总了C#中TimeSeries的典型用法代码示例。如果您正苦于以下问题:C# TimeSeries类的具体用法?C# TimeSeries怎么用?C# TimeSeries使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: OnStrategyStart

	public override void OnStrategyStart()
	{
		series = new BarSeries();

		if (VolatilityExitEnabled || VolatilityBarrierEnabled)
		{
			rangeSeries = new TimeSeries();
			
			rangeSMA = new SMA(rangeSeries, VolatilitySMALength);
		}
		
		if (TickBarrierEnabled)
			barrier = TickSize * BarrierSize;
		
		lowestLowSeries   = new TimeSeries();
		highestHighSeries = new TimeSeries();		
		channelLowSeries  = new TimeSeries();
		channelHighSeries = new TimeSeries();
		
		lowestLowSeries  .Color = Color.Blue;
		highestHighSeries.Color = Color.Blue;
		channelLowSeries .Color = Color.Brown;
		channelHighSeries.Color = Color.Brown;
		
		Draw(lowestLowSeries  , 0);
		Draw(highestHighSeries, 0);
		Draw(channelLowSeries , 0);
		Draw(channelHighSeries, 0);
	}
开发者ID:heber,项目名称:FreeOQ,代码行数:29,代码来源:code.cs

示例2: historySeries

        public TimeSeries<string> historySeries(DateTime sDate, DateTime eDate )
        {
            TimeSeries<string> hist = new TimeSeries<string>();

            INDEX_DATA_Table_DAOManager dao_m = new INDEX_DATA_Table_DAOManager();

            dao_m.INDEX_CODE_ = this.Code_;
            
            dao_m.selectInterval(DataBaseConnectManager.ConnectionFactory("myDB"),sDate,eDate);

            foreach (var item in dao_m.DAOList_)
            {
                string date = item.INDEX_DATE_;

                int year =  Convert.ToInt32(date.Substring(0, 4));
                int month = Convert.ToInt32(date.Substring(4, 2));
                int day = Convert.ToInt32(date.Substring(6, 2));

                string value = item.INDEX_VALUE_;

                hist.Add(new Date(new DateTime(year,month, day)), value);

            }

            return hist;
        }
开发者ID:minikie,项目名称:OTCDerivativesCalculatorModule,代码行数:26,代码来源:IndexHistoryMarketData.cs

示例3: FromTimeSeries

        public static TimeSeriesComplexType FromTimeSeries(TimeSeries ts,string forcedTimeStamp)
        {
            TimeSeriesComplexType result = new TimeSeriesComplexType( );

            string locationName = LocationName(ts.name);
            result.header = new HeaderComplexType
                {
                    type = timeSeriesType.mean,
                    locationId = locationName,
                    //stationName = locationName,
                    startDate = new DateTimeComplexType {DateTime = MergeDT(ts.Start,forcedTimeStamp)},
                    endDate = new DateTimeComplexType {DateTime = MergeDT(ts.End,forcedTimeStamp)},
                    missVal = ts.NullValue,
                    units = PIUnits(ts),
                    timeStep = PITimeStep(ts.timeStep),
                    parameterId = ParameterName(ts.name)
                };

            IList<EventComplexType> events = new List<EventComplexType>();
            for (int i = 0; i < ts.count(); i++)
            {
                var fewsDT = new DateTimeComplexType {DateTime = MergeDT(ts.timeForItem(i),forcedTimeStamp)};
                events.Add( new EventComplexType
                    {
                        date = fewsDT.date,
                        time = fewsDT.time,
                        flag = 2,
                        flagSpecified = true,
                        value = ts[i]
                    });
            }

            [email protected] = events.ToArray();
            return result;
        }
开发者ID:eWaterTest,项目名称:SourceFEWSAdapter,代码行数:35,代码来源:TIMEProxy.cs

示例4: TimeDecayLinear

 public TimeDecayLinear(decimal linearDecay, TimeSpan mobilePeriodLength)
     : base(mobilePeriodLength)
 {
     _startCoeff = 2m / (1m + linearDecay);
     _endCoeff = 2m - _startCoeff;
     _timeDecayWeight = new TimeSeries();
 }
开发者ID:JBetser,项目名称:MiDax,代码行数:7,代码来源:TimeDecay.cs

示例5: GetRegularTimeStepLengthDays

 public static double GetRegularTimeStepLengthDays(TimeSeries ts)
 {
     var t = ts.timeStep as EvenTimeStep;
     if (t == null)
         return -1;
     return t.span.TotalDays;
 }
开发者ID:jmp75,项目名称:RtoTIME,代码行数:7,代码来源:TimeSeriesHelper.cs

示例6: TestEMA

        public void TestEMA()
        {
            long ticks = 1000;
            var data = new double[] { 20, 40, 22, 35, 33, 78, 21, 45, 33, 5, 67, 22, 98, 22, 34, 54 };
            var input = new TimeSeries();
            var ema = new EMA(input, 10);
            foreach (var d in data)
                input.Add(new DateTime().AddTicks(ticks++), d);
            for (var i = 0; i < ema.Count; i++)
                output.WriteLine(ema[i].ToString());


            Assert.Equal(ema[0], 20, precision);
            Assert.Equal(ema[1], 23.6363636363636, precision);
            Assert.Equal(ema[2], 23.3388429752066, precision);
            Assert.Equal(ema[3], 25.4590533433509, precision);
            Assert.Equal(ema[4], 26.8301345536507, precision);
            Assert.Equal(ema[5], 36.1337464529869, precision);
            Assert.Equal(ema[6], 33.3821561888075, precision);
            Assert.Equal(ema[7], 35.4944914272061, precision);
            Assert.Equal(ema[8], 35.0409475313505, precision);
            Assert.Equal(ema[9], 29.5789570711049, precision);
            Assert.Equal(ema[10], 36.3827830581768, precision);
            Assert.Equal(ema[11], 33.7677315930537, precision);
            Assert.Equal(ema[12], 45.4463258488621, precision);
            Assert.Equal(ema[13], 41.1833575127054, precision);
            Assert.Equal(ema[14], 39.8772925103953, precision);
            Assert.Equal(ema[15], 42.4450575085053, precision);
        }
开发者ID:fastquant,项目名称:fastquant.dll,代码行数:29,代码来源:IndicatorsTest.cs

示例7: Init

		protected override void Init()
		{
			this.name = "MDI (" + this.length + ")";
			this.description = "Minus Directional Indicator";
			base.Clear();
			this.calculate = true;
			this.mdmTS = new TimeSeries();
			this.trTS = new TimeSeries();
		}
开发者ID:ForTrade,项目名称:CSharp,代码行数:9,代码来源:MDI.cs

示例8: addFixings

        public void addFixings(List<Date> d, List<double> v, bool forceOverwrite) {
            if ((d.Count != v.Count) || d.Count == 0)
                throw new ArgumentException("Wrong collection dimensions when creating index fixings");

            TimeSeries<double> t = new TimeSeries<double>();
            for(int i=0; i<d.Count; i++)
                t.Add(d[i], v[i]);
            addFixings(t, forceOverwrite);
        }
开发者ID:akasolace,项目名称:qlnet,代码行数:9,代码来源:Index.cs

示例9: ListItem

        public ListItem(TimeSeries ts, int resultNo, double error, bool showIndex = false)
        {
            ResultNo = resultNo;
            TimeSeriesData = ts;
            Error = error;
            ShowIndex = showIndex;

            Render(ts);
        }
开发者ID:philllies,项目名称:finalproject,代码行数:9,代码来源:ListItem.cs

示例10: EWV

 public EWV(ISeries input, double length, double initValue = 0) : base(input)
 {
     Length = length;
     InitValue = initValue;
     this.ewm_0 = new EWM(input, length);
     this.ewm_0.AutoUpdate = false;
     this.timeSeries_0 = new TimeSeries();
     this.ewm_1 = new EWM(this.timeSeries_0, length);
 }
开发者ID:fastquant,项目名称:fastquant.dll,代码行数:9,代码来源:Mess.cs

示例11: TimeSeriesComparison

        public TimeSeriesComparison(TimeSeries ts1, TimeSeries ts2, double start, double end, double error)
        {
            Ts1 = ts1;
            Ts2 = ts2;
            Error = error;

            IsPruned = true;
            Start = start;
            End = end;
        }
开发者ID:philllies,项目名称:finalproject,代码行数:10,代码来源:TimeSeriesComparison.cs

示例12: BuildLink

 public static TimeSeriesLink BuildLink(TimeSeries ts, ProjectViewRow row, AttributeRecordingState key, int runNumber)
 {
     return new TimeSeriesLink
     {
         TimeSeriesName = ts.name,
         RunNumber = runNumber,
         TimeSeriesUrl = BuildTimeSeriesUrl(row,key, runNumber),
         NetworkElement = row.NetworkElementName,
         RecordingElement = row.ElementName,
         RecordingVariable = SelectRecordingVariable(key, row)
     };
 }
开发者ID:flowmatters,项目名称:Veneer,代码行数:12,代码来源:RunSummary.cs

示例13: Estimate

        public EstimationResult Estimate(IEnumerable<IDateValue> dateValues)
        {
            var series = new TimeSeries();
            dateValues.ForEach(x => series.Add(x.Date, x.Value, true));

            armaModel.SetInput(0, series, null);
            armaModel.FitByMLE(200, 100, 0, null);
            armaModel.ComputeResidualsAndOutputs();

            var result = armaModel.GetOutput(3) as TimeSeries;
            return EstimationResult.Create(result[0], this);
        }
开发者ID:kkalinowski,项目名称:TemperatureEstimator,代码行数:12,代码来源:ArmaEngine.cs

示例14: GetResampled

        public TimeSeries GetResampled(TimeSeries timeSeriesData, int numSamples)
        {
            var kv = new TimeSeriesSamplingRatePair(timeSeriesData, numSamples);
            if (StockTimeSeries.ContainsKey(kv))
            {
                return StockTimeSeries[kv];
            }

            var ts = new TimeSeries(timeSeriesData.Values);
            TimeSeries resampled = ts.GetResampled(numSamples);
            StockTimeSeries.Add(kv, resampled);
            return resampled;
        }
开发者ID:philllies,项目名称:finalproject,代码行数:13,代码来源:DataCache.cs

示例15: TestTimeSeries

 public static bool TestTimeSeries(TimeSeries ts, double[] expValues, string expTimeStep, DateTime expectedStart)
 {
     var tsv = ts.ToArray();
     if (tsv.Length != expValues.Length) return false;
     for (int i = 0; i < tsv.Length; i++)
         if (isDifferent(tsv[i], expValues[i])) return false;
     if (ts.timeStep.ToString() != expTimeStep)
         return false;
     // TODO: even for a constructed time series with a start date with kind Utc specified, the time series property
     // ends up with a start date time of kind Unspecified. Very curious; may be a TIME 'issue
     // if (ts.Start != expectedStart) return false;
     return true;
 }
开发者ID:jmp75,项目名称:RtoTIME,代码行数:13,代码来源:TestThat.cs


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