本文整理汇总了C#中TimeSeries类的典型用法代码示例。如果您正苦于以下问题:C# TimeSeries类的具体用法?C# TimeSeries怎么用?C# TimeSeries使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TimeSeries类属于命名空间,在下文中一共展示了TimeSeries类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Value
public static double Value(ISeries input, int index, int length1, int length2)
{
if (index >= length2 - 1)
{
TimeSeries timeSeries = new TimeSeries();
for (int i = 0; i <= index; i++)
{
timeSeries.Add(input.GetDateTime(i), input[i, BarData.High] - input[i, BarData.Low]);
}
EMA eMA = new EMA(timeSeries, length1, BarData.Close);
return (eMA[index] - eMA[index - length2 + 1]) / eMA[index - length2 + 1] * 100.0;
}
return double.NaN;
}
开发者ID:ForTrade,项目名称:CSharp,代码行数:14,代码来源:VCH.cs
示例17: CreateWaterLevelTimeSeries
public static TimeSeries CreateWaterLevelTimeSeries()
{
var ts = new TimeSeries
{
Components = {new Variable<double>("level", new Unit("m AD", "m AD"))},
Name = "water level time series"
};
ts.Components[0].Attributes[FunctionAttributes.StandardName] = FunctionAttributes.StandardNames.WaterLevel;
var variable = ts.Arguments.First();
variable.DefaultValue = new DateTime(2000, 1, 1);
variable.InterpolationType = InterpolationType.Linear;
variable.ExtrapolationType = ExtrapolationType.Constant;
return ts;
}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:15,代码来源:TimeSeriesFactory.cs
示例18: Value
public static double Value(ISeries input, int index, int length1, int length2)
{
if (index >= length1 - 1 && index >= length2 - 1)
{
TimeSeries timeSeries = new TimeSeries();
for (int i = index - Math.Max(length1, length2) + 1; i <= index; i++)
{
timeSeries.Add(input.GetDateTime(i), input[i, BarData.Volume]);
}
double num = SMA.Value(timeSeries, length1 - 1, length1, BarData.Close);
double num2 = SMA.Value(timeSeries, length2 - 1, length2, BarData.Close);
return num - num2;
}
return double.NaN;
}
开发者ID:ForTrade,项目名称:CSharp,代码行数:15,代码来源:VOSC.cs
示例19: TestWMA
public void TestWMA()
{
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 wma = new WMA(input, 10);
foreach (var d in data)
input.Add(new DateTime().AddTicks(ticks++), d);
Assert.Equal(wma[0], 32.6, precision);
Assert.Equal(wma[1], 38.7454545454545, precision);
Assert.Equal(wma[2], 35.8545454545455, precision);
Assert.Equal(wma[3], 47.1090909090909, precision);
Assert.Equal(wma[4], 43.1636363636364, precision);
Assert.Equal(wma[5], 41.6363636363636, precision);
Assert.Equal(wma[6], 43.7272727272727, precision);
}
开发者ID:fastquant,项目名称:fastquant.dll,代码行数:16,代码来源:IndicatorsTest.cs
示例20: SimpleTimeSeries
public SimpleTimeSeries(TimeSeries source):base(source)
{
if (source == null)
{
Events = new TimeSeriesEvent[0];
return;
}
IList<TimeSeriesEvent> eventList = new List<TimeSeriesEvent>();
for (int i = 0; i < source.count(); i++)
eventList.Add(new TimeSeriesEvent
{
Date = source.timeForItem(i).ToString(CultureInfo.InvariantCulture),
Value = source[i]
});
Events = eventList.ToArray();
}
开发者ID:flowmatters,项目名称:Veneer,代码行数:18,代码来源:SimpleTimeSeries.cs
注:本文中的TimeSeries类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论