Lean  $LEAN_TAG$
QuantConnect.Lean.Engine.Results.BaseResultsHandler Class Referenceabstract

Provides base functionality to the implementations of IResultHandler More...

Inheritance diagram for QuantConnect.Lean.Engine.Results.BaseResultsHandler:
[legend]

Public Member Functions

virtual void OrderEvent (OrderEvent newEvent)
 New order event for the algorithm More...
 
virtual void Exit ()
 Terminate the result thread and apply any required exit procedures like sending final results More...
 
virtual void Initialize (ResultHandlerInitializeParameters parameters)
 Initialize the result handler with this result packet. More...
 
virtual void OnSecuritiesChanged (SecurityChanges changes)
 Event fired each time that we add/remove securities from the data feed More...
 
virtual string SaveLogs (string id, List< LogEntry > logs)
 Returns the location of the logs More...
 
virtual void SaveResults (string name, Result result)
 Save the results to disk More...
 
virtual void Sample (DateTime time)
 Samples portfolio equity, benchmark, and daily performance Called by scheduled event every night at midnight algorithm time More...
 

Public Attributes

bool IsActive => _updateRunner != null && _updateRunner.IsAlive
 Boolean flag indicating the thread is still active. More...
 

Static Public Attributes

const string StrategyEquityKey = "Strategy Equity"
 
const string EquityKey = "Equity"
 
const string ReturnKey = "Return"
 
const string BenchmarkKey = "Benchmark"
 
const string DrawdownKey = "Drawdown"
 
const string PortfolioTurnoverKey = "Portfolio Turnover"
 
const string PortfolioMarginKey = "Portfolio Margin"
 

Protected Member Functions

 BaseResultsHandler ()
 Creates a new instance More...
 
virtual Dictionary< string, string > GetServerStatistics (DateTime utcNow)
 Gets the current Server statistics More...
 
virtual void StoreOrderEvents (DateTime utcTime, List< OrderEvent > orderEvents)
 Stores the order events More...
 
virtual void StoreInsights ()
 Save insight results to persistent storage More...
 
virtual Dictionary< int, OrderGetDeltaOrders (int orderEventsStartPosition, Func< int, bool > shouldStop)
 Gets the orders generated starting from the provided ITransactionHandler.OrderEvents position More...
 
abstract void Run ()
 Result handler update method More...
 
string GetResultsPath (string filename)
 Gets the full path for a results file More...
 
void PurgeQueue ()
 Purge/clear any outstanding messages in message queue. More...
 
void StopUpdateRunner ()
 Stops the update runner task More...
 
decimal GetNetReturn ()
 Gets the algorithm net return More...
 
abstract void StoreResult (Packet packet)
 Save the snapshot of the total results to storage. More...
 
virtual decimal GetPortfolioValue ()
 Gets the current portfolio value More...
 
virtual decimal GetBenchmarkValue (DateTime time)
 Gets the current benchmark value More...
 
virtual void SampleEquity (DateTime time)
 Sample the current equity of the strategy directly with time and using the current algorithm equity value in CurrentAlgorithmEquity More...
 
virtual void SamplePerformance (DateTime time, decimal value)
 Sample the current daily performance directly with a time-value pair. More...
 
virtual void SampleBenchmark (DateTime time, decimal value)
 Sample the current benchmark performance directly with a time-value pair. More...
 
virtual void SampleDrawdown (DateTime time, decimal currentPortfolioValue)
 Sample drawdown of equity of the strategy More...
 
virtual void SamplePortfolioTurnover (DateTime time, decimal currentPortfolioValue)
 Sample portfolio turn over of the strategy More...
 
virtual void SampleSalesVolume (DateTime time)
 Sample assets sales volume More...
 
virtual void SampleExposure (DateTime time, decimal currentPortfolioValue)
 Sample portfolio exposure long/short ratios by security type More...
 
virtual void SampleCapacity (DateTime time)
 Sample estimated strategy capacity More...
 
abstract void Sample (string chartName, string seriesName, int seriesIndex, SeriesType seriesType, ISeriesPoint value, string unit="$")
 Add a sample to the chart specified by the chartName, and seriesName. More...
 
