Skip to content
python.financial

Drag a parameter and watch the chart, trades, and account curve change together. This TradingView-like dashboard runs Python backtests locally, using historical prices you choose. You can inspect a trade, compare nearby settings, or ask an AI agent to change the strategy.

The complete app is included. TradingView's Lightweight Charts handles the charts, while VectorBT PRO supplies the indicators, data adapters, and portfolio engine. The engine is a separately licensed dependency.

We used the dashboard to improve a Bitcoin squeeze configuration. Settings selected from 2018-2023 returned +83.70% after costs in 2024-2025, compared with +5.05% for the starting setup. The same settings stayed positive in a later 2026 check. The inputs and comparison are below so you can reproduce them.

See the dashboard in action

The silent video shows historical data loading, live slider changes, the parameter map, and trade inspection. It ends with the configuration used in the worked example.

Historical BTC-USD daily prices demonstrate the workflow. Dragging and calculations play at their original speed. Read the tutorial transcript or download the video.

Download and run it

Use a Python environment with VectorBT PRO installed, following its installation instructions. Then unzip the app, install the Yahoo Finance dependency, and start it:

unzip trading-dashboard.zip
cd trading-dashboard
pip install yfinance
python app.py

Open http://127.0.0.1:8765 when the terminal prints Ready. The first startup warms the engine and can take several seconds.

Open Historical market data. Choose Yahoo Finance, enter BTC-USD, select 1d, and use start 2018-01-01 and end 2026-11-01. Click Download prices. The end date is exclusive. This loads the history needed for both comparisons below, once, rather than downloading it again whenever you move a slider.

The app also offers Binance and CCXT for exchange data, plus Alpaca stock feeds. The provider form shows the symbol format and any required keys. Yahoo's intraday history is limited, so this example uses daily bars. Two synthetic series remain available for offline checks.

Try the research workflow

Start with lookback 20, Bollinger width 2, Keltner width 1.5, and the RSI filter off. The strategy buys when a volatility squeeze ends with positive momentum. It exits when momentum crosses zero downward. Signals use completed closes and fill at the next bar's open.

  1. Drag a channel-width slider. Watch the bands expand or contract, compression periods change, and fills move. Changing lookback also changes the momentum histogram. The report updates from fresh backtests while you drag.
  2. Check the cost of trading. Open Costs and capital and raise fees or slippage. Both are basis points per side. Five basis points is 0.05%.
  3. Run the Parameter map. Each cell tests a lookback and Keltner width. Bollinger width, the RSI filter, costs, and allocation stay fixed. Click a cell to apply its settings to the chart.
  4. Inspect a trade. Open List of trades and click Inspect. The chart zooms around that trade's entry and exit. Export the closed trades if you want to examine them separately.

A broad patch of good cells is worth investigating before the brightest isolated cell. The next example uses that idea to choose its configuration.

A configuration you can reproduce

The selected inputs are lookback 15, Bollinger width 2, Keltner width 3.25, and RSI off. Keep fees at 5 bps, slippage at 2 bps, and allocation at 95%.

We searched the same 165 combinations shown in the map using only 2018-2023 prices. The selection rule favored a strong neighborhood of nine cells and required at least ten closed trades at its center. We froze the selected inputs before running the later comparisons.

To inspect 2024-2025, download the same symbol with end 2026-01-01, set Evaluation split to 2024-01-01, and choose From split date in Test window. For the 2026 check, download through 2026-11-01, change the split to 2026-01-01, and choose From split date again. Each download resets Test window to All loaded bars. The source and returned dates appear above and below the chart.

Period Starting setup Selected setup Buy and hold
2024-2025 +5.05% +83.70% +101.49%
January-October 2026 -4.73% +1.46% -10.99%

These are returns after costs. Each period starts flat with 10,000 account units and ends marked to market. The buy-and-hold comparison uses the same starting allocation and entry costs.

The selected setup's maximum drawdown was 15.92% in 2024-2025 and 8.31% in the 2026 period. It stayed positive when we repeated the test with higher fees and slippage. All nine preselected neighboring cells were positive in 2024-2025, and six were positive in 2026.

It did not beat buy and hold in the earlier comparison, but it improved substantially on the starting rule and held up better in the later falling market. There were six closed trades in 2024-2025 and only two in 2026, so the later result is still a small sample.

We had already inspected 2024-2025 for other configurations before this search. The 2026 prices were downloaded after the choice was frozen. Both are historical checks, not a claim about future returns. The full search record, including losing neighbors, is available in the technical notes.

Use AI to change the rules

Give your agent the app's Python and interface files, then ask for one change. For example:

Add an optional Wilder RSI(14) filter to squeeze entries.
Require RSI strictly above 55 when the filter is on.
Keep exits, costs, and next-open execution unchanged.
Hold the filter fixed across the parameter map.
Compare both versions on identical prices and date windows.
Run the tests for signal timing, accounting, and map parity.

That filter is already implemented. Its entry condition is small:

rsi = vbt.RSI.run(close, window=14, wtype="wilder").rsi
if rsi_filter:
    entries = entries & rsi.notna() & (rsi > rsi_threshold)

Enable RSI(14) entry filter to try it. The Compare original vs RSI filter button runs the current squeeze inputs with the filter off and on, on both sides of the split. Circles labeled RSI blocked mark rejected candidate entries, separately from actual fills.

Our first attempt at this change improved the earlier period but lost 17.64% in 2024-2025. The stronger worked configuration above keeps RSI off. Testing that extra condition saved us from retaining it just because its earlier report looked better.

Why run the research locally?

The Python rules, data loader, and execution assumptions are yours to edit. An AI agent can change them and run the checks against the same saved prices. You can then inspect the result in the dashboard instead of rebuilding a notebook report after each change.

The backend reuses rolling indicator calculations while each completed update runs a fresh portfolio simulation. In our 10,000-bar test on an Apple M3 Mac, the local server returned results in a median of about 79 ms. That excludes drawing the chart. Downloads and first-run compilation are separate waits.

Component Role
Lightweight Charts Candles, indicator panes, fill markers, and account curves
VectorBT PRO Indicators, historical-data adapters, portfolio simulations, and parameter batches
pandas and NumPy Price validation and signal arrays
Python's HTTP server and browser JavaScript Local requests, controls, and reports

This version focuses on one long-only strategy and historical data. It has no Pine runtime, live data stream, hosted alerts, broker order submission, leverage, or stops. If you mainly want to watch markets and draw on charts, TradingView covers much more of that work.

For research, the next step is to load the market you actually trade, inspect the selected setup's entries, and change one rule at a time. Record the settings you try and keep another period out of the search. The overfitting guide explains how to preserve that separation.

Technical notes and research files

The example README contains the indicator formulas, data-provider limits, accounting assumptions, file inventory, test commands, and complete measurement scope. The app's code is in app.py and dashboard.html.txt.

Run parameter_study.py to reproduce selection and evaluation. The earlier RSI experiment remains in historical-study.json. Public downloads were exercised through Yahoo Finance, BinanceData, and CCXTData on Binance. Alpaca request mapping was tested without live account keys.

Choose which optional services may run. You can change these settings at any time.