quantlab.dataset.massive.raw.rest_frame#
- quantlab.dataset.massive.raw.rest_frame(vendor_root, endpoint, schema, key='id')[source]#
Return one REST endpoint’s records as a frame of the fields in
schema.The records are
read_rest_records(vendor_root, endpoint, key), each record’s newest copy once, in the order that function returns them (oldest pull first). A field a record lacks is null; a field whose name ends in_datebecomes apl.Datefrom its first ten characters (an ISO day or timestamp), null when it is not one.- Parameters:
- vendor_rootstr or Path
<download-dir>/massive.- endpointstr
The endpoint’s name (
quantlab.acquisition.massive.rest.ENDPOINTS).- schemadict
Each field read and its polars type as the vendor gives it (dates as
pl.String).- keystr or None, default “id”
As for
read_rest_records.
Examples
>>> import tempfile >>> from datetime import UTC, datetime >>> from quantlab.acquisition.massive.raw_tier import write_rest_page >>> root = tempfile.mkdtemp() >>> write_rest_page(rest_page_file(root, "splits", datetime(2024, 3, 12, tzinfo=UTC), 1), [ ... {"id": "S1", "ticker": "AAA", "execution_date": "2024-03-06", "split_from": 1, "split_to": 4}]) >>> frame = rest_frame(root, "splits", {"ticker": pl.String, "execution_date": pl.String}) >>> frame.rows() [('AAA', datetime.date(2024, 3, 6))]