Projects

UI

Introduction

The terminal user interface (UI) lets you browse the projects in your organization workspace and run CLI commands on them with the keyboard. The UI lists your local and cloud projects together, runs backtests locally or in the cloud, and displays the backtest results while the backtest runs.

To use the CLI, you must be a member in an organization on a paid tier.

Open the UI

Follow these steps to open the UI:

  1. Log in to the CLI if you haven't done so already.
  2. If you don't log in, the UI only lists your local projects and disables the actions that use the cloud.

  3. Open a terminal in the organization workspace.
  4. Run lean ui.
    $ lean ui

The UI lists your local projects first and then loads your cloud projects. To refresh the project list, press R. On Linux, the CLI runs lean ui with sudo so the commands that the UI runs can access Docker.

To close the UI, press Q. If a command is running, the UI stops it before closing. The UI waits up to 10 seconds for the command to stop its Docker containers.

Panels

The UI displays the following panels:

PanelDescription
FilterFilters the project list. The list shows the projects whose name contains every word you enter, ignoring case.
ProjectsLists the projects with their location, language, and name. Library projects appear in dim text.
ProjectDisplays the name, location, language, cloud Id, local path, modification time, and description of the selected project.
ActionsLists the actions you can run on the selected project.
OutputDisplays the output of the command that the UI runs.

The header displays the path of the organization workspace and the footer displays the keyboard shortcuts of the current screen. The location column of the project list shows one of the following values:

LocationDescription
syncedThe project is in the organization workspace and in the cloud.
localThe project is only in the organization workspace.
cloudThe project is only in the cloud.

The UI matches local and cloud projects by the cloud Id in the project configuration. If you delete a cloud project, its local copy shows as local.

Run Project Actions

Follow these steps to run an action on a project:

  1. In the project list, select the project.
  2. Press Enter.
  3. In the Actions panel, select the action and then press Enter.
  4. To run an action without moving to the Actions panel, press the action key in the project list.

  5. If the UI asks you to confirm the command, press Y or Enter to run it.
  6. To cancel, press N or Esc. Backtest actions start without confirmation and open the backtest results.

The following table describes the actions:

KeyActionCommandRequirements
BBacktest locallylean backtestLocal project
CBacktest in the cloudlean cloud backtestLogged in
VView backtest resultsLocal backtests, or a cloud project and logged in
PPush to the cloudlean cloud pushLocal project and logged in
UPull from the cloudlean cloud pullCloud project and logged in
SCloud live statuslean cloud statusCloud project and logged in

If the selected project doesn't meet the requirements of an action, the Actions panel disables the action and shows the reason next to it. If you run a cloud backtest on a local project, the UI pushes the project to the cloud first.

The UI runs one command at a time and shows its output in the Output panel. After a push, a pull, or a cloud backtest, the UI refreshes the project list. Local backtests save their results in the backtests directory of the project.

View Backtest Results

To view the backtest results of a project, run the View backtest results action. The results screen opens the most recent backtest of the project and shows the following sections:

  • A summary of the equity, net profit, return, Probabilistic Sharpe Ratio (PSR), unrealized profit, holdings, fees, and volume.
  • The runtime error, if the algorithm throws an exception.
  • The Strategy Equity chart.
  • The Statistics, Orders, and Logs tabs.

The Orders tab shows the order time in UTC and loads more orders as you scroll down. While a backtest runs, the results screen refreshes every 10 seconds for local backtests and every 15 seconds for cloud backtests. To reload the results, press R.

The results screen lists the local backtests of the project and, if you're logged in, the cloud backtests of the project. To view another backtest, press [ for a newer backtest or ] for an older backtest. To pick a backtest from the full list, press O, enter a part of its name to filter the list, and then press Enter.

To return to the project list, press Esc. For more information about the backtest results, see Results.

Stop Commands

To stop the running command, press X. The UI interrupts the command the same way Ctrl+C does, so the command can stop its Docker containers.

If the command doesn't stop, press X again to force the Docker containers to stop. Press X a third time to end the command process.

When you stop a cloud backtest, the UI asks whether to cancel and delete the backtest in the cloud. Press Y to delete it or N to keep the backtest running in the cloud.

Keyboard Shortcuts

The following table describes the keyboard shortcuts of the project list:

KeysDescription
Up, Down, K, JSelect the previous or next item.
Tab, Shift+TabMove to the next or previous panel.
/Move to the Filter panel.
EnterMove from the project list to the Actions panel, or run the selected action.
EscClear the filter and move to the project list.
B, C, V, P, U, SRun a project action.
RRefresh the project list.
XStop the running command.
QClose the UI.

The following table describes the keyboard shortcuts of the backtest results screen:

KeysDescription
1, 2, 3Show the Statistics, Orders, or Logs tab.
[, ]Show the next newer or older backtest.
OPick a backtest from the list of local and cloud backtests.
RReload the results.
XStop the running backtest.
EscReturn to the project list.

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: