Show / Hide Table of Contents

Class TimeSeries<T>

Class to encapsulate time-series data. The class is designed to receive its data from an asynchronous task.

Inheritance
object
TimeSeries<T>
TimeSeriesAsset
TimeSeriesFloat
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: TuringTrader.SimulatorV2
Assembly: TuringTrader.Simulator.dll
Syntax
public class TimeSeries<T>
Type Parameters
Name Description
T

Constructors

| Edit this page View Source

TimeSeries(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

| Edit this page View Source

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

| Edit this page View Source

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 Source

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
| Edit this page View Source

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
| Edit this page View Source

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>
| Edit this page 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
Task<object>

Properties

| Edit this page View Source

Data

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>>
| Edit this page View Source

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>
| Edit this page View Source

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

| Edit this page View Source

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 Source

Take(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

  • Edit this page
  • View Source
In this article
Back to top Copyright © 2011-2023, Bertram Enterprises LLC dba TuringTrader.com