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
| Edit this page 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 |
| List<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 |
| Task<List<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 |
| Task<object> | retrieve | data retrieval task |
| Func<object, List<BarType<T>>> | extract | data extraction function, typically a cast and member access |
Fields
| Edit this page View SourceName
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> |
_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 |
|---|---|
| Task<object> |
Properties
| Edit this page 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 |
|---|---|
| List<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 |
|---|---|---|
| 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 |
Methods
| Edit this page View SourceTake(int)
Retrieve last n values.
Declaration
public List<T> Take(int n)
Parameters
| Type | Name | Description |
|---|---|---|
| int | n |
Returns
| Type | Description |
|---|---|
| List<T> | List of values |