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:
- Log in to the CLI if you haven't done so already.
- Open a terminal in the organization workspace.
- Run
lean ui.$ lean ui
If you don't log in, the UI only lists your local projects and disables the actions that use the cloud.
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:
| Panel | Description |
|---|---|
| Filter | Filters the project list. The list shows the projects whose name contains every word you enter, ignoring case. |
| Projects | Lists the projects with their location, language, and name. Library projects appear in dim text. |
| Project | Displays the name, location, language, cloud Id, local path, modification time, and description of the selected project. |
| Actions | Lists the actions you can run on the selected project. |
| Output | Displays 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:
| Location | Description |
|---|---|
synced | The project is in the organization workspace and in the cloud. |
local | The project is only in the organization workspace. |
cloud | The 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:
- In the project list, select the project.
- Press Enter.
- In the Actions panel, select the action and then press Enter.
- If the UI asks you to confirm the command, press Y or Enter to run it.
To run an action without moving to the Actions panel, press the action key in the project list.
To cancel, press N or Esc. Backtest actions start without confirmation and open the backtest results.
The following table describes the actions:
| Key | Action | Command | Requirements |
|---|---|---|---|
| B | Backtest locally | lean backtest | Local project |
| C | Backtest in the cloud | lean cloud backtest | Logged in |
| V | View backtest results | Local backtests, or a cloud project and logged in | |
| P | Push to the cloud | lean cloud push | Local project and logged in |
| U | Pull from the cloud | lean cloud pull | Cloud project and logged in |
| S | Cloud live status | lean cloud status | Cloud 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 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:
| Keys | Description |
|---|---|
| Up, Down, K, J | Select the previous or next item. |
| Tab, Shift+Tab | Move to the next or previous panel. |
| / | Move to the Filter panel. |
| Enter | Move from the project list to the Actions panel, or run the selected action. |
| Esc | Clear the filter and move to the project list. |
| B, C, V, P, U, S | Run a project action. |
| R | Refresh the project list. |
| X | Stop the running command. |
| Q | Close the UI. |
The following table describes the keyboard shortcuts of the backtest results screen:
| Keys | Description |
|---|---|
| 1, 2, 3 | Show the Statistics, Orders, or Logs tab. |
| [, ] | Show the next newer or older backtest. |
| O | Pick a backtest from the list of local and cloud backtests. |
| R | Reload the results. |
| X | Stop the running backtest. |
| Esc | Return to the project list. |