Class TimeSeries<T>
Class to encapsulate time-series data. The class is designed to receive its data from an asynchronous task.
Inherited Members
Namespace: TuringTrader.SimulatorV2
Assembly: TuringTrader.Simulator.dll
Syntax
public class TimeSeries<T>
Type Parameters
Name | Description |
---|---|
T |
Constructors
| Improve this Doc View SourceTimeSeries(Algorithm, string, List<BarType<T>>)
Create new time series.
Declaration
public TimeSeries(Algorithm owner, string name, List<BarType<T>> data)
Parameters
Type | Name | Description |
---|---|---|
Algorithm | owner | parent/ owning algorithm |
string | name | time series name |
System.Collections.Generic.List<T><BarType<T>> | data | time series data |
TimeSeries(Algorithm, string, Task<List<BarType<T>>>)
Create new time series.
Declaration
public TimeSeries(Algorithm owner, string name, Task<List<BarType<T>>> retrieve)
Parameters
Type | Name | Description |
---|---|---|
Algorithm | owner | parent/ owning algorithm |
string | name | time series name |
System.Threading.Tasks.Task<TResult><System.Collections.Generic.List<T><BarType<T>>> | retrieve | data retrieval task |
TimeSeries(Algorithm, string, Task<object>, Func<object, List<BarType<T>>>)
Create new time series. The retrieval function is untyped, requiring an additional extraction function to unpack the data.
Declaration
public TimeSeries(Algorithm owner, string name, Task<object> retrieve, Func<object, List<BarType<T>>> extract)
Parameters
Type | Name | Description |
---|---|---|
Algorithm | owner | parent algorithm |
string | name | time series name |
System.Threading.Tasks.Task<TResult><object> | retrieve | data retrieval task |
System.Func<T, TResult><object, System.Collections.Generic.List<T><BarType<T>>> | extract | data extraction function, typically a cast and member access |
Fields
| Improve this Doc View Source_retrieveUntyped
Task to retrieve time series' data. Note that these data are untyped, and that an extract function is required to wait for the result, and unpack them.
Declaration
protected readonly Task<object> _retrieveUntyped
Field Value
Type | Description |
---|---|
System.Threading.Tasks.Task<TResult><object> |
Name
Name of the time series. For assets, this is the nickname used to initially load the data. For indicators, this name is typically derived from any input series, the indicator's name, and its parameters.
Declaration
public readonly string Name
Field Value
Type | Description |
---|---|
string |
Owner
Algorithm instance owning this time series. This is the algorithm instance that holds this time series in its cache. Note that for child algorithms, this is not the same instance that generated the data.
Declaration
public readonly Algorithm Owner
Field Value
Type | Description |
---|---|
Algorithm |
Time
Time series indexer to return timestamp at offset. Same as Date property.
Declaration
public TimeSeries<T>.TimeIndexer<T> Time
Field Value
Type | Description |
---|---|
TimeSeries<T>.TimeIndexer<T> |
Properties
| Improve this Doc View SourceData
The time series data. Note that accessing this field will wait for the retrieval task to finish and then extract the data.
Declaration
public List<BarType<T>> Data { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><BarType<T>> |
Date
Time series indexer to return timestamp at offset. Same as Time property.
Declaration
public TimeSeries<T>.TimeIndexer<T> Date { get; }
Property Value
Type | Description |
---|---|
TimeSeries<T>.TimeIndexer<T> |
this[DateTime]
Indexer to return time series value at a specific date.
Declaration
public T this[DateTime date] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | date |
Property Value
Type | Description |
---|---|
T | value at date |
this[int]
Indexer to return time series value at offset.
Declaration
public T this[int offset] { get; }
Parameters
Type | Name | Description |
---|---|---|
int | offset | number of bars to offset, positive indices are in the past |
Property Value
Type | Description |
---|---|
T | value at offset |