| description | Collects and queries financial market data (OHLCV bars, price snapshots, currency strength rankings) for forex, currency indices, equity indices, metals, energy, and crypto via yfinance and TradingView into a SQLite database. Use when fetching prices, collecting/backfilling market or OHLCV data, computing currency strength, or querying stored quotes across timeframes (1m to weekly). |
| name | market-data-engine |
| triggers | ["market data","price data","currency strength","collect data","fetch prices"] |
| category | trading-finance |
| maturity | stable |
| tags | ["forex","ohlcv","yfinance","currency-strength","sqlite"] |
Market Data Engine
Quick Start
SKILL=${CLAUDE_SKILLS_DIR:-$HOME/.claude-agent/.claude/skills}/market-data-engine/scripts
python3 $SKILL/collect.py --interval 1d
python3 $SKILL/collect.py --interval 1h --subclass major
python3 $SKILL/collect.py --interval 4h --instruments EURUSD,GBPUSD
python3 $SKILL/collect.py --currency-strength --interval 1d --json
python3 $SKILL/collect.py --snapshot --json
python3 $SKILL/collect.py --interval 1d --n-bars 365
Query Data
python3 $SKILL/query.py ohlcv EURUSD --interval 1d --last 30
python3 $SKILL/query.py strength --latest
python3 $SKILL/query.py snapshot --latest
python3 $SKILL/query.py stats
Instruments (79 total)
| Class | Count | Examples |
|---|
| Currency Indices | 8 | DXY, EXY, BXY, JXY, CXY, AXY, ZXY, SXY |
| Forex Majors | 7 | EURUSD, GBPUSD, USDJPY, AUDUSD, USDCAD, USDCHF, NZDUSD |
| Forex Crosses | 21 | EURJPY, GBPJPY, AUDNZD, EURGBP, ... |
| Forex Exotics | 27 | EURNOK, USDNOK, EURSEK, USDTRY, USDZAR, ... |
| Equity Indices | 9 | SPX500, NAS100, DAX, UK100, JPN225, US30, ... |
| Metals | 2 | XAUUSD (Gold), XAGUSD (Silver) |
| Energy | 3 | BRENT, WTI, NATGAS |
| Crypto | 2 | BCH, ETH |
Data Sources
- yfinance — primary for daily/hourly/minute data. Free, no API key.
- tvdatafeed — TradingView data. Required for 4h timeframe and currency indices. Free without login (limited).
- Auto-fallback: yfinance first, tvdatafeed fills gaps.
Intervals
| Interval | yfinance | tvdatafeed | Max History |
|---|
| 1m | ✅ | ✅ | 7 days |
| 5m | ✅ | ✅ | 60 days |
| 15m | ✅ | ✅ | 60 days |
| 30m | ✅ | ✅ | 60 days |
| 1h | ✅ | ✅ | 730 days |
| 4h | ❌ | ✅ | 5000 bars |
| 1d | ✅ | ✅ | max |
| 1w | ✅ | ✅ | max |
Currency Strength
Tracks 8 individual currency indices from TradingView:
- Ranks currencies 1 (strongest) to 8 (weakest) by daily change
- Answers "is EURUSD moving because EUR is strong or USD is weak?"
- Query:
python3 query.py strength --latest
Files
scripts/
symbols.py — instrument registry (79 instruments, symbol mapping)
db.py — SQLite schema and helpers
collect.py — data collection (yfinance + tvdatafeed)
query.py — query interface
data/
market.db — SQLite database