Build
Nodes
One file in nodes/ = one node. The file name is the node name.
Python — parameters are upstream nodes; return a DataFrame (or JSON-able value):
"""20-day annualized realized volatility per ticker."""
import exuvia
@exuvia.node(
schedule="0 18 * * 1-5", # optional: re-run on this cron (local time)
cascade=True, # re-run when upstream output changes (default)
chart={"mark": "line", "encoding": {...}}, # optional Vega-Lite spec, no `data`
)
def rolling_vol(returns):
out = returns.sort_values("date").copy()
out["vol_20d"] = out.groupby("ticker")["ret"].transform(lambda s: s.rolling(20).std() * 252**0.5)
return out.dropna()SQL (DuckDB) — upstream nodes are tables:
-- Latest vol by sector.
-- schedule: */30 9-16 * * 1-5
-- chart: {"mark": "bar", "encoding": {...}}
select u.sector, avg(v.vol_20d) as avg_vol
from universe u join rolling_vol v using (ticker)
group by 1The graph is read statically (ast for Python, identifier matching for
SQL), so a broken node still shows up in the graph with its error, and nothing
runs until you ask.
Shared helpers — code several nodes need lives in Python modules under
lib/ (lib/stats.py, lib/vol/surface.py; no __init__.py needed), and
nodes import it with plain import statements:
@exuvia.node()
def basket_corr(returns):
from lib.stats import weighted_corr
return weighted_corr(returns)A node's code hash covers every lib/ file it imports, directly or through
other helpers, so editing a helper marks exactly those nodes stale. Only
static import / from … import statements are tracked. Besides nodes/,
lib/**/*.py and view folders (see "Views") are the only places the API and
the agent can write.