SortedDictionary< string, string > GetAlgorithmRuntimeStatistics (Dictionary< string, string > summary, CapacityEstimate capacityEstimate=null)
 Gets the algorithm runtime statistics More...
 
void SetAlgorithmState (string error, string stack)
 Sets the algorithm state data More...
 
Dictionary< string, string > GetAlgorithmState (DateTime? endTime=null)
 Gets the algorithm state data More...
 
StatisticsResults GenerateStatisticsResults (Dictionary< string, Chart > charts, SortedDictionary< DateTime, decimal > profitLoss=null, CapacityEstimate estimatedStrategyCapacity=null)
 Will generate the statistics results and update the provided runtime statistics More...
 
int TotalTradesCount ()
 Helper method to get the total trade count statistic More...
 
StatisticsResults GenerateStatisticsResults (CapacityEstimate estimatedStrategyCapacity=null)
 Calculates and gets the current statistics for the algorithm. It will use the current Charts and profit loss information calculated from the current transaction record to generate the results. More...
 
virtual void AddToLogStore (string message)
 Save an algorithm message to the log store. Uses a different timestamped method of adding messaging to interweve debug and logging messages. More...
 
void ProcessAlgorithmLogs (int? messageQueueLimit=null)
 Processes algorithm logs. Logs of the same type are batched together one per line and are sent out More...
 
void SummaryStatistic (string name, string value)
 Sets or updates a custom summary statistic More...
 
void UpdateAlgorithmEquity ()
 Updates the current equity bar with the current equity value from GetPortfolioValue More...
 

Protected Attributes

TimeSpan ChartUpdateInterval = TimeSpan.FromMinutes(1)
 The chart update interval More...
 
int LastDeltaOrderPosition
 The last position consumed from the ITransactionHandler.OrderEvents by GetDeltaOrders More...
 
int LastDeltaOrderEventsPosition
 The last position consumed from the ITransactionHandler.OrderEvents while determining delta order events More...
 
volatile bool ExitTriggered
 True if the exit has been triggered More...
 
IMessagingHandler MessagingHandler
 The handler responsible for communicating messages to listeners More...
 
ITransactionHandler TransactionHandler
 The transaction handler used to get the algorithms Orders information More...
 
decimal DailyPortfolioValue
 Closing portfolio value. Used to calculate daily performance. More...
 
decimal CumulativeMaxPortfolioValue
 Cumulative max portfolio value. Used to calculate drawdown underwater. More...
 
string ResultsDestinationFolder
 Directory location to store results More...
 

Properties

virtual TimeSpan MainUpdateInterval = TimeSpan.FromSeconds(3) [get]
 The main loop update interval More...
 
JsonSerializerSettings SerializerSettings [get, set]
 Serializer settings to use More...
 
Bar CurrentAlgorithmEquity [get, set]
 The current aggregated equity bar for sampling. It will be aggregated with values from the GetPortfolioValue More...
 
ConcurrentQueue< PacketMessages [get, set]
 Live packet messaging queue. Queue the messages here and send when the result queue is ready. More...
 
ConcurrentDictionary< string, ChartCharts [get, set]
 Storage for the price and equity charts of the live results. More...
 
ManualResetEvent ExitEvent [get]
 Event set when exit is triggered More...
 
List< LogEntryLogStore [get]
 The log store instance More...
 
List< string > AlgorithmPerformanceCharts = new List<string> { StrategyEquityKey, BenchmarkKey } [get]
 Algorithms performance related chart names More...
 
object ChartLock [get]
 Lock to be used when accessing the chart collection More...
 
int ProjectId [get, set]
 The algorithm project id More...
 
string RamAllocation [get, set]
 The maximum amount of RAM (in MB) this algorithm is allowed to utilize More...
 
string CompileId [get, set]
 The algorithm unique compilation id More...
 
string AlgorithmId [get, set]
 The algorithm job id. This is the deploy id for live, backtesting id for backtesting More...
 
DateTime StartTime [get]
 The result handler start time More...
 
Dictionary< string, string > RuntimeStatistics [get]
 Customizable dynamic statistics IAlgorithm.RuntimeStatistics More...
 
Dictionary< string, string > State [get, set]
 State of the algorithm More...
 
decimal StartingPortfolioValue [get, set]
 The algorithms starting portfolio value. Used to calculate the portfolio return More...
 
virtual IAlgorithm Algorithm [get, set]
 The algorithm instance More...
 
string AlgorithmCurrencySymbol [get, set]
 Algorithm currency symbol, used in charting More...
 
TimeSpan ResamplePeriod [get, set]
 Sampling period for timespans between resamples of the charting equity. More...
 
TimeSpan NotificationPeriod [get, set]
 How frequently the backtests push messages to the browser. More...
 
IMapFileProvider MapFileProvider [get, set]
 The map file provider instance to use More...
 

Detailed Description

Provides base functionality to the implementations of IResultHandler

Definition at line 43 of file BaseResultsHandler.cs.

Constructor & Destructor Documentation

◆ BaseResultsHandler()

QuantConnect.Lean.Engine.Results.BaseResultsHandler.BaseResultsHandler ( )
protected

Creates a new instance

Definition at line 265 of file BaseResultsHandler.cs.

Here is the call graph for this function:

Member Function Documentation

◆ OrderEvent()

virtual void QuantConnect.Lean.Engine.Results.BaseResultsHandler.OrderEvent ( OrderEvent  newEvent)
virtual

◆ Exit()

virtual void QuantConnect.Lean.Engine.Results.BaseResultsHandler.Exit ( )
virtual

Terminate the result thread and apply any required exit procedures like sending final results

Reimplemented in QuantConnect.Lean.Engine.Results.LiveTradingResultHandler, QuantConnect.Lean.Engine.Results.BacktestingResultHandler, and QuantConnect.Lean.Engine.Results.RegressionResultHandler.

Definition at line 308 of file BaseResultsHandler.cs.

◆ GetServerStatistics()

virtual Dictionary<string, string> QuantConnect.Lean.Engine.Results.BaseResultsHandler.GetServerStatistics ( DateTime  utcNow)
protectedvirtual

Gets the current Server statistics

Definition at line 318 of file BaseResultsHandler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StoreOrderEvents()

virtual void QuantConnect.Lean.Engine.Results.BaseResultsHandler.StoreOrderEvents ( DateTime  utcTime,
List< OrderEvent orderEvents 
)
protectedvirtual

Stores the order events

Parameters
utcTimeThe utc date associated with these order events
orderEventsThe order events to store

Reimplemented in QuantConnect.Lean.Engine.Results.LiveTradingResultHandler.

Definition at line 333 of file BaseResultsHandler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StoreInsights()

virtual void QuantConnect.Lean.Engine.Results.BaseResultsHandler.StoreInsights ( )
protectedvirtual

Save insight results to persistent storage

Method called by the storing timer and on exit

Definition at line 352 of file BaseResultsHandler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDeltaOrders()

virtual Dictionary<int, Order> QuantConnect.Lean.Engine.Results.BaseResultsHandler.GetDeltaOrders ( int  orderEventsStartPosition,
Func< int, bool >  shouldStop 
)
protectedvirtual

Gets the orders generated starting from the provided ITransactionHandler.OrderEvents position

Returns
The delta orders

Definition at line 379 of file BaseResultsHandler.cs.

◆ Initialize()

virtual void QuantConnect.Lean.Engine.Results.BaseResultsHandler.Initialize ( ResultHandlerInitializeParameters  parameters)
virtual

Initialize the result handler with this result packet.

Parameters
parametersDTO parameters class to initialize a result handler

Reimplemented in QuantConnect.Lean.Engine.Results.LiveTradingResultHandler, and QuantConnect.Lean.Engine.Results.BacktestingResultHandler.

Definition at line 417 of file BaseResultsHandler.cs.

Here is the call graph for this function:

◆ Run()

abstract void QuantConnect.Lean.Engine.Results.BaseResultsHandler.Run ( )
protectedpure virtual

Result handler update method

Implemented in QuantConnect.Lean.Engine.Results.LiveTradingResultHandler, and QuantConnect.Lean.Engine.Results.BacktestingResultHandler.

Here is the caller graph for this function:

◆ GetResultsPath()

string QuantConnect.Lean.Engine.Results.BaseResultsHandler.GetResultsPath ( string  filename)
protected

Gets the full path for a results file

Parameters
filenameThe filename to add to the path
Returns
The full path, including the filename

Definition at line 455 of file BaseResultsHandler.cs.

Here is the caller graph for this function:

◆ OnSecuritiesChanged()

virtual void QuantConnect.Lean.Engine.Results.BaseResultsHandler.OnSecuritiesChanged ( SecurityChanges  changes)
virtual

Event fired each time that we add/remove securities from the data feed

Reimplemented in QuantConnect.Lean.Engine.Results.LiveTradingResultHandler, and QuantConnect.Lean.Engine.Results.RegressionResultHandler.

Definition at line 463 of file BaseResultsHandler.cs.

◆ SaveLogs()

virtual string QuantConnect.Lean.Engine.Results.BaseResultsHandler.SaveLogs ( string  id,
List< LogEntry logs 
)
virtual

Returns the location of the logs

Parameters
idId that will be incorporated into the algorithm log name
logsThe logs to save
Returns
The path to the logs

Reimplemented in QuantConnect.Lean.Engine.Results.LiveTradingResultHandler.

Definition at line 473 of file BaseResultsHandler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SaveResults()

virtual void QuantConnect.Lean.Engine.Results.BaseResultsHandler.SaveResults ( string  name,
Result  result 
)
virtual

Save the results to disk

Parameters
nameThe name of the results
resultThe results to save

Reimplemented in QuantConnect.Lean.Engine.Results.RegressionResultHandler.

Definition at line 487 of file BaseResultsHandler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PurgeQueue()

void QuantConnect.Lean.Engine.Results.BaseResultsHandler.PurgeQueue ( )
protected

Purge/clear any outstanding messages in message queue.

Definition at line 495 of file BaseResultsHandler.cs.

Here is the caller graph for this function:

◆ StopUpdateRunner()

void QuantConnect.Lean.Engine.Results.BaseResultsHandler.StopUpdateRunner ( )
protected

Stops the update runner task

Definition at line 503 of file BaseResultsHandler.cs.

Here is the caller graph for this function:

◆ GetNetReturn()

decimal QuantConnect.Lean.Engine.Results.BaseResultsHandler.GetNetReturn ( )
protected

Gets the algorithm net return

Definition at line 512 of file BaseResultsHandler.cs.

Here is the caller graph for this function:

◆ StoreResult()

abstract void QuantConnect.Lean.Engine.Results.BaseResultsHandler.StoreResult ( Packet  packet)
protectedpure virtual

Save the snapshot of the total results to storage.

Parameters
packetPacket to store.

Implemented in QuantConnect.Lean.Engine.Results.LiveTradingResultHandler, and QuantConnect.Lean.Engine.Results.BacktestingResultHandler.

◆ GetPortfolioValue()

virtual decimal QuantConnect.Lean.Engine.Results.BaseResultsHandler.GetPortfolioValue ( )
protectedvirtual

Gets the current portfolio value

Useful so that live trading implementation can freeze the returned value if there is no user exchange open so we ignore extended market hours updates

Reimplemented in QuantConnect.Lean.Engine.Results.LiveTradingResultHandler.

Definition at line 531 of file BaseResultsHandler.cs.

Here is the caller graph for this function:

◆ GetBenchmarkValue()

virtual decimal QuantConnect.Lean.Engine.Results.BaseResultsHandler.GetBenchmarkValue ( DateTime  time)
protectedvirtual

Gets the current benchmark value

Useful so that live trading implementation can freeze the returned value if there is no user exchange open so we ignore extended market hours updates

Parameters
timeTime to resolve benchmark value at

Reimplemented in QuantConnect.Lean.Engine.Results.LiveTradingResultHandler.

Definition at line 542 of file BaseResultsHandler.cs.

Here is the caller graph for this function:

◆ Sample() [1/2]

virtual void QuantConnect.Lean.Engine.Results.BaseResultsHandler.Sample ( DateTime  time)
virtual

Samples portfolio equity, benchmark, and daily performance Called by scheduled event every night at midnight algorithm time

Parameters
timeCurrent UTC time in the AlgorithmManager loop

Reimplemented in QuantConnect.Lean.Engine.Results.LiveTradingResultHandler.

Definition at line 557 of file BaseResultsHandler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SampleEquity()

virtual void QuantConnect.Lean.Engine.Results.BaseResultsHandler.SampleEquity ( DateTime  time)
protectedvirtual

Sample the current equity of the strategy directly with time and using the current algorithm equity value in CurrentAlgorithmEquity

Parameters
timeEquity candlestick end time

Definition at line 601 of file BaseResultsHandler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SamplePerformance()

virtual void QuantConnect.Lean.Engine.Results.BaseResultsHandler.SamplePerformance ( DateTime  time,
decimal  value 
)
protectedvirtual

Sample the current daily performance directly with a time-value pair.

Parameters
timeTime of the sample.
valueCurrent daily performance value.

Reimplemented in QuantConnect.Lean.Engine.Results.RegressionResultHandler.

Definition at line 614 of file BaseResultsHandler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SampleBenchmark()

virtual void QuantConnect.Lean.Engine.Results.BaseResultsHandler.SampleBenchmark ( DateTime  time,
decimal  value 
)
protectedvirtual

Sample the current benchmark performance directly with a time-value pair.

Parameters
timeTime of the sample.
valueCurrent benchmark value.
See also
IResultHandler.Sample

Definition at line 629 of file BaseResultsHandler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SampleDrawdown()

virtual void QuantConnect.Lean.Engine.Results.BaseResultsHandler.SampleDrawdown ( DateTime  time,
decimal  currentPortfolioValue 
)
protectedvirtual

Sample drawdown of equity of the strategy

Parameters
timeTime of the sample
currentPortfolioValueCurrent equity value

Definition at line 639 of file BaseResultsHandler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SamplePortfolioTurnover()

virtual void QuantConnect.Lean.Engine.Results.BaseResultsHandler.SamplePortfolioTurnover ( DateTime  time,
decimal  currentPortfolioValue 
)
protectedvirtual

Sample portfolio turn over of the strategy

Parameters
timeTime of the sample
currentPortfolioValueCurrent equity value

Definition at line 655 of file BaseResultsHandler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SampleSalesVolume()

virtual void QuantConnect.Lean.Engine.Results.BaseResultsHandler.SampleSalesVolume ( DateTime  time)
protectedvirtual

Sample assets sales volume

Parameters
timeTime of the sample

Definition at line 690 of file BaseResultsHandler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SampleExposure()

virtual void QuantConnect.Lean.Engine.Results.BaseResultsHandler.SampleExposure ( DateTime  time,
decimal  currentPortfolioValue 
)
protectedvirtual

Sample portfolio exposure long/short ratios by security type

Parameters
timeTime of the sample
currentPortfolioValueCurrent value of the portfolio

Definition at line 706 of file BaseResultsHandler.cs.

Here is the caller graph for this function:

◆ SampleCapacity()

virtual void QuantConnect.Lean.Engine.Results.BaseResultsHandler.SampleCapacity ( DateTime  time)
protectedvirtual

Sample estimated strategy capacity

Parameters
timeTime of the sample

Reimplemented in QuantConnect.Lean.Engine.Results.BacktestingResultHandler.

Definition at line 772 of file BaseResultsHandler.cs.

Here is the caller graph for this function:

◆ Sample() [2/2]

abstract void QuantConnect.Lean.Engine.Results.BaseResultsHandler.Sample ( string  chartName,
string  seriesName,
int  seriesIndex,
SeriesType  seriesType,
ISeriesPoint  value,
string  unit = "$" 
)
protectedpure virtual

Add a sample to the chart specified by the chartName, and seriesName.

Parameters
chartNameString chart name to place the sample.
seriesNameSeries name for the chart.
seriesIndexSeries chart index - which chart should this series belong
seriesTypeSeries type for the chart.
valueValue for the chart sample.
unitUnit for the chart axis

Sample can be used to create new charts or sample equity - daily performance.

Implemented in QuantConnect.Lean.Engine.Results.LiveTradingResultHandler, and QuantConnect.Lean.Engine.Results.BacktestingResultHandler.

◆ GetAlgorithmRuntimeStatistics()

SortedDictionary<string, string> QuantConnect.Lean.Engine.Results.BaseResultsHandler.GetAlgorithmRuntimeStatistics ( Dictionary< string, string >  summary,
CapacityEstimate  capacityEstimate = null 
)
protected

Gets the algorithm runtime statistics

Definition at line 797 of file BaseResultsHandler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetAlgorithmState()

void QuantConnect.Lean.Engine.Results.BaseResultsHandler.SetAlgorithmState ( string  error,
string  stack 
)
protected

Sets the algorithm state data

Definition at line 831 of file BaseResultsHandler.cs.

Here is the caller graph for this function:

◆ GetAlgorithmState()

Dictionary<string, string> QuantConnect.Lean.Engine.Results.BaseResultsHandler.GetAlgorithmState ( DateTime?  endTime = null)
protected

Gets the algorithm state data

Definition at line 840 of file BaseResultsHandler.cs.

Here is the caller graph for this function:

◆ GenerateStatisticsResults() [1/2]

StatisticsResults QuantConnect.Lean.Engine.Results.BaseResultsHandler.GenerateStatisticsResults ( Dictionary< string, Chart charts,
SortedDictionary< DateTime, decimal >  profitLoss = null,
CapacityEstimate  estimatedStrategyCapacity = null 
)
protected

Will generate the statistics results and update the provided runtime statistics

Definition at line 865 of file BaseResultsHandler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TotalTradesCount()

int QuantConnect.Lean.Engine.Results.BaseResultsHandler.TotalTradesCount ( )
protected

Helper method to get the total trade count statistic

Definition at line 917 of file BaseResultsHandler.cs.

Here is the caller graph for this function:

◆ GenerateStatisticsResults() [2/2]

StatisticsResults QuantConnect.Lean.Engine.Results.BaseResultsHandler.GenerateStatisticsResults ( CapacityEstimate  estimatedStrategyCapacity = null)
protected

Calculates and gets the current statistics for the algorithm. It will use the current Charts and profit loss information calculated from the current transaction record to generate the results.

Returns
The current statistics

Definition at line 928 of file BaseResultsHandler.cs.

Here is the call graph for this function:

◆ AddToLogStore()

virtual void QuantConnect.Lean.Engine.Results.BaseResultsHandler.AddToLogStore ( string  message)
protectedvirtual

Save an algorithm message to the log store. Uses a different timestamped method of adding messaging to interweve debug and logging messages.

Parameters
messageString message to store

Reimplemented in QuantConnect.Lean.Engine.Results.LiveTradingResultHandler, QuantConnect.Lean.Engine.Results.BacktestingResultHandler, and QuantConnect.Lean.Engine.Results.RegressionResultHandler.

Definition at line 950 of file BaseResultsHandler.cs.

◆ ProcessAlgorithmLogs()

void QuantConnect.Lean.Engine.Results.BaseResultsHandler.ProcessAlgorithmLogs ( int?  messageQueueLimit = null)
protected

Processes algorithm logs. Logs of the same type are batched together one per line and are sent out

Definition at line 963 of file BaseResultsHandler.cs.

Here is the caller graph for this function:

◆ SummaryStatistic()

void QuantConnect.Lean.Engine.Results.BaseResultsHandler.SummaryStatistic ( string  name,
string  value 
)
protected

Sets or updates a custom summary statistic

Parameters
nameThe statistic name
valueThe statistic value

Definition at line 1025 of file BaseResultsHandler.cs.

Here is the caller graph for this function:

◆ UpdateAlgorithmEquity()

void QuantConnect.Lean.Engine.Results.BaseResultsHandler.UpdateAlgorithmEquity ( )
protected

Updates the current equity bar with the current equity value from GetPortfolioValue

Definition at line 1045 of file BaseResultsHandler.cs.

Here is the caller graph for this function:

Member Data Documentation

◆ ChartUpdateInterval

TimeSpan QuantConnect.Lean.Engine.Results.BaseResultsHandler.ChartUpdateInterval = TimeSpan.FromMinutes(1)
protected

The chart update interval

Definition at line 74 of file BaseResultsHandler.cs.

◆ LastDeltaOrderPosition

int QuantConnect.Lean.Engine.Results.BaseResultsHandler.LastDeltaOrderPosition
protected

The last position consumed from the ITransactionHandler.OrderEvents by GetDeltaOrders

Definition at line 79 of file BaseResultsHandler.cs.

◆ LastDeltaOrderEventsPosition

int QuantConnect.Lean.Engine.Results.BaseResultsHandler.LastDeltaOrderEventsPosition
protected

The last position consumed from the ITransactionHandler.OrderEvents while determining delta order events

Definition at line 84 of file BaseResultsHandler.cs.

◆ IsActive

bool QuantConnect.Lean.Engine.Results.BaseResultsHandler.IsActive => _updateRunner != null && _updateRunner.IsAlive

Boolean flag indicating the thread is still active.

Definition at line 130 of file BaseResultsHandler.cs.

◆ ExitTriggered

volatile bool QuantConnect.Lean.Engine.Results.BaseResultsHandler.ExitTriggered
protected

True if the exit has been triggered

Definition at line 145 of file BaseResultsHandler.cs.

◆ MessagingHandler

IMessagingHandler QuantConnect.Lean.Engine.Results.BaseResultsHandler.MessagingHandler
protected

The handler responsible for communicating messages to listeners

Definition at line 207 of file BaseResultsHandler.cs.

◆ TransactionHandler

ITransactionHandler QuantConnect.Lean.Engine.Results.BaseResultsHandler.TransactionHandler
protected

The transaction handler used to get the algorithms Orders information

Definition at line 212 of file BaseResultsHandler.cs.

◆ DailyPortfolioValue

decimal QuantConnect.Lean.Engine.Results.BaseResultsHandler.DailyPortfolioValue
protected

Closing portfolio value. Used to calculate daily performance.

Definition at line 233 of file BaseResultsHandler.cs.

◆ CumulativeMaxPortfolioValue

decimal QuantConnect.Lean.Engine.Results.BaseResultsHandler.CumulativeMaxPortfolioValue
protected

Cumulative max portfolio value. Used to calculate drawdown underwater.

Definition at line 238 of file BaseResultsHandler.cs.

◆ ResultsDestinationFolder

string QuantConnect.Lean.Engine.Results.BaseResultsHandler.ResultsDestinationFolder
protected

Directory location to store results

Definition at line 255 of file BaseResultsHandler.cs.

Property Documentation

◆ MainUpdateInterval

virtual TimeSpan QuantConnect.Lean.Engine.Results.BaseResultsHandler.MainUpdateInterval = TimeSpan.FromSeconds(3)
getprotected

The main loop update interval

Definition at line 69 of file BaseResultsHandler.cs.

◆ SerializerSettings

JsonSerializerSettings QuantConnect.Lean.Engine.Results.BaseResultsHandler.SerializerSettings
getsetprotected
Initial value:
= new ()
{
ContractResolver = new DefaultContractResolver
{
NamingStrategy = new CamelCaseNamingStrategy
{
ProcessDictionaryKeys = false,
OverrideSpecifiedNames = true
}
}
}

Serializer settings to use

Definition at line 89 of file BaseResultsHandler.cs.

◆ CurrentAlgorithmEquity

Bar QuantConnect.Lean.Engine.Results.BaseResultsHandler.CurrentAlgorithmEquity
getsetprotected

The current aggregated equity bar for sampling. It will be aggregated with values from the GetPortfolioValue

Definition at line 106 of file BaseResultsHandler.cs.

◆ Messages

ConcurrentQueue<Packet> QuantConnect.Lean.Engine.Results.BaseResultsHandler.Messages
getset

Live packet messaging queue. Queue the messages here and send when the result queue is ready.

Definition at line 135 of file BaseResultsHandler.cs.

◆ Charts

ConcurrentDictionary<string, Chart> QuantConnect.Lean.Engine.Results.BaseResultsHandler.Charts
getset

Storage for the price and equity charts of the live results.

Definition at line 140 of file BaseResultsHandler.cs.

◆ ExitEvent

ManualResetEvent QuantConnect.Lean.Engine.Results.BaseResultsHandler.ExitEvent
getprotected

Event set when exit is triggered

Definition at line 150 of file BaseResultsHandler.cs.

◆ LogStore

