@mostlyrightmd/economy
Classes
Section titled “Classes”EconomyTickerError
Section titled “EconomyTickerError”Raised when a ticker is not a string or matches no routing root.
A named subclass (mirrors the NHIGH/NLOW ContractIdError) so callers can
instanceof-check rather than parse the message. Mirrors the Python
TypeError / ValueError distinction with a single explicit error — an
unroutable ticker is NEVER a silent null return.
Extends
Section titled “Extends”ContractError
Constructors
Section titled “Constructors”new EconomyTickerError()
Section titled “new EconomyTickerError()”new EconomyTickerError(
message):EconomyTickerError
Parameters
Section titled “Parameters”message
Section titled “message”string
Returns
Section titled “Returns”Overrides
Section titled “Overrides”ContractError.constructor
Interfaces
Section titled “Interfaces”DivergenceWarning
Section titled “DivergenceWarning”A machine-readable divergence event — emitted (and passed to onDivergence)
when a TE-settled series ships the agency first-print proxy. Mirrors the
Python DivergenceWarning intent: the consumer knows the pair’s value is the
agency proxy, NOT the (unlicensed) Trading Economics settlement truth.
Properties
Section titled “Properties”contract
Section titled “contract”
readonlycontract:string
The matched Kalshi series root (e.g. "KXUSPPI").
indicator
Section titled “indicator”
readonlyindicator:string
The economy indicator id.
message
Section titled “message”
readonlymessage:string
Human-readable message.
settlementAuthority
Section titled “settlementAuthority”
readonlysettlementAuthority:string
The contractual settlement authority ("TradingEconomics").
EconomyObservationsV1
Section titled “EconomyObservationsV1”Properties
Section titled “Properties”indicator
Section titled “indicator”indicator:
string
indicator id: cpi | cpi_core | cpi_yoy | nfp | u3 | gdp | ppi | ppi_yoy | jobless_claims | fed_funds
knowledge_time
Section titled “knowledge_time”knowledge_time:
string
leakage cutoff; equals vintage_time for economy (research_economy wires leakage on this)
period
Section titled “period”period:
string
observation period the value refers to: ‘2026-06’ monthly, ‘2026Q2’ quarterly, ‘2026-06-28’ weekly/date, or FOMC meeting date
release_datetime?
Section titled “release_datetime?”
optionalrelease_datetime:null|string
wall-clock the value was released (8:30 ET etc.), UTC
release_type
Section titled “release_type”release_type:
"final"|"preliminary"|"second"|"advance"|"benchmark"|"revised"|"third"
advance | second | third | final | revised | benchmark | preliminary
released_value?
Section titled “released_value?”
optionalreleased_value:null|number
released numeric value; nullable — a not-yet-released period may be schema-shaped but valueless
retrieved_at?
Section titled “retrieved_at?”
optionalretrieved_at:null|string
provenance of the fetch, UTC
series_id?
Section titled “series_id?”
optionalseries_id:null|string
upstream series identifier (BLS/FRED/BEA code) when applicable
settlement_grade
Section titled “settlement_grade”settlement_grade:
boolean
is this vintage the settlement truth (first print as-of expiration); False for later vintages AND the 48 TE-settled series
source
Section titled “source”source:
string
per-row source identity == df.attrs[‘source’]; one of ECONOMY_SOURCES
units?
Section titled “units?”
optionalunits:null|string
index | percent | thousands_persons | percent_saar | …
vintage_time
Section titled “vintage_time”vintage_time:
string
WHEN this value became known (ALFRED realtime_start / release-day capture); the leakage knowledge_time
EconomyPairRow
Section titled “EconomyPairRow”A settlement pair — the first-print observation row plus the resolved
market-outcome metadata. The CONTRACT-level grade is written to BOTH the
canonical snake_case schema field settlement_grade (overwriting the inherited
agency vintage grade — C3) and its camelCase alias settlementGrade; both read
false for a TE-settled series even though the agency first print is a real
vintage. It is the honest label a model reads to know whether the value IS the
settlement truth. knowledge_time (= vintage_time) is the leakage cutoff.
Extends
Section titled “Extends”Properties
Section titled “Properties”agency
Section titled “agency”
readonlyagency:string
The resolved settlement agency short name.
contract
Section titled “contract”
readonlycontract:string
The matched Kalshi series ROOT ticker.
indicator
Section titled “indicator”indicator:
string
indicator id: cpi | cpi_core | cpi_yoy | nfp | u3 | gdp | ppi | ppi_yoy | jobless_claims | fed_funds
Inherited from
Section titled “Inherited from”EconomyObservationRow.indicator
knowledge_time
Section titled “knowledge_time”knowledge_time:
string
leakage cutoff; equals vintage_time for economy (research_economy wires leakage on this)
Inherited from
Section titled “Inherited from”EconomyObservationRow.knowledge_time
period
Section titled “period”period:
string
observation period the value refers to: ‘2026-06’ monthly, ‘2026Q2’ quarterly, ‘2026-06-28’ weekly/date, or FOMC meeting date
Inherited from
Section titled “Inherited from”EconomyObservationRow.period
release_datetime?
Section titled “release_datetime?”
optionalrelease_datetime:null|string
wall-clock the value was released (8:30 ET etc.), UTC
Inherited from
Section titled “Inherited from”EconomyObservationRow.release_datetime
release_type
Section titled “release_type”release_type:
"final"|"preliminary"|"second"|"advance"|"benchmark"|"revised"|"third"
advance | second | third | final | revised | benchmark | preliminary
Inherited from
Section titled “Inherited from”EconomyObservationRow.release_type
released_value?
Section titled “released_value?”
optionalreleased_value:null|number
released numeric value; nullable — a not-yet-released period may be schema-shaped but valueless
Inherited from
Section titled “Inherited from”EconomyObservationRow.released_value
retrieved_at?
Section titled “retrieved_at?”
optionalretrieved_at:null|string
provenance of the fetch, UTC
Inherited from
Section titled “Inherited from”EconomyObservationRow.retrieved_at
series_id?
Section titled “series_id?”
optionalseries_id:null|string
upstream series identifier (BLS/FRED/BEA code) when applicable
Inherited from
Section titled “Inherited from”EconomyObservationRow.series_id
settlement_grade
Section titled “settlement_grade”settlement_grade:
boolean
is this vintage the settlement truth (first print as-of expiration); False for later vintages AND the 48 TE-settled series
Inherited from
Section titled “Inherited from”EconomyObservationRow.settlement_grade
settlementGrade
Section titled “settlementGrade”
readonlysettlementGrade:boolean
Contract-level settlement grade (false for TE-settled series) — a camelCase
alias of the canonical settlement_grade; both carry the same value.
source
Section titled “source”source:
string
per-row source identity == df.attrs[‘source’]; one of ECONOMY_SOURCES
Inherited from
Section titled “Inherited from”EconomyObservationRow.source
units?
Section titled “units?”
optionalunits:null|string
index | percent | thousands_persons | percent_saar | …
Inherited from
Section titled “Inherited from”EconomyObservationRow.units
vintage_time
Section titled “vintage_time”vintage_time:
string
WHEN this value became known (ALFRED realtime_start / release-day capture); the leakage knowledge_time
Inherited from
Section titled “Inherited from”EconomyObservationRow.vintage_time
EconomyResolution
Section titled “EconomyResolution”A resolved Kalshi economy settlement mapping.
Mirrors the Python EconomyResolution fields (camelCase). contractTermsUrl is
derived from the routing rule’s contractTermsPdf basename (the trusted
routing companion to the agency NAME).
Properties
Section titled “Properties”agency
Section titled “agency”
readonlyagency:string
Canonical settlement agency short name (BLS / BEA / DOL / FederalReserve / TradingEconomics).
contractTermsUrl
Section titled “contractTermsUrl”
readonlycontractTermsUrl:null|string
The CFTC contract-terms PDF URL for the series, when known.
indicator
Section titled “indicator”
readonlyindicator:string
Economy indicator id (schema.economy.observations.v1 vocabulary).
readonlyroot:string
The matched Kalshi series ROOT ticker (e.g. "KXUSPPIYOY").
settlementGrade
Section titled “settlementGrade”
readonlysettlementGrade:boolean
true when the agency first print IS the settlement truth; false for the
Trading-Economics-settled series (the agency first print ships as a labeled
proxy — a TE value is NEVER fabricated).
EconomySettlementRule
Section titled “EconomySettlementRule”Properties
Section titled “Properties”agency
Section titled “agency”
readonlyagency:string
contractTermsPdf
Section titled “contractTermsPdf”
readonlycontractTermsPdf:string
indicator
Section titled “indicator”
readonlyindicator:string
settlementGrade
Section titled “settlementGrade”
readonlysettlementGrade:boolean
ReleaseEvent
Section titled “ReleaseEvent”One scheduled release of an economy indicator.
Properties
Section titled “Properties”agency
Section titled “agency”
readonlyagency:string
The source agency short name (BLS / BEA / DOL / FederalReserve).
indicator
Section titled “indicator”
readonlyindicator:string
The economy indicator id.
period
Section titled “period”
readonlyperiod:string
The observation period this release publishes ("2026-06" / "2026Q2" / a date).
releaseDatetime
Section titled “releaseDatetime”
readonlyreleaseDatetime:string
The scheduled release wall-clock, tz-aware UTC ISO (8:30 ET → 12:30 UTC).
ResearchEconomyOptions
Section titled “ResearchEconomyOptions”Properties
Section titled “Properties”
optionalasOf:TimePoint
Optional leakage cutoff. When given, any pair whose knowledge_time
(vintage_time) is after asOf throws LeakageError — a future revision
can never leak into research.
delivery?
Section titled “delivery?”
optionaldelivery:EconomyDelivery
Where the computation runs (contract §2), forwarded to series. "live"
(default) | "hosted" (reserved seam → SourceUnavailableError).
fetchRows?
Section titled “fetchRows?”
optionalfetchRows:FetchRows
Injected fetcher (tests / custom transport), forwarded to series.
onDivergence()?
Section titled “onDivergence()?”
optionalonDivergence: (warning) =>void
Optional structured divergence handler. Invoked with the
DivergenceWarning for a TE-settled series so a consumer can branch
programmatically. This is the ONLY divergence side-channel — researchEconomy
writes nothing to the console (L1); a consumer that wants a log emits one here.
Parameters
Section titled “Parameters”warning
Section titled “warning”Returns
Section titled “Returns”void
source?
Section titled “source?”
optionalsource:EconomySource
Provenance pin (source-identity contract §1), forwarded to the underlying
series read. undefined (default) uses the per-indicator default routing;
an unknown source or a valid authority that cannot serve the resolved
indicator throws pre-fetch. Whether to also add an includeEconomy covariate
seam to core’s dataset() is an OPTION-B question deferred to review — this
function does NOT touch core.
SeriesOptions
Section titled “SeriesOptions”Properties
Section titled “Properties”delivery?
Section titled “delivery?”
optionaldelivery:EconomyDelivery
Where the computation runs (contract §2). "live" (default) hits the public
agency APIs; "hosted" is the reserved precomputed-API seam and throws
SourceUnavailableError naming MOSTLYRIGHT_ECONOMY_HOSTED_URL + MOSTLYRIGHT_API_KEY.
fetchRows?
Section titled “fetchRows?”
optionalfetchRows:FetchRows
Injected fetcher (tests / custom transport). When omitted, the default agency dispatch (BLS latest-revised + ALFRED first-print) is used — the live path exercised in the smoke.
signal?
Section titled “signal?”
optionalsignal:AbortSignal
Caller abort signal, propagated to every agency fetch (and composed with
each attempt’s retry backoff wait). An abort mid-flight rejects promptly
with the platform AbortError — never reclassified as a transport error.
Ignored when fetchRows is injected (the caller owns that transport).
source?
Section titled “source?”
optionalsource:EconomySource
Provenance pin (contract §1). undefined (default) uses the per-indicator
default routing; a pin names the authority. An unknown source, OR a valid
authority that cannot serve indicator (e.g. source: "bea" for "cpi"),
throws BEFORE any fetch — never a silent fallback.
vintages?
Section titled “vintages?”
optionalvintages:Vintages
"settlement" (default) → settlement-grade first-print rows; "all" → every vintage.
SnapshotOptions
Section titled “SnapshotOptions”Properties
Section titled “Properties”
optionalasOf:Date
The knowledge-time cutoff. Only vintages whose vintage_time is at or before
asOf are considered. Defaults to now — the current settlement-target state.
delivery?
Section titled “delivery?”
optionaldelivery:EconomyDelivery
Where the computation runs (contract §2), forwarded to series.
fetchRows?
Section titled “fetchRows?”
optionalfetchRows:FetchRows
Injected fetcher (tests / custom transport), forwarded to series.
indicator
Section titled “indicator”indicator:
string
The indicator id (schema.economy.observations.v1 vocabulary).
source?
Section titled “source?”
optionalsource:EconomySource
Provenance pin (contract §1), forwarded to series.
Type Aliases
Section titled “Type Aliases”EconomyDelivery
Section titled “EconomyDelivery”EconomyDelivery:
"live"|"hosted"
Accepted delivery= values (contract §2).
EconomyObservationRow
Section titled “EconomyObservationRow”EconomyObservationRow:
EconomyObservationsV1
One economic-indicator observation row (a schema.economy.observations.v1 record).
EconomySource
Section titled “EconomySource”EconomySource:
"fred"|"bls"|"bea"|"dol"|"fed"
Accepted source= provenance authorities (contract §1).
FetchRows()
Section titled “FetchRows()”FetchRows: (
indicator,fromDate,toDate) =>Promise<EconomyObservationRow[]>
A function that returns the raw schema.economy.observations.v1 rows for a window.
Parameters
Section titled “Parameters”indicator
Section titled “indicator”string
fromDate
Section titled “fromDate”Date
toDate
Section titled “toDate”Date
Returns
Section titled “Returns”Promise<EconomyObservationRow[]>
HistoryOptions
Section titled “HistoryOptions”HistoryOptions:
SeriesOptions
Back-compat alias — history accepts the same options as series.
Vintages
Section titled “Vintages”Vintages:
"settlement"|"all"
Vintage-selection mode.
Variables
Section titled “Variables”ECONOMY_AGENCY_NAMES
Section titled “ECONOMY_AGENCY_NAMES”
constECONOMY_AGENCY_NAMES:ReadonlyArray<string>
FEDS_FIRST_CONTRACT
Section titled “FEDS_FIRST_CONTRACT”
constFEDS_FIRST_CONTRACT:Readonly<Record<string,string>>
FEDS-2026-010 Table 1 first-contract dates (YYYY-MM-DD), keyed on the economy indicator vocabulary. A request below a key’s date is out-of-range. PPI / CPI-Core / jobless-claims floors are Kalshi-inception-derived (not FEDS Table-1 rows), conservatively aligned to the nearest FEDS-dated BLS analog — matching the Python table exactly (tighten if a dated first contract is later confirmed).
FRED_SERIES_BY_INDICATOR
Section titled “FRED_SERIES_BY_INDICATOR”
constFRED_SERIES_BY_INDICATOR:Readonly<Record<string,string>>
SETTLEMENT_ROUTING
Section titled “SETTLEMENT_ROUTING”
constSETTLEMENT_ROUTING:Readonly<Record<string,EconomySettlementRule>>
version
Section titled “version”
constversion:"1.9.9"="1.9.9"
Public package version; kept in lockstep with package.json.
Functions
Section titled “Functions”assertWithinFloor()
Section titled “assertWithinFloor()”assertWithinFloor(
indicator,fromDate):void
Throw DataAvailabilityError (reason: "out_of_window") when fromDate
predates indicator’s FEDS first-contract floor, or when indicator is
unknown (never silently passes). Returns void when fromDate is at/after the
floor. Mirrors the Python assert_within_floor.
Parameters
Section titled “Parameters”indicator
Section titled “indicator”string
An economy indicator key (must be a key of FEDS_FIRST_CONTRACT).
fromDate
Section titled “fromDate”Date
The inclusive start of the requested research range (compared at UTC-day granularity — the time component is dropped).
Returns
Section titled “Returns”void
history()
Section titled “history()”history(
indicator,fromDate,toDate,options):Promise<DataResult<EconomyObservationsV1>>
Deprecated alias of series — returns byte-identical output.
Parameters
Section titled “Parameters”indicator
Section titled “indicator”string
fromDate
Section titled “fromDate”Date
toDate
Section titled “toDate”Date
options
Section titled “options”SeriesOptions = {}
Returns
Section titled “Returns”Promise<DataResult<EconomyObservationsV1>>
Deprecated
Section titled “Deprecated”Use series. history is retained as a working alias (plan
conformed the economy surface to the cross-vertical source-identity
contract). It emits NO runtime warning this release — matching the
research/dataset silent-alias style. A deprecation lands in the next
minor; removal at 2.0. All arguments forward verbatim to series;
see its docs for the full contract (vintages, source, delivery).
kalshiEconomyResolve()
Section titled “kalshiEconomyResolve()”kalshiEconomyResolve(
seriesTicker):EconomyResolution
Resolve a Kalshi economy ticker to its (root, settlement mapping).
Matching is exact-then-longest-prefix (identical to the Python resolver):
- Exact match on the full (uppercased) ticker, else
- the LONGEST
SETTLEMENT_ROUTINGroot thattickerstarts with.
Parameters
Section titled “Parameters”seriesTicker
Section titled “seriesTicker”string
A Kalshi economy series root ("KXCPIYOY") or a concrete
dated market ticker ("KXCPIYOY-26JUL"). Case-insensitive.
Returns
Section titled “Returns”A frozen EconomyResolution.
Throws
Section titled “Throws”seriesTicker is not a string, or matches no root.
releases()
Section titled “releases()”releases(
indicator):ReleaseEvent[]
Return the release calendar / schedule for indicator, sorted ascending by
releaseDatetime. Sourced from the curated v1 schedule table (a live
agency-calendar fetch is a documented fast-follow).
Parameters
Section titled “Parameters”indicator
Section titled “indicator”string
Returns
Section titled “Returns”Throws
Section titled “Throws”indicator is not a string.
Throws
Section titled “Throws”indicator has no known schedule (never returns []/null).
researchEconomy()
Section titled “researchEconomy()”researchEconomy(
seriesOrContract,fromDate,toDate,options):Promise<EconomyPairRow[]>
Return leakage-free settlement pairs for seriesOrContract.
Each pair joins the market outcome (resolved agency/indicator/settlement
metadata) to the first-print indicator value and the as-of features known at
knowledge_time = vintage_time — safe in research and live.
Parameters
Section titled “Parameters”seriesOrContract
Section titled “seriesOrContract”string
A Kalshi economy series root ("KXCPIYOY") or a concrete
dated market ticker ("KXCPIYOY-26JUL"). Case-insensitive.
fromDate
Section titled “fromDate”Date
Inclusive start of the requested range.
toDate
Section titled “toDate”Date
Inclusive end of the requested range.
options
Section titled “options”asOf (leakage cutoff), fetchRows, onDivergence.
Returns
Section titled “Returns”Promise<EconomyPairRow[]>
The settlement pairs (object array — no DataFrame).
Throws
Section titled “Throws”the ticker resolves to no routing root.
Throws
Section titled “Throws”the indicator’s window is below the FEDS floor.
Throws
Section titled “Throws”the settlement period has no first print yet.
Throws
Section titled “Throws”an asOf was given and a pair’s vintage_time is after it.
series()
Section titled “series()”series(
indicator,fromDate,toDate,options):Promise<DataResult<EconomyObservationsV1>>
Return economic-indicator observation rows for indicator (canonical read).
Parameters
Section titled “Parameters”indicator
Section titled “indicator”string
The indicator id (schema.economy.observations.v1 vocabulary:
"cpi" / "nfp" / "gdp" / "ppi" / "jobless_claims" / …).
fromDate
Section titled “fromDate”Date
Inclusive start of the requested range.
toDate
Section titled “toDate”Date
Inclusive end of the requested range.
options
Section titled “options”SeriesOptions = {}
vintages ("settlement" default | "all"), source
(contract §1 pin), delivery (contract §2), + an optional injected fetchRows.
Returns
Section titled “Returns”Promise<DataResult<EconomyObservationsV1>>
The observation rows (object array — the TS SDK convention; no DataFrame).
Throws
Section titled “Throws”vintages/source/delivery is invalid (source/delivery
validated BEFORE any fetch).
Throws
Section titled “Throws”delivery: "hosted" (the reserved seam).
Throws
Section titled “Throws”fromDate is below the indicator’s FEDS floor,
or the indicator is unknown.
Throws
Section titled “Throws”the window has no relevant rows — a
scheduled release has not landed yet. NEVER returns []/null.
snapshot()
Section titled “snapshot()”snapshot(
options):Promise<DataResult<EconomyObservationsV1>>
Return the settlement-target state of indicator as knowable at asOf.
Parameters
Section titled “Parameters”options
Section titled “options”indicator (required), asOf (default now), source,
delivery, fetchRows.
Returns
Section titled “Returns”Promise<DataResult<EconomyObservationsV1>>
The { rows, provenance } envelope (the same DataResult<Row>
series/history return): one settlement-grade row per period knowable at
asOf (the latest such vintage per period), with provenance byte-identical to
the composed series read (same schema_id, source stamped from the rows).
Throws
Section titled “Throws”an invalid source/delivery (pre-fetch) — see series.
Throws
Section titled “Throws”delivery: "hosted" (the reserved seam).
Throws
Section titled “Throws”indicator is unknown (no FEDS floor).
Throws
Section titled “Throws”nothing is knowable at asOf — no
settlement-grade vintage exists at or before the cutoff. NEVER returns []/null.