Skip to content

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 say ”). v1 ships the codegen source-of-truth registries (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:
    • ticker (str)
    • target_word (str)
    • event_date (date)
    • resolution_rule (str)
    • resolution_status (str)

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.

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 ticker is missing or not in EARNINGS_SERIES_ROSTER;
  • a webcast_url is present but its host is NOT on WEBCAST_HOST_ALLOWLIST (T-27-15 security boundary — refuse before derive);
  • target_word or event_date is missing / unparseable.

A postponed / cancelled call yields a resolution with resolution_status="no_qualifying_event" (RESEARCH-MARKETS §2.1(6)).

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.), or None when 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 a datetime.date with NO time component.
    • target_word (str) – The word/phrase the market resolves on. Required, non-empty.
  • Return type: EarningsResolution
  • Returns: A frozen EarningsResolution.
  • Raises:
    • TypeErrorcontract_id is not a string, event_date is a datetime (or any non-date), or target_word is not a string.
    • ValueErrorcontract_id matches no known root, the ticker suffix is empty, the ticker is not in EARNINGS_SERIES_ROSTER, or target_word is empty.
catalogEarnings discovery-time membership registries (Phase 27, 27-05).
pitPoint-in-time alignment + leakage wiring for earnings facts (Phase 27, 27-06).
polymarket_derivePolymarket earnings-mention derive + webcast provider fingerprint (27-05).
registriesEarnings codegen registries — source-of-truth dicts (Phase 27, 27-02).
resolverKalshi earnings-mention resolver (Phase 27, 27-05).