Statistics

Server Statistics

Introduction

Server statistics describe the node that runs your algorithm instead of the performance of the algorithm. LEAN attaches them to the backtest and live results, so you can see how much of the node CPU and RAM the algorithm uses, which version of LEAN runs it, and how long the node has been running.

Default Statistics

The following table describes the server statistics:

StatisticDescription
CPU UsagePercentage of the node CPU in use.
Used RAM (MB)RAM the algorithm uses, in megabytes.
Total RAM (MB)RAM the node provides, in megabytes.
HostnameName of the machine that runs the algorithm, which starts with the type of deployment.
LEAN VersionVersion of LEAN that runs the algorithm.
Up TimeTime the node has been running, in days, hours, minutes, and seconds.

The available statistics depend on the version of LEAN that produces the results. Results from before LEAN reported the server statistics don't have them.

Get Values

To get the server statistics inside an algorithm, call the GetServerStatisticsget_server_statistics method of the OS class. For more information about the resource metrics the OS class exposes, see Memory Metrics.

foreach (var kvp in OS.GetServerStatistics()) Log($"{kvp.Key}: {kvp.Value}");
for kvp in OS.get_server_statistics():
    self.log(f"{kvp.key}: {kvp.value}")

The following table describes the other ways to get the server statistics of your backtests and live algorithms:

Deployment TargetExecution ModeAccess Tools
QuantConnect CloudBacktest
QuantConnect CloudLive Trading
LocalBacktest
LocalLive Trading

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: