Class DataStoreBase
An abstract base class that defines the contract that must be implemented by all backtester databases. This class implements IDataStore but only exposes a few public methods, hiding the low level functionality that is not needed by users.
public abstract class DataStoreBase : IDataStore
- Inheritance
-
DataStoreBase
- Implements
- Derived
- Inherited Members
- Extension Methods
Properties
CanPersist
Returns true if the datastore can be persisted to disk.
public abstract bool CanPersist { get; }
Property Value
HasTrades
Returns true if the DataStore has trades.
public abstract bool HasTrades { get; }
Property Value
Methods
Clear()
Clears the datastore.
public abstract void Clear()
GetGlobalVariables()
Returns the global variables dictionary.
protected abstract VariableDictionary GetGlobalVariables()
Returns
GetInstruments()
Returns a collection of all the instruments contained in the datastore.
protected abstract InstrumentCollection GetInstruments()
Returns
GetNextTradeId()
Gets the first valid trade id.
protected abstract long GetNextTradeId()
Returns
GetPricing(long, string, DateTime)
Returns the closing price for the specified position or symbol on the specified date.
protected abstract Bar GetPricing(long positionId, string symbol, DateTime date)
Parameters
Returns
GetRisk(long, DateTime)
Gets the risk of the specified position on the specified date.
protected abstract double GetRisk(long positionId, DateTime date)
Parameters
Returns
GetRoll(long, DateTime)
Gets a roll for the specified position on the specified date.
protected abstract Roll GetRoll(long positionId, DateTime date)
Parameters
Returns
GetStartAndEndDates()
Returns the earliest and latest available dates found within the datastore.
protected abstract DateRange GetStartAndEndDates()
Returns
GetStrategyNames()
Returns an enumerable of all the strategy names found in the datastore.
protected abstract IEnumerable<string> GetStrategyNames()
Returns
GetStrategyVariables(string)
Returns a dictionary of all the variables defined for the specified strategy.
protected abstract VariableDictionary GetStrategyVariables(string strategyName)
Parameters
strategyName
string
Returns
GetSymbols()
Returns an enumerable of all the symbols found in the datastore.
protected abstract IEnumerable<string> GetSymbols()
Returns
GetTradeDates()
Returns dates on which there are trades.
protected abstract IEnumerable<DateTime> GetTradeDates()
Returns
GetTrades()
Returns an enumerable of all the trades in the datastore.
protected abstract IEnumerable<Trade> GetTrades()
Returns
GetTrades(DateTime)
Returns an enumerable of all the trades found in the datastore for the specified date.
protected abstract IEnumerable<Trade> GetTrades(DateTime date)
Parameters
date
DateTime
Returns
Merge(IDataStore)
Merges the specified datastore into the existing one.
public abstract void Merge(IDataStore dataStore)
Parameters
dataStore
IDataStore
Save(string)
Saves the datastore using the specified file name.
public abstract void Save(string fileName)
Parameters
fileName
string
WriteGlobalVariables(VariableDictionary)
Writes global variables to the datastore.
protected abstract void WriteGlobalVariables(VariableDictionary variables)
Parameters
variables
VariableDictionary
WritePricing(long, Bar)
Writes pricing for the specified tradeId to the datastore.
protected abstract void WritePricing(long positionId, Bar bar)
Parameters
WriteRisk(long, DateTime, double)
Writes risk to the datastore.
protected abstract void WriteRisk(long positionId, DateTime date, double risk)
Parameters
WriteRoll(long, Roll)
Writes the specified roll to the datastore.
protected abstract void WriteRoll(long positionId, Roll roll)
Parameters
WriteStrategyVariables(string, VariableDictionary)
Writes the specified strategy variables to the datastore.
protected abstract void WriteStrategyVariables(string strategyName, VariableDictionary variables)
Parameters
strategyName
stringvariables
VariableDictionary
WriteTrade(Trade)
Writes the specified trade to the datastore.
protected abstract void WriteTrade(Trade trade)
Parameters
trade
Trade