SPB Git forge

spb/hfmarketdata

Public

Open high-frequency market data platform — FirstRate full-history downloader, DuckDB/Parquet lake, open REST API and React docs platform (www.hfmarketdata.io)

127commits 1branches 0releases
24.7 MBsize
maindefault branch
11 days agolast push
JavaScript 53.7% Python 38.3% CSS 4.6% TypeScript 3.1%
1.8 KB · 53 lines python
Raw Blame History
1"""Non-regression of the historical v1 surface: same paths, same shapes, same status codes."""234def test_health(client):5    r = client.get("/health")6    assert r.status_code == 2007    assert r.json()["status"] == "ok"8910def test_status_lists_assets(client):11    r = client.get("/v1/status")12    assert r.status_code == 20013    body = r.json()14    assert "datasets" in body and "stock" in body["datasets"]151617def test_tickers_and_bars_shape(client):18    r = client.get("/v1/stock/tickers?timeframe=1day")19    assert r.status_code == 20020    assert "AAPL" in r.json()["tickers"]21    r = client.get("/v1/bars/stock/AAPL?timeframe=1day&limit=5")22    assert r.status_code == 20023    body = r.json()24    assert body["count"] == 5 and set(body["data"][0]) >= {"ticker", "datetime", "open", "high", "low", "close", "volume"}25    assert r.headers["X-Row-Count"] == "5"262728def test_csv_format(client):29    r = client.get("/v1/bars/stock/AAPL?timeframe=1day&limit=3&format=csv")30    assert r.status_code == 200 and r.headers["content-type"].startswith("text/csv")31    assert r.text.splitlines()[0].startswith("ticker,datetime")323334def test_uniform_error_envelope_keeps_legacy_detail(client):35    r = client.get("/v1/bars/stock/NOPE?timeframe=1day")36    assert r.status_code == 40437    body = r.json()38    assert body["error"]["code"] == "TICKER_NOT_FOUND"39    assert body["error"]["docs"].endswith("#ticker_not_found")40    assert body["detail"]  # legacy field still present414243def test_validation_error_is_uniform(client):44    r = client.get("/v1/bars/stock/AAPL?timeframe=1day&limit=0")45    assert r.status_code == 42246    assert r.json()["error"]["code"] == "VALIDATION_ERROR"474849def test_options_chain(client):50    r = client.get("/v1/options/chain/AAPL?limit=4")51    assert r.status_code == 20052    assert r.json()["count"] == 453