Point-in-time panel
This recipe builds one row per company and month-end: the latest fiscal-year net income known at that day's close, and the day's adjusted close. It reads the financials cross-section and the daily bars cross-section.
import csv
import datetime
import os
import zoneinfo
import httpx
api = httpx.Client(base_url="https://api.tauric.ai",
headers={"Authorization": f"Bearer {os.environ['TAURIC_API_KEY']}"}, timeout=30)
NEW_YORK = zoneinfo.ZoneInfo("America/New_York")
SECTOR = "energy"
MONTH_ENDS = ["2026-01-30", "2026-02-27", "2026-03-31", "2026-04-30", "2026-05-29",
"2026-06-30", "2026-07-31", "2026-08-31", "2026-09-30", "2026-10-30"]
def read_all(path, **params):
rows = []
while True:
page = api.get(path, params=params).raise_for_status().json()
rows += page["data"]
if page["next_cursor"] is None:
return rows
params["after"] = page["next_cursor"]
def latest_net_income(date):
close = datetime.datetime.combine(datetime.date.fromisoformat(date), datetime.time(16), NEW_YORK)
latest = {}
for fiscal_year in (close.year - 2, close.year - 1):
for row in read_all("/v1/securities/financials", line="Net Income (Loss)", fiscal_year=fiscal_year,
sector=SECTOR, known_at=close.isoformat()):
if row["value"] is not None:
latest[row["symbols"][0]] = row
return latest
with open("panel.csv", "w", newline="") as out:
panel = csv.writer(out)
panel.writerow(["date", "symbol", "fiscal_year", "net_income", "accepted_at", "adjusted_close"])
for date in MONTH_ENDS:
bars = {row["instrument"]["key"].removeprefix("security:"): row["bar"]
for row in read_all("/v1/securities/history", date=date, sector=SECTOR)}
values = latest_net_income(date)
for symbol, row in values.items():
panel.writerow([date, symbol, row["fiscal_year"], row["value"],
row["sources"][0]["accepted_at"], bars[symbol]["close"]])
print(date, len(values), "companies")
A cross-section returns its rows in pages; the script sends each page's next_cursor as after until it is null
(cross-sections).
known_at is the day's close, so a filing accepted later is read on the next month-end. On one date some companies
have filed the last fiscal year and others have not: the script reads the two latest fiscal years and keeps each
company's newer value. Each row's accepted_at is never later than its date's close.
The closes are adjusted closes (split_dividend_adjusted, price history), so the
ratio of two is a total return. They are not traded prices, so a valuation ratio such as an earnings yield is not built
from them. The universe is today's listed companies, so the panel has survivorship bias: a company delisted after a
date is missing from that date's panel.