Skip to content

Missing exports: 23 model classes in kalshi.models.__all__ not re-exported from kalshi #89

Description

@TexasCoding

From Wave 5 architecture audit, findings F-N-01 and F-N-15. Severity: high for the public-API gap.

The gap

`kalshi/models/init.py` exports 23 user-facing response/data classes that are NOT re-exported from `kalshi/init.py`:

`Event`, `EventMetadata`, `MarketMetadata`, `SettlementSource`, `Balance`, `MarketPosition`, `EventPosition`, `PositionsResponse`, `Settlement`, `Trade`, `HistoricalCutoff`, `Announcement`, `DailySchedule`, `Schedule`, `WeeklySchedule`, `ExchangeStatus`, `MaintenanceWindow`, `ForecastPercentilesPoint`, `PercentilePoint`, `AssociatedEvent`, `CreateMarketResponse`, `LookupPoint`, `LookupTickersResponse`.

Several are return types of public client methods:

  • `client.exchange.status() -> ExchangeStatus`
  • `client.markets.list_trades_all() -> Iterator[Trade]`
  • `client.portfolio.balance() -> Balance`
  • `client.events.get() -> Event`

Users who want to type these returns must reach into `kalshi.models.*` submodules — a private-API path.

Verified

`from kalshi import Trade` raises `ImportError` (also `Event`, `Balance`).

Fix

Re-export from `kalshi/init.py`. Minimal, additive, no breakage. The same fix should decide what to do about the schedule classes (`DailySchedule`, `WeeklySchedule`, `Schedule`, `MaintenanceWindow`) — F-N-15 — which are exported from `kalshi.models` but only used as nested fields on `ExchangeStatus`. If they're considered internal, drop from `kalshi.models.all` too. If public, lift to top-level. Either way, end the asymmetry.

Test

Add an export-parity test: `set(kalshi.models.all).issubset(set(kalshi.all))` (or whichever direction matches the intent).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpolishCode-quality and DX improvements; non-functional

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions