diff --git a/README.md b/README.md index 99cc8ef..9e9fd23 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,32 @@ MCP server that wraps the [tradingview-screener](https://github.com/shner-elmo/T | `technical_scan` | Screen by technical indicator conditions | | `fundamental_scan` | Screen by fundamental metrics | +### Historical Candles + +| Tool | Description | +|------|-------------| +| `get_historical_candles` | Fetch OHLCV candlestick data with pattern detection | + +Supports count-based and date/time range queries: + +```python +# Last 30 daily candles +get_historical_candles("NASDAQ:AAPL") + +# Specific date range (daily) +get_historical_candles("IDX:BBRI", from_date="2026-05-08", to_date="2026-05-13") + +# Intraday — hourly candles for a date range +get_historical_candles("IDX:BBRI", resolution="60", from_date="2026-05-08", to_date="2026-05-13") + +# Intraday — 1-minute candles for a specific time window +get_historical_candles("NASDAQ:AAPL", resolution="1", from_date="2026-05-17 14:00", to_date="2026-05-17 14:05") +``` + +**Resolutions:** `1`, `5`, `15`, `30`, `60`, `240` (minutes), `D` (daily, default), `W` (weekly), `M` (monthly) + +**Date formats:** `YYYY-MM-DD`, `YYYY-MM-DD HH:MM`, or `YYYY-MM-DD HH:MM:SS` (all UTC). When only `from_date` is given, `to_date` defaults to now. Date-only `to_date` is inclusive (covers the full day through 23:59:59). + ### Utilities | Tool | Description | diff --git a/SKILL.md b/SKILL.md index 4e29f71..a343ad1 100644 --- a/SKILL.md +++ b/SKILL.md @@ -19,6 +19,7 @@ Indonesian stocks are accessed via `market_type="stocks"` and `market_country="i | `find_most_active(market_country="indonesia")` | Most active by volume | | `technical_scan(market_country="indonesia", ...)` | Screen using technical conditions | | `fundamental_scan(market_country="indonesia", ...)` | Screen using fundamental metrics | +| `get_historical_candles(ticker, resolution, ...)` | Fetch OHLCV candles with pattern detection; supports date/time ranges | | `check_holidays(mode="upcoming", limit=10)` | Check IDX holidays (SQLite-cached, `refresh=True` to re-fetch) | | `check_holidays(mode="check", date="2026-05-14")` | Check if a specific date is a holiday | | `check_holidays(mode="range", start_date="...", end_date="...")` | List holidays in a date range | @@ -462,6 +463,55 @@ fundamental_scan({ --- +## 5. Historical Candle Data + +Use `get_historical_candles` to retrieve OHLCV (Open, High, Low, Close, Volume) candlestick data for trend and pattern analysis. The tool also auto-detects common candlestick patterns (Doji, Hammer, Engulfing, etc.) on the latest candle. + +### Resolution Options + +| Resolution | Value | Use When | +|-----------|-------|----------| +| 1 minute | `"1"` | Intraday scalping / micro windows | +| 5 minutes | `"5"` | Short intraday sessions | +| 15 minutes | `"15"` | Intraday analysis | +| 30 minutes | `"30"` | Half-session analysis | +| 1 hour | `"60"` | Multi-day intraday view | +| 4 hours | `"240"` | Swing trade context | +| Daily | `"D"` | Standard daily chart (default) | +| Weekly | `"W"` | Long-term trend | +| Monthly | `"M"` | Macro view | + +### Query Forms + +```python +# Last N daily candles (count-based) +get_historical_candles("IDX:BBRI", resolution="D", count=30) + +# Specific date range — daily candles +get_historical_candles("IDX:BBRI", from_date="2026-05-08", to_date="2026-05-13") + +# Specific date range — hourly candles +get_historical_candles("IDX:BBRI", resolution="60", from_date="2026-05-08", to_date="2026-05-13") + +# From a date until now — daily +get_historical_candles("IDX:BBRI", from_date="2026-05-01") + +# Intraday time window — 1-minute candles +get_historical_candles("IDX:BBRI", resolution="1", from_date="2026-05-17 09:00", to_date="2026-05-17 12:00") +``` + +**Date format:** `YYYY-MM-DD` or `YYYY-MM-DD HH:MM` or `YYYY-MM-DD HH:MM:SS` — all interpreted as **UTC**. IDX Session 1 opens at 02:00 UTC (09:00 WIB), Session 2 closes at 08:50 UTC (15:50 WIB). + +### When to Use Candle Data + +- **Pattern detection**: Doji, Hammer, Shooting Star, Engulfing — confirms entry/exit signals from screener scans +- **Price action around events**: Earnings dates, BI rate decisions, commodity price shocks +- **Holiday gap analysis**: Fetch candles across a multi-day holiday break to measure the gap at reopen +- **Intraday session analysis**: Compare Session 1 vs Session 2 behavior using hourly resolution +- **Trend confirmation**: Check that a breakout screener result is backed by clean candle structure + +--- + ## 6. Pre-Analysis Checklist Before running any analysis, always perform these 3 preliminary checks: