Interface IDataStore
Defines the contract that backtester databases must implement.
public interface IDataStore
- Extension Methods
Properties
CanPersist
Returns true if the datastore can be persisted to disk.
bool CanPersist { get; }
Property Value
HasTrades
Returns true if the datastore has trades.
bool HasTrades { get; }
Property Value
Methods
Clear()
Clears the datastore.
void Clear()
GetGlobalVariables()
Returns the global variables dictionary.
VariableDictionary GetGlobalVariables()
Returns
GetInstruments()
Returns an enumerable of all the instruments contained in the datastore.
IEnumerable<Instrument> GetInstruments()
Returns
GetNextTradeId()
Returns the next valid trade id.
long GetNextTradeId()
Returns
GetPricing(long, string, DateTime)
Returns pricing for the specified position or symbol on the specified date.
Bar GetPricing(long positionId, string symbol, DateTime date)
Parameters
Returns
GetRisk(long, DateTime)
Returns the risk in points for the specified position on the specified date.
double GetRisk(long positionId, DateTime date)
Parameters
Returns
GetRoll(long, DateTime)
Returns a roll for the specified position on the specified date.
Roll GetRoll(long positionId, DateTime date)
Parameters
Returns
GetStartAndEndDates()
Returns the first and last dates in the datastore. The last date includes pricing dates for open positions.
DateRange GetStartAndEndDates()
Returns
GetStrategyNames()
Returns an enumerable of all the strategy names found in the datastore.
IEnumerable<string> GetStrategyNames()
Returns
GetStrategyVariables(string)
Returns a dictionary of variables defined for the specified strategy.
VariableDictionary GetStrategyVariables(string strategyName)
Parameters
strategyName
string
Returns
GetSymbols()
Returns an enumerable of all the symbols found in the datastore.
IEnumerable<string> GetSymbols()
Returns
GetTradeDates()
Returns an enumerable of dates on which there are trades.
IEnumerable<DateTime> GetTradeDates()
Returns
GetTrades()
Returns an enumerable of all the trades found in the datastore.
IEnumerable<Trade> GetTrades()
Returns
GetTrades(DateTime)
Returns an enumerable of all the trades found in the datastore on the specified date.
IEnumerable<Trade> GetTrades(DateTime date)
Parameters
date
DateTime
Returns
Merge(IDataStore)
Merges the specified datastore into the existing one.
void Merge(IDataStore dataStore)
Parameters
dataStore
IDataStore
Save(string)
Saves the datastore using the specified file name.
void Save(string fileName)
Parameters
fileName
string
WriteGlobalVariables(VariableDictionary)
Writes global variables to the datastore.
void WriteGlobalVariables(VariableDictionary variables)
Parameters
variables
VariableDictionary
WritePricing(long, Bar)
Writes the specified bar to the datastore.
void WritePricing(long positionId, Bar bar)
Parameters
WriteRisk(long, DateTime, double)
Writes risk to the datastore.
void WriteRisk(long positionId, DateTime date, double risk)
Parameters
WriteRoll(long, Roll)
Writes the specified roll to the datastore.
void WriteRoll(long positionId, Roll roll)
Parameters
WriteStrategyVariables(string, VariableDictionary)
Writes strategy variables to the datastore.
void WriteStrategyVariables(string strategyName, VariableDictionary variables)
Parameters
strategyName
stringvariables
VariableDictionary
WriteTrade(Trade)
Writes the specified trade to the datastore.
void WriteTrade(Trade trade)
Parameters
trade
Trade