You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Async positions_all omits the event_positions caveat present on the sync docstring #337
PortfolioResource.positions_all (sync) carries a multi-line docstring explaining that the helper deliberately does not surface event_positions aggregates because page boundaries make concatenated event-level totals meaningless, and pointing callers at iterating positions() page-by-page if they need that view.
AsyncPortfolioResource.positions_all is a one-liner that only says "Async counterpart of PortfolioResource.positions_all." An async caller using IDE hover, help(client.portfolio.positions_all), or Sphinx-rendered docs sees no warning, assumes event_positions are returned alongside (the underlying endpoint does return them), and silently builds dashboards missing event-level exposure aggregates. Same risk class as the docstring drift the changelog flagged in #299.
Evidence
kalshi/resources/portfolio.py:115-124 (sync — has the caveat):
) ->Iterator[MarketPosition]:
"""Auto-paginate ``/portfolio/positions``, yielding each ``MarketPosition``. Mirrors :meth:`settlements_all`. The endpoint response also carries ``event_positions`` (aggregate roll-ups over the same underlying markets); those are *not* surfaced here because page boundaries cut the aggregate arbitrarily and concatenating across pages would not recompute a meaningful event-level total. Callers that need the event view should iterate :meth:`positions` page-by-page. """
) ->AsyncIterator[MarketPosition]:
"""Async counterpart of :meth:`PortfolioResource.positions_all`. Use ``async for``."""
Suggested fix
Either change the async docstring to a cross-reference Sphinx can resolve (e.g. See :meth:\PortfolioResource.positions_all` for the event_positions caveat and the page-by-page workaround.) so the full prose renders on the async page, or duplicate the event_positionsparagraph verbatim. The same pattern already used byamend_v2/decrease_v2` keeps both sides in sync.
Activity
docs(resources): sync/async docstring drift sweep (#334, #337, #338, #…