Command-Line Interface (CLI)
The forex_data package includes a full-featured Command-Line Interface (CLI) powered by Typer, located at cli/fx_agg_app.py. It provides commands to generate, download, cache, and plot historical and real-time forex market data directly from your terminal.
Execution Syntax
Launch CLI commands using uv run python cli/fx_agg_app.py:
uv run python cli/fx_agg_app.py --help
Commands Overview
Command |
Description |
|---|---|
|
Download missing historical forex tick data and generate aggregated timeframes cached in Parquet databases. |
|
Render interactive candlestick/line charts for historical ranges or launch a real-time streaming Dash dashboard. |
generate-database
Downloads raw tick data (e.g. from Dukascopy/HistData) for the specified currency pairs and builds local partitioned Parquet tables for all requested timeframes.
Usage
uv run python cli/fx_agg_app.py generate-database [ARGUMENTS] [OPTIONS]
Arguments
Argument |
Type |
Description |
|---|---|---|
|
Text (Required) |
Currency ticker symbol or comma-separated list of symbols (e.g. |
|
Text (Required) |
Start timestamp formatted as |
|
Text (Optional) |
End timestamp formatted as |
Options
Option |
Flag |
Default |
Description |
|---|---|---|---|
|
|
|
Timeframe interval(s) to aggregate (e.g., |
|
|
|
Absolute or relative database root directory. Automatically defaults to |
|
|
Operates in offline mode without attempting remote HTTP downloads. |
|
|
|
|
Path to custom YAML configuration file or inline YAML string. |
Examples
1. Generate Daily and Hourly Data for EURUSD:
uv run python cli/fx_agg_app.py generate-database EURUSD 2020-01-01 2021-01-01 -t 1D -t 1h
2. Generate Multiple Tickers with Comma-Separated Syntax:
uv run python cli/fx_agg_app.py generate-database EURUSD,GBPUSD,USDJPY 2018-01-01 2018-12-31 -t 1D,1h,15m
3. Target a Custom Database Directory in Offline Mode:
uv run python cli/fx_agg_app.py generate-database EURUSD 2024-01-01 now -t 1D -d ~/.test_database --offline
plot
Renders interactive market charts in your default browser using Plotly, or launches a live-updating Dash dashboard server for streaming prices.
Usage
uv run python cli/fx_agg_app.py plot [ARGUMENTS] [OPTIONS]
Arguments
Argument |
Type |
Description |
|---|---|---|
|
Text (Required) |
Currency pair symbol (e.g. |
|
Text (Required) |
Start date/time (e.g. |
|
Text (Optional) |
End date/time (e.g. |
|
Text (Required) |
Aggregation interval (e.g. |
Options
Option |
Flag |
Default |
Description |
|---|---|---|---|
|
|
Chart visual type: |
|
|
|
|
Local database root path. Defaults to |
|
|
Read only from local cached parquets without checking remote providers. |
|
|
|
|
Path to YAML configuration file. |
|
|
HTTP port when running a real-time server ( |
|
|
|
Real-time refresh interval in milliseconds (default: 1000 ms). |
Examples
1. Historical Daily Candlestick (OHLC) Chart:
Renders an interactive candlestick chart for EURUSD from January 2024 to June 2026:
uv run python cli/fx_agg_app.py plot EURUSD 2024-01-01 2026-06-06 1D
2. Offline Static Plot up to Current Time:
Plots cached EURUSD daily data up to the current moment without fetching remote updates:
uv run python cli/fx_agg_app.py plot EURUSD 2024-01-01 now 1D --no-download
3. Hourly Line Chart with Custom Database Directory:
Renders an hourly line chart displaying close prices and Volume-Weighted Mean Price (VWMP):
uv run python cli/fx_agg_app.py plot EURUSD 2024-01-01 2024-06-01 1h -d ~/.test_database --type line
4. Continuous Live Streaming Plot (Dash Web Server):
Starts a continuous real-time server on port 8050 that updates the chart dynamically:
uv run python cli/fx_agg_app.py plot EURUSD 2024-01-01 live 1D --port 8050 --interval 1000