Live Trading

Results

Introduction

The live results page shows your algorithm's live trading performance. Review the results page to see how your algorithm has been performing and to investigate ways to improve it.

View Live Results

The live results page automatically displays when you deploy a live algorithm. The page presents the algorithm's equity curve, holdings, trades, logs, server statistics, and much more information.

The content in the live results page updates as your algorithm executes. You can close or refresh the window without interrupting the algorithm because the live trading node processes on our servers. If you close the page, you can view all of your live projects to open the page again.

Runtime Statistics

The banner at the top of the live results page displays the performance statistics of your algorithm.

The following table describes the default runtime statistics:

StatisticDescription
EquityThe total portfolio value if all of the holdings were sold at current market rates.
FeesThe total quantity of fees paid for all the transactions.
HoldingsThe absolute sum of the items in the portfolio.
Net ProfitThe dollar-value return across the entire trading period.
PSRThe probability that the estimated Sharpe ratio of an algorithm is greater than a benchmark (1).
ReturnThe rate of return across the entire trading period.
UnrealizedThe amount of profit a portfolio would capture if it liquidated all open positions and paid the fees for transacting and crossing the spread.
VolumeThe total value of assets traded for all of an algorithm's transactions.

To add a custom runtime statistic, call the SetRuntimeStatistic method with a name and value. The value argument can be a string or a number.

SetRuntimeStatistic(name, value);
self.SetRuntimeStatistic(name, value)

Built-in Charts

The live results page displays the equity curve of your algorithm so that you can analyze its performance in real-time.

The following table describes the series in the Strategy Equity chart:

SeriesDescription
EquityThe live equity curve of your algorithm.
Out of Sample BacktestThe backtest equity curve of your algorithm during the live trading period.
MetaPoints in time when you deployed your algorithm, stopped your algorithm, and when your algorithm encountered a runtime error.

Custom Charts

The results page shows the custom charts that you create.

Supported Chart Types

We support the following types of charts:

Supported Markers

When you create scatter plots, you can set a marker symbol. We support the following marker symbols:

Chart Quotas

You can create up to 10 custom chart series per algorithm. If you exceed the quota, your algorithm stops executing and the Cloud Terminal displays the following message:

Exceeded maximum series count: Each backtest can have up to 10 series in total.

Demonstration

For more information about creating custom charts, see Charting.

Adjust Charts

You can manipulate the charts displayed on the live results page.

Toggle Charts

To display and hide a chart on the live results page, in the Select Chart section, click the name of a chart.

Toggle Chart Series

To display and hide a series on a chart on the live results page, click the name of a series at the top of a chart.

Adjust the Display Period

To zoom in and out of a time series chart on the live results page, perform either of the following actions:

  • Click the 1m, 3m, 1y, or All period in the top-right corner of the chart.
  • Click a point on the chart and drag your mouse horizontally to highlight a specific period of time in the chart.

If you adjust the zoom on a chart, it affects all of the charts.

After you zoom in on a chart, slide the horizontal bar at the bottom of the chart to adjust the time frame that displays.

Resize Charts

To resize a chart on the live results page, hover over the bottom-right corner of the chart. When the resize cursor appears, hold the left mouse button and then drag to the desired size.

Move Charts

To move a chart on the live results page, click, hold, and drag the chart title.

Refresh Charts

Refreshing the charts on the live results page resets the zoom level on all the charts. If you refresh the charts while your algorithm is executing, only the data that was seen by the Lean engine after you refreshed the charts is displayed. To refresh the charts, in the Select Chart section, click the reset icon.

Holdings

The Holdings tab on the live results page displays your positions and cash.

The following table describes the properties that display for each of your positions:

PropertyDescription
SymbolThe ticker of the security.
Average PriceThe average price that you paid for the position.
QuantityThe size of your position.
Market ValueThe value of your position if sold with market orders.
UnrealizedThe unrealized profit of your position, including fees and spread costs.

The values in the positions section update as new data points are injected into your algorithm. The cash section displays the quantity of each currency in your algorithm's CashBook. View the Holdings tab to see your holdings, add security subscriptions, and place manual orders. To view all of your current holdings and active data subscriptions, enable the Show All Portfolio check box.

Orders

The live results page displays the orders of your algorithm and you can download them to your local machine. The order timestamps are in Coordinated Universal Time (UTC).

View in the GUI

To see the orders that your algorithm created, open the live results page and then click the Orders tab. If there are more than 10 orders, use the pagination tools at the bottom of the Orders Summary table to see all of the orders. Click on an individual order in the Orders Summary table to reveal additional information regarding the following:

  • Submissions
  • Fills
  • Partial fills
  • Updates
  • Cancellations
  • Option contract exercising

Download CSV

To download the orders in CSV format, open the live results page, click the Orders tab, and then click Download Orders. The content of the CSV file is the content displayed in the Orders Summary table when the table rows are collapsed.

Insights

The live results page displays the insights of your algorithm and you can download them to your local machine.

View in the GUI

To see the insights your algorithm has emitted, open the live result page and then click the Insights tab. If there are more than 10 insights, use the pagination tools at the bottom of the Insights Summary table to see all of the insights.

Download JSON

To download the insights in JSON format, open the live result page, click the Insights tab, and then click Download Insights.

Logs

The Logs tab on the live results page displays all of the logging statements and status messages your algorithm creates. Their timestamps in the log file are in Coordinated Universal Time (UTC). The status messages include all of the points in time when your algorithm deployed, encountered an error, sent an order, or quit executing. It's good practice to add logs in live algorithms because then you can see what is happening while it executes. If you stop and redeploy your algorithm, the logs are retained. You can view the log file on the live results page or download them to your local machine.

View in the GUI

To see the log file your algorithm has created, open the live results page and then click the Logs tab.

Download Log File

To download the log file, open the live result page, click the Logs tab, and then click Download Logs.

Project Files

The live results page displays the project files used to deploy the algorithm. To view the files, click the Code tab. By default, the main.py or Main.cs file displays. To view other files in the project, click the file name and then select a different file from the drop-down menu.

View All Live Projects

The Live Projects page displays the status of all your live algorithms. To view the page, log in to the Algorithm Lab and then, in the left navigation bar, click Live Projects.

Errors

If your live algorithm throws a runtime error, it stops executing and we send you an email. If you enabled automatic restarts when you deployed your algorithm, your algorithm will try five times to restart.

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: