| version | 1 |
| name | anyfinancial-realtime-api-data-us |
| description | Self-contained US direct/recent market data access under AnyFinancial. Use for latest quotes, recent bars, latest news, today OHLC, and point fundamentals. |
US Real-time/API Data
This sub-skill is self-contained. It recreates the US point lookup behavior in
AnyFinancial itself and does not depend on external skill repos.
Use For
- Latest or current US stock price.
- Recent intraday OHLCV bars.
- Latest US ticker-specific news.
- Latest point fundamentals.
- Today's OHLC aggregated from recent intraday bars.
Authentication
Use the Rebyte sandbox token and relay URL:
AUTH_TOKEN=$(/home/user/.local/bin/rebyte-auth)
API_URL=$(python3 -c "import json; print(json.load(open('/home/user/.rebyte.ai/auth.json'))['sandbox']['relay_url'])")
Requests use:
POST $API_URL/api/data/financial/sql
Authorization: Bearer $AUTH_TOKEN
Content-Type: application/json
The request body is JSON:
{"sql":"SELECT ...","parameters":[]}
Local Commands
The bundled CLI builds the SQL and sends it through the Rebyte relay:
python3 ../scripts/anyfinancial_api_data.py us latest-price AAPL
python3 ../scripts/anyfinancial_api_data.py us latest-bars AAPL --limit 10
python3 ../scripts/anyfinancial_api_data.py us latest-news TSLA --limit 5
python3 ../scripts/anyfinancial_api_data.py us fundamentals AAPL --limit 1
python3 ../scripts/anyfinancial_api_data.py us today-ohlc AAPL 2026-07-02
Run these from realtime-api-data/us/. From the repository root, use:
python3 realtime-api-data/scripts/anyfinancial_api_data.py us latest-price AAPL
SQL Patterns
Latest Price
SELECT ticker, t, o, h, l, c, v
FROM us.bars_1m
WHERE ticker = 'AAPL'
ORDER BY t DESC
LIMIT 1
Latest Bars
SELECT ticker, t, o, h, l, c, v
FROM us.bars_1m
WHERE ticker = 'AAPL'
ORDER BY t DESC
LIMIT 10
Latest News
SELECT title, published_utc, tickers, content
FROM us.news
WHERE ARRAY_CONTAINS(tickers, 'TSLA')
ORDER BY published_utc DESC
LIMIT 5
Latest Fundamentals
SELECT *
FROM us.fundamentals
WHERE ARRAY_CONTAINS(tickers, 'AAPL')
ORDER BY end_date DESC
LIMIT 1
Today's OHLC From Intraday Bars
WITH day_bars AS (
SELECT t, o, h, l, c, v
FROM us.bars_1m
WHERE ticker = 'AAPL'
AND t >= to_timestamp('2026-07-02T00:00:00')
AND t < to_timestamp('2026-07-02T23:59:59')
),
agg AS (
SELECT date_trunc('day', MIN(t)) AS day,
MIN(t) AS first_bar,
MAX(t) AS last_bar,
MIN(l) AS low,
MAX(h) AS high,
SUM(v) AS volume
FROM day_bars
),
open_row AS (SELECT o AS open FROM day_bars ORDER BY t ASC LIMIT 1),
close_row AS (SELECT c AS close FROM day_bars ORDER BY t DESC LIMIT 1)
SELECT day, first_bar, last_bar, open, high, low, close, volume
FROM agg CROSS JOIN open_row CROSS JOIN close_row
Response Handling
Successful responses are JSON. Rows may appear in data, rows, result, or
results; if the body is an array, treat it as the row list. Preserve returned
timestamps in the user-facing answer; include source fields only when the
provider returns them.
Errors may include success: false, error, message, or detail. Report the
HTTP/provider message exactly and adjust the SQL once; do not retry the same
failing query.
Usage Rules
- For direct lookups, keep queries scoped to one ticker and a small
LIMIT.
- For latest/current requests, query the API; do not answer from memory.
- If a table or column is uncertain, use
../../data/SKILL.md to run catalog and
schema discovery first.
- Use DataFusion SQL syntax.
- Include the bar/news/fundamentals timestamp in the answer.
Do Not Use For
- Event-driven strategy simulation. Use
../../backtesting/SKILL.md.
- Canonical Rebyte Financial Data Service SQL for backtest data. Use
../../data/SKILL.md during the Backtesting data phase.
- Long-form financial research; AnyFinancial Real-time/API Data only retrieves
provider data.