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:
| Statistic | Description |
|---|---|
| CPU Usage | Percentage of the node CPU in use. |
| Used RAM (MB) | RAM the algorithm uses, in megabytes. |
| Total RAM (MB) | RAM the node provides, in megabytes. |
| Hostname | Name of the machine that runs the algorithm, which starts with the type of deployment. |
| LEAN Version | Version of LEAN that runs the algorithm. |
| Up Time | Time 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 Target | Execution Mode | Access Tools |
|---|---|---|
| QuantConnect Cloud | Backtest |
|
| QuantConnect Cloud | Live Trading |
|
| Local | Backtest |
|
| Local | Live Trading |
|