List<LogEntry> QuantConnect.Lean.Engine.Results.BaseResultsHandler.LogStore
getprotected

The log store instance

Definition at line 155 of file BaseResultsHandler.cs.

◆ AlgorithmPerformanceCharts

List<string> QuantConnect.Lean.Engine.Results.BaseResultsHandler.AlgorithmPerformanceCharts = new List<string> { StrategyEquityKey, BenchmarkKey }
getprotected

Algorithms performance related chart names

Used to calculate the probabilistic sharpe ratio

Definition at line 161 of file BaseResultsHandler.cs.

◆ ChartLock

object QuantConnect.Lean.Engine.Results.BaseResultsHandler.ChartLock
getprotected

Lock to be used when accessing the chart collection

Definition at line 166 of file BaseResultsHandler.cs.

◆ ProjectId

int QuantConnect.Lean.Engine.Results.BaseResultsHandler.ProjectId
getsetprotected

The algorithm project id

Definition at line 171 of file BaseResultsHandler.cs.

◆ RamAllocation

string QuantConnect.Lean.Engine.Results.BaseResultsHandler.RamAllocation
getsetprotected

The maximum amount of RAM (in MB) this algorithm is allowed to utilize

Definition at line 176 of file BaseResultsHandler.cs.

◆ CompileId

string QuantConnect.Lean.Engine.Results.BaseResultsHandler.CompileId
getsetprotected

The algorithm unique compilation id

Definition at line 181 of file BaseResultsHandler.cs.

◆ AlgorithmId

string QuantConnect.Lean.Engine.Results.BaseResultsHandler.AlgorithmId
getsetprotected

The algorithm job id. This is the deploy id for live, backtesting id for backtesting

Definition at line 187 of file BaseResultsHandler.cs.

◆ StartTime

DateTime QuantConnect.Lean.Engine.Results.BaseResultsHandler.StartTime
getprotected

The result handler start time

Definition at line 192 of file BaseResultsHandler.cs.

◆ RuntimeStatistics

Dictionary<string, string> QuantConnect.Lean.Engine.Results.BaseResultsHandler.RuntimeStatistics
getprotected

Customizable dynamic statistics IAlgorithm.RuntimeStatistics

Definition at line 197 of file BaseResultsHandler.cs.

◆ State

Dictionary<string, string> QuantConnect.Lean.Engine.Results.BaseResultsHandler.State
getsetprotected

State of the algorithm

Definition at line 202 of file BaseResultsHandler.cs.

◆ StartingPortfolioValue

decimal QuantConnect.Lean.Engine.Results.BaseResultsHandler.StartingPortfolioValue
getsetprotected

The algorithms starting portfolio value. Used to calculate the portfolio return

Definition at line 218 of file BaseResultsHandler.cs.

◆ Algorithm

virtual IAlgorithm QuantConnect.Lean.Engine.Results.BaseResultsHandler.Algorithm
getsetprotected

The algorithm instance

Definition at line 223 of file BaseResultsHandler.cs.

◆ AlgorithmCurrencySymbol

string QuantConnect.Lean.Engine.Results.BaseResultsHandler.AlgorithmCurrencySymbol
getsetprotected

Algorithm currency symbol, used in charting

Definition at line 228 of file BaseResultsHandler.cs.

◆ ResamplePeriod

TimeSpan QuantConnect.Lean.Engine.Results.BaseResultsHandler.ResamplePeriod
getsetprotected

Sampling period for timespans between resamples of the charting equity.

Specifically critical for backtesting since with such long timeframes the sampled data can get extreme.

Definition at line 244 of file BaseResultsHandler.cs.

◆ NotificationPeriod

TimeSpan QuantConnect.Lean.Engine.Results.BaseResultsHandler.NotificationPeriod
getsetprotected

How frequently the backtests push messages to the browser.

Update frequency of notification packets

Definition at line 250 of file BaseResultsHandler.cs.

◆ MapFileProvider

IMapFileProvider QuantConnect.Lean.Engine.Results.BaseResultsHandler.MapFileProvider
getsetprotected

The map file provider instance to use

Definition at line 260 of file BaseResultsHandler.cs.


The documentation for this class was generated from the following file: