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ยง
- PyCalendar
Spec ๐ - 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 whereweekendnames 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โsfetch(demand, as_of)answers it. - PyMarket
Data ๐ - 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.
- PyRecipe
Ask ๐ - What a recipe source is asked about: the date and the collateral keys a book reads.
- PyRecipe
Spec ๐ - 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,calendarsit has. Each call takes the GIL; an exception it raises becomes aSourceErrornaming the objectโs type.
Constantsยง
- RAISED ๐
- The exception a Python source last raised on this thread. The coreโs
SourceErrorcannot 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 itsrecipeswhere it has that method. - ingest_
calendars ๐ - Binds every calendar
sourcestates, process-wide: a list ofCalendarSpec, or any object with acalendars()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), andrecipes(ask)where it serves recipes โ or, withNone, 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
SnapshotErrorcarrying agapstable (family,key); a sourceโs failure asSourceError; 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 noException(aKeyboardInterrupt, aSystemExit), so a retry onSourceErrornever swallows an interrupt. - source_
object ๐ - The Python object
sourcewas built from, where it was built from one.
Type Aliasesยง
- Strip
Row ๐