mostlyright.markets.earnings
mostlyright.markets.earnings
Section titled “mostlyright.markets.earnings”mostlyright.markets.earnings — earnings-mention market support (Phase 27).
The earnings/ submodule mirrors polymarket.py: a thin SDK layer over
the prediction-market earnings-mention universe (Kalshi
KXEARNINGSMENTION{TICKER} + Polymarket “will registries); the resolver + PIT
helpers land in 27-05/27-06/27-07.
The registries here are the discovery-time codegen’d copy (D-27.1 “two
homes”): the AUTHORITATIVE provider fingerprints live in the satellite
(mostlyright-2a-earnings-audio), but the SDK NAMES a provider (without
capturing) by reading this codegen’d copy via scripts/export_schemas.py.
class mostlyright.markets.earnings.EarningsResolution(ticker, target_word, event_date, resolution_rule, resolution_status=‘qualifying_event’)
Section titled “class mostlyright.markets.earnings.EarningsResolution(ticker, target_word, event_date, resolution_rule, resolution_status=‘qualifying_event’)”Bases: object
The frozen tuple a Kalshi earnings-mention contract resolves to.
Mirrors NHighResolution:
an immutable (ticker, target_word, event_date, resolution_rule) carrier
so a resolution cannot be mutated downstream (the frozen-tuple contract the
TS twin mirrors via Object.freeze in W3/27-07).
- Parameters:
event_date : date
Section titled “event_date : date”resolution_rule : str
Section titled “resolution_rule : str”resolution_status : str = ‘qualifying_event’
Section titled “resolution_status : str = ‘qualifying_event’”Whether a qualifying call exists for this date. "qualifying_event" for
a normal resolution; "no_qualifying_event" when the Polymarket derive
sees a postponed/cancelled call (RESEARCH-MARKETS §2.1(6)). Defaulted so
the Kalshi resolve path is unchanged.
target_word : str
Section titled “target_word : str”ticker : str
Section titled “ticker : str”mostlyright.markets.earnings.derive(event)
Section titled “mostlyright.markets.earnings.derive(event)”Derive a frozen EarningsResolution from a Polymarket event payload.
The payload is untrusted. The derive refuses (returns None) when:
- the slug/title does not look like an earnings-mention market;
- the
tickeris missing or not inEARNINGS_SERIES_ROSTER; - a
webcast_urlis present but its host is NOT onWEBCAST_HOST_ALLOWLIST(T-27-15 security boundary — refuse before derive); target_wordorevent_dateis missing / unparseable.
A postponed / cancelled call yields a resolution with
resolution_status="no_qualifying_event" (RESEARCH-MARKETS §2.1(6)).
- Return type:
EarningsResolution|None - Parameters: event (dict [str , Any ])
mostlyright.markets.earnings.detect_provider(webcast_url)
Section titled “mostlyright.markets.earnings.detect_provider(webcast_url)”Name the webcast provider for webcast_url, or None.
The host is first checked against WEBCAST_HOST_ALLOWLIST (the
security boundary): a non-allowlisted host returns None — it is NEVER
fingerprinted from a raw substring (so a hostile evil.example/q4inc
cannot spoof a provider). An allowlisted host is then matched against
WEBCAST_PROVIDER_FINGERPRINTS
by host substring.
- Return type:
str|None - Returns:
The canonical provider id (
"q4"etc.), orNonewhen the host is non-allowlisted or matches no fingerprint. - Parameters: webcast_url (str)
mostlyright.markets.earnings.resolve(contract_id, event_date, , target_word)
Section titled “mostlyright.markets.earnings.resolve(contract_id, event_date, , target_word)”Resolve a Kalshi earnings-mention contract to its frozen tuple.
The contract_id is the Kalshi market identifier — one of the three root
variants KXEARNINGSMENTION<TICKER> (e.g. KXEARNINGSMENTIONNKE),
KXMENTIONEARN<TICKER>, or the Berkshire fixed root KXBRKEM. The
suffix is the ticker; it is validated against
EARNINGS_SERIES_ROSTER.
- Parameters:
- contract_id (
str) – Kalshi market identifier. Case-insensitive. - event_date (
date) – The calendar date the call airs / the market settles for. Must be adatetime.datewith NO time component. - target_word (
str) – The word/phrase the market resolves on. Required, non-empty.
- contract_id (
- Return type:
EarningsResolution - Returns:
A frozen
EarningsResolution. - Raises:
- TypeError –
contract_idis not a string,event_dateis adatetime(or any non-date), ortarget_wordis not a string. - ValueError –
contract_idmatches no known root, the ticker suffix is empty, the ticker is not inEARNINGS_SERIES_ROSTER, ortarget_wordis empty.
- TypeError –
Modules
Section titled “Modules”catalog | Earnings discovery-time membership registries (Phase 27, 27-05). |
|---|---|
pit | Point-in-time alignment + leakage wiring for earnings facts (Phase 27, 27-06). |
polymarket_derive | Polymarket earnings-mention derive + webcast provider fingerprint (27-05). |
registries | Earnings codegen registries — source-of-truth dicts (Phase 27, 27-02). |
resolver | Kalshi earnings-mention resolver (Phase 27, 27-05). |