Skip to main content

Dashboard

Overview

Data visualization is crucial for understanding and monitoring your trading strategies. The Almanak Strategy Framework leverages Streamlit to provide powerful, intuitive dashboard capabilities. With Streamlit's Pythonic approach, you can create sophisticated visualizations that bring your strategy's data to life.

Directory Structure

Your strategy's dashboard follows a simple, organized structure:

[strategy]/
└── dashboard/
└── ui.py # Main dashboard file

Core Components

1. Configuration Management

  • Automatic Config Loading: Seamlessly loads your strategy settings from config.json
  • SDK Integration: Establishes necessary connections with the Almanak SDK
  • State Management: Handles session state for persistent data across dashboard refreshes

2. Advanced Metrics System

  • Real-time Integration: Direct connection to the Metrics System
  • Flexible Visualization: Support for both real-time and historical data views
  • Extensible Framework: Easy integration of custom metrics and aggregation methods

3. Interactive Visualization Engine

  • Streamlit-powered Interface: Rich, interactive data displays
  • Customizable Charts: Flexible plotting capabilities for various data types
  • Pre-built Components: Ready-to-use visualization modules for common scenarios

Built-in Tools

Metric Management

# Load system-wide metrics
load_metrics_action()

# Access strategy-specific metrics
load_metrics_agg()

Additional specialized metric loaders are available for various data types.

Visualization Tools

# Display liquidity distribution
plot_liquidity_distribution()

# Visualize position changes over time
plot_positions_over_time()

Custom visualization options are available for specific requirements.

Creation

Local Development

To test your dashboard locally:

almanak dashboard test --preset <your-preset>

Key considerations:

  • Requires an existing agent.db in your local_storage directory
  • Strategy must be executed first to generate necessary data
  • Default port: 8501 (configurable via --server-port)
  • Custom storage location can be specified with --local-storage

Pushing Strategy

Before deploying your strategy to the platform, automatic validations will check your dashboard implementation. This helps catch potential issues early in the development cycle. During validation, Streamlit might run and it will use the port 44444.

To start the validation process, run:

almanak strat validate

Production Deployment

Dashboard deployment is automatically handled when you push your strategy to the platform. Upon agent execution, your dashboard becomes accessible for monitoring your strategy's performance and analyzing its data.

Note: The deployment process is seamlessly integrated with your strategy deployment workflow, requiring no additional steps.

Debugging