Skip to main content

Module sources

Module sources 

Expand description

The source ports crossed to Python: the records a source answers with, and the adapter that lets any Python object with the right method be one.

A Python source is structural: an object with fetch(demand, as_of) is a market-data source, one with recipes(ask) a recipe source, one with calendars() a calendar source โ€” no helixio class to inherit. The ports are synchronous; an async def fetch is driven by its caller between MarketContext.demand and MarketContext.with_market_data, never from here.

Structsยง

PyCalendarSpec ๐Ÿ”’
A calendar stated as data, for dates.ingest_calendars: the code it binds, the holidays it closes, and the days that are not business days (Saturday and Sunday where weekend names none).
PyDemand ๐Ÿ”’
What a book needs from outside to price on a market: quote strips by template, fixings by series and date, FX spots by pair โ€” and the curves no recipe builds. MarketContext.demand(book) derives one; a sourceโ€™s fetch(demand, as_of) answers it.
PyMarketData ๐Ÿ”’
What a source answered: strips, fixings and spots, each stamped with the date it was observed. Anything a demand names and this does not carry is a gap โ€” a source never pads.
PyRecipeAsk ๐Ÿ”’
What a recipe source is asked about: the date and the collateral keys a book reads.
PyRecipeSpec ๐Ÿ”’
A curve recipe stated as data, validated exactly as the recipe builder validates it: the collateral key, the currency, the discount segments as (role, template) in order, per projection index "telescoping" or the template of its own strip, the windows as (template, start, end), and an optional triangulation hub.
PySource ๐Ÿ”’
A Python object as a source: whichever of fetch, recipes, calendars it has. Each call takes the GIL; an exception it raises becomes a SourceError naming the objectโ€™s type.

Constantsยง

RAISED ๐Ÿ”’
The exception a Python source last raised on this thread. The coreโ€™s SourceError cannot hold it, and the source runs on the thread that maps the error back once the core returns.

Functionsยง

__pyfunction_ingest_calendars ๐Ÿ”’ โš 
__pyfunction_ingested_calendars ๐Ÿ”’ โš 
__pyfunction_set_data_source ๐Ÿ”’ โš 
data_source ๐Ÿ”’
A Python object as a marketโ€™s data source: its fetch, and its recipes where it has that method.
ingest_calendars ๐Ÿ”’
Binds every calendar source states, process-wide: a list of CalendarSpec, or any object with a calendars() method returning one.
ingested_calendars ๐Ÿ”’
The codes ingested this process, sorted โ€” what a run records to say which calendars it added or overrode.
locator ๐Ÿ”’
set_data_source ๐Ÿ”’
Sets the process-wide default data source โ€” any object with fetch(demand, as_of), and recipes(ask) where it serves recipes โ€” or, with None, clears it. A market copies the default when it is built (MarketContext(...)); one built before this call keeps the source it had.
snapshot_err ๐Ÿ”’
A snapshotโ€™s refusal: gaps, a stamp from the future and malformed data as SnapshotError carrying a gaps table (family, key); a sourceโ€™s failure as SourceError; a curve that did not solve, or a pricing failure, in its own layer.
source_err ๐Ÿ”’
A sourceโ€™s failure as SourceError, the sourceโ€™s own exception as its __cause__ โ€” or that exception itself where it is no Exception (a KeyboardInterrupt, a SystemExit), so a retry on SourceError never swallows an interrupt.
source_object ๐Ÿ”’
The Python object source was built from, where it was built from one.

Type Aliasesยง

StripRow ๐Ÿ”’