91 lines
3.4 KiB
Markdown
91 lines
3.4 KiB
Markdown
# Dashboard Configuration Guide
|
|
|
|
This guide explains how to configure which tables are displayed on the live terminal dashboard.
|
|
|
|
## Overview
|
|
|
|
The dashboard is rendered by the `DashboardRenderer` class in `dashboard.py`. It currently supports two tables:
|
|
|
|
| Table Key | Title | Description |
|
|
|-----------|-------|-------------|
|
|
| `market` | Market Dashboard | Live prices, best bid/ask, gap, and direction for watched coins |
|
|
| `strategies` | Strategies | Signal, signal price, last change, timeframe, and size for each enabled strategy |
|
|
|
|
Each table can be independently enabled or disabled. When only one table is visible, it takes the full terminal width. When both are visible, they split side-by-side.
|
|
|
|
## Configuration
|
|
|
|
### Default Visibility
|
|
|
|
The default table visibility is set when `DashboardRenderer` is instantiated in `main_app.py` (`MainApp.__init__`):
|
|
|
|
```python
|
|
self.renderer = DashboardRenderer(table_visibility={
|
|
"market": True,
|
|
"strategies": False,
|
|
})
|
|
```
|
|
|
|
By default, the **market table is enabled** and the **strategies table is disabled**.
|
|
|
|
### Changing Default Visibility
|
|
|
|
To change which tables are shown by default, edit the `table_visibility` dict in `main_app.py` (`MainApp.__init__`, line 349):
|
|
|
|
```python
|
|
self.renderer = DashboardRenderer(table_visibility={
|
|
"market": True,
|
|
"strategies": True, # enable strategies table
|
|
})
|
|
```
|
|
|
|
### Runtime Toggling
|
|
|
|
Tables can be toggled at runtime through the `MainApp.toggle_table()` method, which delegates to `DashboardRenderer.toggle_table()`:
|
|
|
|
```python
|
|
# Flip the strategies table on/off
|
|
app.toggle_table("strategies")
|
|
|
|
# Explicitly enable
|
|
app.toggle_table("strategies", enabled=True)
|
|
|
|
# Explicitly disable
|
|
app.toggle_table("strategies", enabled=False)
|
|
```
|
|
|
|
The same methods are available directly on the renderer:
|
|
|
|
```python
|
|
renderer = DashboardRenderer()
|
|
renderer.toggle_table("market") # flip
|
|
renderer.toggle_table("strategies", False) # disable
|
|
```
|
|
|
|
## How It Works
|
|
|
|
### DashboardRenderer (`dashboard.py`)
|
|
|
|
- `__init__(console=None, table_visibility=None)` — accepts an optional `table_visibility` dict. If not provided, defaults to `{"market": True, "strategies": False}`.
|
|
- `toggle_table(table_name, enabled=None)` — flips the visibility state when `enabled` is `None`, or sets it to the given boolean. Raises `ValueError` for unknown table names.
|
|
- `build_layout(...)` — conditionally builds only the tables that are enabled, then arranges them:
|
|
- **One table:** `Layout(table)` — full width
|
|
- **Two tables:** `Layout.split_row(Layout(t1), Layout(t2))` — side-by-side
|
|
- **Zero tables:** empty `Layout`
|
|
|
|
### MainApp (`main_app.py`)
|
|
|
|
- `MainApp.__init__` creates the `DashboardRenderer` with the `table_visibility` config.
|
|
- `MainApp.toggle_table(table_name, enabled=None)` delegates to the renderer for runtime toggling.
|
|
- `MainApp.display_dashboard()` calls `renderer.build_layout()` which respects the current visibility settings.
|
|
|
|
## File Reference
|
|
|
|
| File | Line | Description |
|
|
|------|------|-------------|
|
|
| `dashboard.py` | 22 | `DashboardRenderer.__init__` — accepts `table_visibility` parameter |
|
|
| `dashboard.py` | 32 | `toggle_table()` method — flips or sets table visibility |
|
|
| `dashboard.py` | 172 | `build_layout()` — conditionally includes tables based on visibility |
|
|
| `main_app.py` | 349 | `MainApp.__init__` — sets default `table_visibility` |
|
|
| `main_app.py` | 385 | `MainApp.toggle_table()` — runtime toggle method |
|