Class DataSource
Base class for data sources, providing a bar enumerator for one or more instruments. Other than instantiating data sources through the factory method New(), and adding them to the Algorithm's DataSources property, application developers do not need to interact with data sources directly.
Inherited Members
Namespace: TuringTrader.Simulator
Assembly: TuringTrader.Simulator.dll
Syntax
public abstract class DataSource
Constructors
| Edit this page View SourceDataSource(Dictionary<DataSourceParam, string>)
Create and initialize data source object.
Declaration
protected DataSource(Dictionary<DataSourceParam, string> info)
Parameters
| Type | Name | Description |
|---|---|---|
| Dictionary<DataSourceParam, string> | info | data source info |
Fields
| Edit this page View SourceCachedData
Data sources using the cache make their data accessible here. This may be used for algorithms and report generators, e.g., MFE/MAE analysis, which requires access to the data independent of the simulator's current bar.
Declaration
public List<Bar> CachedData
Field Value
| Type | Description |
|---|---|
| List<Bar> |
Simulator
Reference to simulator this instance is associated with.
Declaration
public SimulatorCore Simulator
Field Value
| Type | Description |
|---|---|
| SimulatorCore |
Properties
| Edit this page View SourceAlgorithm
Algorithms only: return algorithm instance.
Declaration
public virtual Algorithm Algorithm { get; }
Property Value
| Type | Description |
|---|---|
| Algorithm |
DataPath
Path to data base.
Declaration
public static string DataPath { get; }
Property Value
| Type | Description |
|---|---|
| string |
Info
Data source info container.
Declaration
public Dictionary<DataSourceParam, string> Info { get; protected set; }
Property Value
| Type | Description |
|---|---|
| Dictionary<DataSourceParam, string> |
Instrument
Instrument associated with data source. Will return only first one, in case there is a one-to-many relationship.
Declaration
public Instrument Instrument { get; }
Property Value
| Type | Description |
|---|---|
| Instrument |
IsAlgorithm
True, if this data source is describes an algorithm
Declaration
public virtual bool IsAlgorithm { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsOption
True, if this data source describes option contracts.
Declaration
public bool IsOption { get; }
Property Value
| Type | Description |
|---|---|
| bool |
OptionUnderlying
Options only: Underlying symbol.
Declaration
public string OptionUnderlying { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
| Edit this page View SourceLoadData(DateTime, DateTime)
Load data between time stamps into memory.
Declaration
public abstract IEnumerable<Bar> LoadData(DateTime startTime, DateTime endTime)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | startTime | beginning time stamp |
| DateTime | endTime | end time stamp |
Returns
| Type | Description |
|---|---|
| IEnumerable<Bar> |
New(string)
Factory function to instantiate new data source.
Declaration
public static DataSource New(string nickname)
Parameters
| Type | Name | Description |
|---|---|---|
| string | nickname | nickname |
Returns
| Type | Description |
|---|---|
| DataSource | data source object |
New(Algorithm)
Factory function to instantiate new algorithm data source.
Declaration
public static DataSource New(Algorithm algo)
Parameters
| Type | Name | Description |
|---|---|---|
| Algorithm | algo | nickname |
Returns
| Type | Description |
|---|---|
| DataSource | data source object |