Table of Contents

Interface IDataStore

Namespace
Balsam.Data
Assembly
Balsam.Backtester.dll

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

bool

HasTrades

Returns true if the datastore has trades.

bool HasTrades { get; }

Property Value

bool

Methods

Clear()

Clears the datastore.

void Clear()

GetGlobalVariables()

Returns the global variables dictionary.

VariableDictionary GetGlobalVariables()

Returns

VariableDictionary

GetInstruments()

Returns an enumerable of all the instruments contained in the datastore.

IEnumerable<Instrument> GetInstruments()

Returns

IEnumerable<Instrument>

GetNextTradeId()

Returns the next valid trade id.

long GetNextTradeId()

Returns

long

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

positionId long
symbol string
date DateTime

Returns

Bar

GetRisk(long, DateTime)

Returns the risk in points for the specified position on the specified date.

double GetRisk(long positionId, DateTime date)

Parameters

positionId long
date DateTime

Returns

double

GetRoll(long, DateTime)

Returns a roll for the specified position on the specified date.

Roll GetRoll(long positionId, DateTime date)

Parameters

positionId long
date DateTime

Returns

Roll

GetStartAndEndDates()

Returns the first and last dates in the datastore. The last date includes pricing dates for open positions.

DateRange GetStartAndEndDates()

Returns

DateRange

GetStrategyNames()

Returns an enumerable of all the strategy names found in the datastore.

IEnumerable<string> GetStrategyNames()

Returns

IEnumerable<string>

GetStrategyVariables(string)

Returns a dictionary of variables defined for the specified strategy.

VariableDictionary GetStrategyVariables(string strategyName)

Parameters

strategyName string

Returns

VariableDictionary

GetSymbols()

Returns an enumerable of all the symbols found in the datastore.

IEnumerable<string> GetSymbols()

Returns

IEnumerable<string>

GetTradeDates()

Returns an enumerable of dates on which there are trades.

IEnumerable<DateTime> GetTradeDates()

Returns

IEnumerable<DateTime>

GetTrades()

Returns an enumerable of all the trades found in the datastore.

IEnumerable<Trade> GetTrades()

Returns

IEnumerable<Trade>

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

IEnumerable<Trade>

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

positionId long
bar Bar

WriteRisk(long, DateTime, double)

Writes risk to the datastore.

void WriteRisk(long positionId, DateTime date, double risk)

Parameters

positionId long
date DateTime
risk double

WriteRoll(long, Roll)

Writes the specified roll to the datastore.

void WriteRoll(long positionId, Roll roll)

Parameters

positionId long
roll Roll

WriteStrategyVariables(string, VariableDictionary)

Writes strategy variables to the datastore.

void WriteStrategyVariables(string strategyName, VariableDictionary variables)

Parameters

strategyName string
variables VariableDictionary

WriteTrade(Trade)

Writes the specified trade to the datastore.

void WriteTrade(Trade trade)

Parameters

trade Trade