From tradeblocks
Import and set up market data for TradeBlocks analysis. Guides through importing daily OHLCV, VIX term structure, and intraday option bars from API, CSV, or DuckDB sources. Use when market data is missing, regime analysis shows no matches, replay returns empty paths, or enrich_trades shows warnings.
How this skill is triggered — by the user, by Claude, or both
Slash command
/tradeblocks:market-dataThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Guide the user through importing market data so other skills (DC analysis, health checks, replay) have the data they need.
Guide the user through importing market data so other skills (DC analysis, health checks, replay) have the data they need.
enrich_trades returns warnings about missing market dataanalyze_regime_performance returns "No trades matched to market data"replay_trade returns 0 minute bars / $0 P&Lbatch_exit_analysis returns mostly noTrigger with $0 P&LAsk the user what they're trying to do, then check what data exists:
-- Check daily data coverage
SELECT ticker, COUNT(*) as rows,
MIN(date) as earliest, MAX(date) as latest
FROM market.daily GROUP BY ticker ORDER BY ticker
-- Check intraday data coverage
SELECT
CASE WHEN ticker LIKE 'SPX%' OR ticker LIKE 'SPXW%' THEN 'SPX options'
WHEN ticker LIKE 'QQQ%' THEN 'QQQ options'
WHEN ticker = 'SPX' THEN 'SPX underlying'
ELSE ticker END as category,
COUNT(DISTINCT ticker) as tickers,
COUNT(*) as total_bars
FROM market.intraday GROUP BY category
-- Check context derived (regime/term structure)
SELECT COUNT(*) as rows, MIN(date) as earliest, MAX(date) as latest
FROM market._context_derived
Present what's available and what's missing for their goal.
Minimum needed: Daily OHLCV for the underlying + VIX context (VIX/VIX9D/VIX3M)
| What to import | Tool | Example |
|---|---|---|
| Underlying daily (SPX) | import_from_api | ticker: "SPX", target_table: "daily" |
| Underlying daily (QQQ) | import_from_api | ticker: "QQQ", target_table: "daily" |
| VIX context (all 3 tickers) | import_from_api | ticker: "VIX", target_table: "context" |
| Enrichment (RSI, Vol_Regime, etc.) | enrich_market_data | Auto-runs after import, or manual |
Order matters: Import daily first, then context, then enrichment runs automatically.
Useful flags:
dry_run: true — validates parameters and shows what would be imported without writingskip_enrichment: true — skips automatic enrichment (useful when batching multiple imports, then run enrich_market_data once at the end)Date range: Match the trade data range. Check with:
SELECT MIN(date_opened) as earliest, MAX(date_opened) as latest
FROM trades.trade_data WHERE block_id = '<block>'
Needed: Intraday 1-minute bars for each option leg in the trades
The replay engine auto-fetches on cache miss if MASSIVE_API_KEY is set. For bulk pre-loading:
SELECT DISTINCT legs, date_opened FROM trades.trade_data
WHERE block_id = '<block>' ORDER BY date_opened DESC LIMIT 10
Parse the OCC tickers from the legs string (the replay tool does this automatically)
Import each option ticker:
import_from_api: ticker="SPXW260320P06410000", target_table="intraday", timespan="1m"
Note: Option data availability varies by provider. Massive.com typically has data from ~2022 onward for SPX/SPY options. Older trades won't have replay data.
TradingView exports have a Unix timestamp column called time. The mapping handles date+time extraction automatically.
Daily bars:
{
"file_path": "~/Downloads/SPX_daily.csv",
"ticker": "SPX",
"target_table": "daily",
"column_mapping": {
"time": "date",
"open": "open",
"high": "high",
"low": "low",
"close": "close"
}
}
Intraday bars:
{
"file_path": "~/Downloads/SPX_15m.csv",
"ticker": "SPX",
"target_table": "intraday",
"column_mapping": {
"time": "date",
"open": "open",
"high": "high",
"low": "low",
"close": "close"
}
}
Use dry_run: true first to validate the mapping before writing.
If the user has market data in another DuckDB file:
{
"db_path": "~/data/market.duckdb",
"query": "SELECT date, open, high, low, close FROM ext_import_source.spx_daily",
"ticker": "SPX",
"target_table": "daily",
"column_mapping": {
"date": "date",
"open": "open",
"high": "high",
"low": "low",
"close": "close"
}
}
Run the imports based on what's needed. Common recipes:
import_from_api: ticker="SPX", from="2016-01-01", to="today", target_table="daily"import_from_api: ticker="VIX", from="2016-01-01", to="today", target_table="context"import_from_api: ticker="QQQ", from="2016-01-01", to="today", target_table="daily"batch_exit_analysis or replay_trade — auto-fetches on cache miss if API key is setimport_from_api with target_table="intraday"After importing, verify the data is available:
-- Check daily coverage
SELECT ticker, COUNT(*) as rows, MIN(date) as earliest, MAX(date) as latest
FROM market.daily GROUP BY ticker ORDER BY ticker
-- Check regime data populated
SELECT Vol_Regime, COUNT(*) as days
FROM market._context_derived
GROUP BY Vol_Regime ORDER BY Vol_Regime
-- Check term structure populated
SELECT Term_Structure_State, COUNT(*) as days
FROM market._context_derived
WHERE Term_Structure_State IS NOT NULL
GROUP BY Term_Structure_State
If Term_Structure_State is all NULL, VIX3M data is missing — run the context import.
| Symptom | Cause | Fix |
|---|---|---|
enrich_trades shows null VIX3M fields | VIX3M not in market.daily | Import with target_table="context" |
Term_Structure_State all NULL | VIX3M data missing | Import with target_table="context" |
analyze_regime_performance returns 0 matched | No daily data for that ticker | Import daily OHLCV for the underlying |
replay_trade returns 0 bars | No intraday option data cached | Set MASSIVE_API_KEY for auto-fetch, or import manually |
| Enrichment fields missing (RSI, ATR) | enrich_market_data not run | Run it manually for the ticker |
| API import returns 0 rows | Date range outside provider coverage | Try a more recent date range |
| CSV import fails on column mapping | Wrong column names | Use dry_run: true first to preview |
Use purge_market_table to remove market data when needed (e.g., corrupted import, wrong ticker). This deletes rows from the specified table matching a ticker and optional date range.
npx claudepluginhub davidromeo/tradeblocks-skills --plugin tradeblocksDesigns and manages market data infrastructure for financial trading: real-time/delayed feeds, Level 1/2/3 depth, SIP vs direct feeds, vendor selection (Bloomberg, Refinitiv), licensing, entitlements, ticker plants, and data quality.
Validates, resamples, and ingests OHLCV market data (CSV/Parquet/HDF5) for factor mining. Pulls live data from MCP connectors like FactSet, Daloopa, Morningstar.
Guides use of the FinLab quantitative trading package for strategy development, backtesting, and market data access across TW, US, KR, JP, HK equities and ETFs. Includes US-market specifics, universe construction, and ETF rotation workflows.