Lean  $LEAN_TAG$
QuantConnect.Lean.Engine.Results.BacktestingResultHandler Class Reference

Backtesting result handler passes messages back from the Lean to the User. More...

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

Public Member Functions

 BacktestingResultHandler ()
 Creates a new instance More...
 
override void Initialize (ResultHandlerInitializeParameters parameters)
 Initialize the result handler with this result packet. More...
 
virtual IEnumerable< BacktestResultPacketSplitPackets (Dictionary< string, Chart > deltaCharts, Dictionary< int, Order > deltaOrders, SortedDictionary< string, string > runtimeStatistics, decimal progress, Dictionary< string, string > serverStatistics)
 Run over all the data and break it into smaller packets to ensure they all arrive at the terminal More...
 
virtual void SetAlgorithm (IAlgorithm algorithm, decimal startingPortfolioValue)
 Set the Algorithm instance for ths result. More...
 
virtual void AlgorithmNameUpdated (string name)
 Handles updates to the algorithm's name More...
 
virtual void AlgorithmTagsUpdated (HashSet< string > tags)
 Sends a packet communicating an update to the algorithm's tags More...
 
virtual void DebugMessage (string message)
 Send a debug message back to the browser console. More...
 
virtual void SystemDebugMessage (string message)
 Send a system debug message back to the browser console. More...
 
virtual void LogMessage (string message)
 Send a logging message to the log list for storage. More...
 
virtual void SecurityType (List< SecurityType > types)
 Send list of security asset types the algorithm uses to browser. More...
 
virtual void ErrorMessage (string message, string stacktrace="")
 Send an error message back to the browser highlighted in red with a stacktrace. More...
 
virtual void RuntimeError (string message, string stacktrace="")
 Send a runtime error message back to the browser highlighted with in red More...
 
virtual void BrokerageMessage (BrokerageMessageEvent brokerageMessageEvent)
 Process brokerage message events More...
 
override void Exit ()
 Terminate the result thread and apply any required exit procedures like sending final results. More...
 
virtual void SendStatusUpdate (AlgorithmStatus status, string message="")
 Send an algorithm status update to the browser. More...
 
virtual void RuntimeStatistic (string key, string value)
 Set the current runtime statistics of the algorithm. These are banner/title statistics which show at the top of the live trading results. More...
 
override void OrderEvent (OrderEvent newEvent)
 Handle order event More...
 
virtual void ProcessSynchronousEvents (bool forceProcess=false)
 Process the synchronous result events, sampling and message reading. This method is triggered from the algorithm manager thread. More...
 
StatisticsResults StatisticsResults ()
 Calculates and gets the current statistics for the algorithm More...
 
void SetSummaryStatistic (string name, string value)
 Sets or updates a custom summary statistic More...
 
- Public Member Functions inherited from QuantConnect.Lean.Engine.Results.BaseResultsHandler
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 Member Functions inherited from QuantConnect.Lean.Engine.Results.IResultHandler
void OnSecuritiesChanged (SecurityChanges changes)
 Event fired each time that we add/remove securities from the data feed More...
 
void Sample (DateTime time)
 Method to update the IResultHandler with various performance metrics. Called once a day by scheduled event in AlgorithmManager More...
 
void SaveResults (string name, Result result)
 Save the results More...
 

Protected Member Functions

override void Run ()
 The main processing method steps through the messaging queue and processes the messages one by one. More...
 
override void StoreResult (Packet packet)
 Save the snapshot of the total results to storage. More...
 
void SendFinalResult ()
 Send a final analysis result back to the IDE. More...
 
override void AddToLogStore (string message)
 Add message to LogStore More...
 
override 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...
 
override void SampleCapacity (DateTime time)
 Sample estimated strategy capacity More...
 
void SampleRange (IEnumerable< Chart > updates)
 Add a range of samples from the users algorithms to the end of our current list. More...
 
virtual void ConfigureConsoleTextWriter (IAlgorithm algorithm)
 Configures the Console.Out and Console.Error TextWriter instances. By default, we forward Console.WriteLine(string) to IAlgorithm.Debug. This is perfect for running in the cloud, but since they're processed asynchronously, the ordering of these messages with respect to Log messages is broken. This can lead to differences in regression test logs based solely on the ordering of messages. To disable this forwarding, set More...
 
- Protected Member Functions inherited from QuantConnect.Lean.Engine.Results.BaseResultsHandler
 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...
 
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...
 
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...
 
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...
 
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...
 

Properties

Dictionary< string, string > FinalStatistics [get]
 A dictionary containing summary statistics More...
 
- Properties inherited from QuantConnect.Lean.Engine.Results.BaseResultsHandler
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...
 
- Properties inherited from QuantConnect.Lean.Engine.Results.IResultHandler
ConcurrentQueue< PacketMessages [get, set]
 Put messages to process into the queue so they are processed by this thread. More...
 
bool IsActive [get]
 Boolean flag indicating the result hander thread is busy. False means it has completely finished and ready to dispose. More...
 

Additional Inherited Members

- Public Attributes inherited from QuantConnect.Lean.Engine.Results.BaseResultsHandler
bool IsActive => _updateRunner != null && _updateRunner.IsAlive
 Boolean flag indicating the thread is still active. More...
 
- Static Public Attributes inherited from QuantConnect.Lean.Engine.Results.BaseResultsHandler
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 Attributes inherited from QuantConnect.Lean.Engine.Results.BaseResultsHandler
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...
 

Detailed Description

Backtesting result handler passes messages back from the Lean to the User.

Definition at line 36 of file BacktestingResultHandler.cs.

Constructor & Destructor Documentation

◆ BacktestingResultHandler()

QuantConnect.Lean.Engine.Results.BacktestingResultHandler.BacktestingResultHandler ( )

Creates a new instance

Definition at line 70 of file BacktestingResultHandler.cs.

Member Function Documentation

◆ Initialize()

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

Initialize the result handler with this result packet.

Reimplemented from QuantConnect.Lean.Engine.Results.BaseResultsHandler.

Definition at line 85 of file BacktestingResultHandler.cs.

◆ Run()

override void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.Run ( )
protectedvirtual

The main processing method steps through the messaging queue and processes the messages one by one.

Implements QuantConnect.Lean.Engine.Results.BaseResultsHandler.

Definition at line 98 of file BacktestingResultHandler.cs.

Here is the call graph for this function:

◆ SplitPackets()

virtual IEnumerable<BacktestResultPacket> QuantConnect.Lean.Engine.Results.BacktestingResultHandler.SplitPackets ( Dictionary< string, Chart deltaCharts,
Dictionary< int, Order deltaOrders,
SortedDictionary< string, string >  runtimeStatistics,
decimal  progress,
Dictionary< string, string >  serverStatistics 
)
virtual

Run over all the data and break it into smaller packets to ensure they all arrive at the terminal

Definition at line 244 of file BacktestingResultHandler.cs.

◆ StoreResult()

override void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.StoreResult ( Packet  packet)
protectedvirtual

Save the snapshot of the total results to storage.

Parameters
packetPacket to store.

Implements QuantConnect.Lean.Engine.Results.BaseResultsHandler.

Definition at line 277 of file BacktestingResultHandler.cs.

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

◆ SendFinalResult()

void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.SendFinalResult ( )
protected

Send a final analysis result back to the IDE.

Definition at line 332 of file BacktestingResultHandler.cs.

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

◆ SetAlgorithm()

virtual void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.SetAlgorithm ( IAlgorithm  algorithm,
decimal  startingPortfolioValue 
)
virtual

Set the Algorithm instance for ths result.

Parameters
algorithmAlgorithm we're working on.
startingPortfolioValueAlgorithm starting capital for statistics calculations

While setting the algorithm the backtest result handler.

Implements QuantConnect.Lean.Engine.Results.IResultHandler.

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

Definition at line 396 of file BacktestingResultHandler.cs.

Here is the call graph for this function:

◆ AlgorithmNameUpdated()

virtual void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.AlgorithmNameUpdated ( string  name)
virtual

Handles updates to the algorithm's name

Parameters
nameThe new name

Implements QuantConnect.Lean.Engine.Results.IResultHandler.

Definition at line 435 of file BacktestingResultHandler.cs.

Here is the caller graph for this function:

◆ AlgorithmTagsUpdated()

virtual void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.AlgorithmTagsUpdated ( HashSet< string >  tags)
virtual

Sends a packet communicating an update to the algorithm's tags

Parameters
tagsThe new tags

Implements QuantConnect.Lean.Engine.Results.IResultHandler.

Definition at line 444 of file BacktestingResultHandler.cs.

Here is the caller graph for this function:

◆ DebugMessage()

virtual void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.DebugMessage ( string  message)
virtual

Send a debug message back to the browser console.

Parameters
messageMessage we'd like shown in console.

Implements QuantConnect.Lean.Engine.Results.IResultHandler.

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

Definition at line 453 of file BacktestingResultHandler.cs.

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

◆ SystemDebugMessage()

virtual void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.SystemDebugMessage ( string  message)
virtual

Send a system debug message back to the browser console.

Parameters
messageMessage we'd like shown in console.

Implements QuantConnect.Lean.Engine.Results.IResultHandler.

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

Definition at line 463 of file BacktestingResultHandler.cs.

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

◆ LogMessage()

virtual void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.LogMessage ( string  message)
virtual

Send a logging message to the log list for storage.

Parameters
messageMessage we'd in the log.

Implements QuantConnect.Lean.Engine.Results.IResultHandler.

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

Definition at line 473 of file BacktestingResultHandler.cs.

Here is the call graph for this function:

◆ AddToLogStore()

override void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.AddToLogStore ( string  message)
protectedvirtual

Add message to LogStore

Parameters
messageMessage to add

Reimplemented from QuantConnect.Lean.Engine.Results.BaseResultsHandler.

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

Definition at line 483 of file BacktestingResultHandler.cs.

Here is the caller graph for this function:

◆ SecurityType()

virtual void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.SecurityType ( List< SecurityType types)
virtual

Send list of security asset types the algorithm uses to browser.

Implements QuantConnect.Lean.Engine.Results.IResultHandler.

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

Definition at line 495 of file BacktestingResultHandler.cs.

Here is the caller graph for this function:

◆ ErrorMessage()

virtual void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.ErrorMessage ( string  message,
string  stacktrace = "" 
)
virtual

Send an error message back to the browser highlighted in red with a stacktrace.

Parameters
messageError message we'd like shown in console.
stacktraceStacktrace information string

Implements QuantConnect.Lean.Engine.Results.IResultHandler.

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

Definition at line 509 of file BacktestingResultHandler.cs.

◆ RuntimeError()

virtual void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.RuntimeError ( string  message,
string  stacktrace = "" 
)
virtual

Send a runtime error message back to the browser highlighted with in red

Parameters
messageError message.
stacktraceStacktrace information string

Implements QuantConnect.Lean.Engine.Results.IResultHandler.

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

Definition at line 522 of file BacktestingResultHandler.cs.

Here is the call graph for this function:

◆ BrokerageMessage()

virtual void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.BrokerageMessage ( BrokerageMessageEvent  brokerageMessageEvent)
virtual

Process brokerage message events

Parameters
brokerageMessageEventThe brokerage message event

Implements QuantConnect.Lean.Engine.Results.IResultHandler.

Definition at line 534 of file BacktestingResultHandler.cs.

◆ Sample()

override void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.Sample ( string  chartName,
string  seriesName,
int  seriesIndex,
SeriesType  seriesType,
ISeriesPoint  value,
string  unit = "$" 
)
protectedvirtual

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

Parameters
chartNameString chart name to place the sample.
seriesIndexType of chart we should create if it doesn't already exist.
seriesNameSeries name for the chart.
seriesTypeSeries type for the chart.
valueValue for the chart sample.
unitUnit of the sample

Implements QuantConnect.Lean.Engine.Results.BaseResultsHandler.

Definition at line 548 of file BacktestingResultHandler.cs.

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

◆ SampleCapacity()

override void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.SampleCapacity ( DateTime  time)
protectedvirtual

Sample estimated strategy capacity

Parameters
timeTime of the sample

Reimplemented from QuantConnect.Lean.Engine.Results.BaseResultsHandler.

Definition at line 589 of file BacktestingResultHandler.cs.

Here is the call graph for this function:

◆ SampleRange()

void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.SampleRange ( IEnumerable< Chart updates)
protected

Add a range of samples from the users algorithms to the end of our current list.

Parameters
updatesChart updates since the last request.

Definition at line 600 of file BacktestingResultHandler.cs.

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

◆ Exit()

override void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.Exit ( )
virtual

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

Reimplemented from QuantConnect.Lean.Engine.Results.BaseResultsHandler.

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

Definition at line 668 of file BacktestingResultHandler.cs.

Here is the call graph for this function:

◆ SendStatusUpdate()

virtual void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.SendStatusUpdate ( AlgorithmStatus  status,
string  message = "" 
)
virtual

Send an algorithm status update to the browser.

Parameters
statusStatus enum value.
messageAdditional optional status message.

Implements QuantConnect.Lean.Engine.Results.IResultHandler.

Definition at line 701 of file BacktestingResultHandler.cs.

Here is the call graph for this function:

◆ RuntimeStatistic()

virtual void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.RuntimeStatistic ( string  key,
string  value 
)
virtual

Set the current runtime statistics of the algorithm. These are banner/title statistics which show at the top of the live trading results.

Parameters
keyRuntime headline statistic name
valueRuntime headline statistic value

Implements QuantConnect.Lean.Engine.Results.IResultHandler.

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

Definition at line 713 of file BacktestingResultHandler.cs.

Here is the caller graph for this function:

◆ OrderEvent()

override void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.OrderEvent ( OrderEvent  newEvent)
virtual

Handle order event

Parameters
newEventEvent to process

Reimplemented from QuantConnect.Lean.Engine.Results.BaseResultsHandler.

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

Definition at line 725 of file BacktestingResultHandler.cs.

Here is the call graph for this function:

◆ ProcessSynchronousEvents()

virtual void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.ProcessSynchronousEvents ( bool  forceProcess = false)
virtual

Process the synchronous result events, sampling and message reading. This method is triggered from the algorithm manager thread.

Prime candidate for putting into a base class. Is identical across all result handlers.

Implements QuantConnect.Lean.Engine.Results.IResultHandler.

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

Definition at line 735 of file BacktestingResultHandler.cs.

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

◆ ConfigureConsoleTextWriter()

virtual void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.ConfigureConsoleTextWriter ( IAlgorithm  algorithm)
protectedvirtual

Configures the Console.Out and Console.Error TextWriter instances. By default, we forward Console.WriteLine(string) to IAlgorithm.Debug. This is perfect for running in the cloud, but since they're processed asynchronously, the ordering of these messages with respect to Log messages is broken. This can lead to differences in regression test logs based solely on the ordering of messages. To disable this forwarding, set

"forward-console-messages" to false in the configuration.

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

Definition at line 777 of file BacktestingResultHandler.cs.

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

◆ StatisticsResults()

StatisticsResults QuantConnect.Lean.Engine.Results.BacktestingResultHandler.StatisticsResults ( )

Calculates and gets the current statistics for the algorithm

Returns
The current statistics

Implements QuantConnect.Statistics.IStatisticsService.

Definition at line 797 of file BacktestingResultHandler.cs.

Here is the call graph for this function:

◆ SetSummaryStatistic()

void QuantConnect.Lean.Engine.Results.BacktestingResultHandler.SetSummaryStatistic ( string  name,
string  value 
)

Sets or updates a custom summary statistic

Parameters
nameThe statistic name
valueThe statistic value

Implements QuantConnect.Statistics.IStatisticsService.

Definition at line 807 of file BacktestingResultHandler.cs.

Here is the call graph for this function:

Property Documentation

◆ FinalStatistics

Dictionary<string, string> QuantConnect.Lean.Engine.Results.BacktestingResultHandler.FinalStatistics
get

A dictionary containing summary statistics

Definition at line 65 of file BacktestingResultHandler.cs.


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