BREAKING(v3): relocate fills/fills_all from OrdersResource to PortfolioResource#376
Conversation
`fills` and `fills_all` (sync + async) move from `OrdersResource` to `PortfolioResource`, grouping them with the rest of the `/portfolio/*` family (`settlements`, `deposits`, `withdrawals`). The endpoint URL `GET /portfolio/fills`, response shape `Page[Fill]`, and filters (`ticker`, `order_id`, `min_ts`, `max_ts`, `cursor`, `subaccount`) are unchanged — only the access path on the client moves. `OrdersResource.fills` / `OrdersResource.fills_all` (and async equivalents) remain in v3.0.0 as `@typing_extensions.deprecated` thin forwarders that delegate to the same `/portfolio/fills` primitive and emit a single `DeprecationWarning` per call. They will be removed in a future release. Tests cover the new location (happy path + cursor/filter parity, sync and async) and the deprecation behavior of the old location (single warning per call, behavior preserved). Docs in `docs/resources/portfolio.md` add a `Fills` section; `docs/resources/orders.md` keeps a one-line forwarder note pointing at the new location. Closes #351
Code Review — PR #376: Relocate fills/fills_all to PortfolioResourceOverall: The migration strategy is solid — Critical: Missing
|
| Status | |
|---|---|
_contract_support.py METHOD_ENDPOINT_MAP entries |
❌ Missing |
cursor / max_pages exclusions for new fills_all |
❌ Missing |
Duplicated _fills_params |
|
| Inline NOTE comments | |
| Tests | ✅ Good coverage |
| Deprecation strategy | ✅ Correct |
| Docs | ✅ Updated |
The first gap is a CI-hard-fail by design (the repo's own drift tests will catch it). The second is a structural debt item. Both are straightforward fixes.
|
Round-2 review addressed in c490866: registered new PortfolioResource.fills/fills_all (sync + async) in METHOD_ENDPOINT_MAP and _MAX_PAGES_FQNS mirroring the existing OrdersResource entries. Old OrdersResource.fills/fills_all entries retained for the deprecated forwarders. |
Code Review — PR #376: Relocate fills/fills_all to PortfolioResourceOverall, this is a well-structured breaking change with a solid migration path. The deprecated forwarders, drift-test updates, and docs update are all handled correctly. A few things to address before merge: Correctness / Bugs
Both files define an identical
The current state is a silent footgun. Auth-required tests are missing for the new Every other Style / Conventions (CLAUDE.md)
Each deprecated # NOTE: still hits /portfolio/fills directly — the canonical
# implementation now lives on PortfolioResource (issue #351).The docstring and Multi-line docstrings on methods slated for removal The deprecated forwarders now carry verbose Sphinx-format docstrings. Per CLAUDE.md, docstrings that explain what ( Contract Drift TestsCursor exclusion for The diff adds: ("kalshi.resources.portfolio.PortfolioResource.fills_all", "cursor"): Exclusion(...)but no matching entry for Tests — What's Good
Summary
|
…precated forwarder noise
|
Round-2 review addressed in 0ff01cd: deduped _fills_params to kalshi/resources/_base.py; added 4 auth-required tests for new PortfolioResource fills variants; trimmed 6 redundant NOTE comments and collapsed forwarder docstrings to single-line. Deferred: missing async cursor exclusion note (consistent with rest of codebase, no async entries in METHOD_ENDPOINT_MAP). |
Code Review — PR #376: BREAKING(v3): relocate fills/fills_all to PortfolioResourceOverviewClean, well-scoped relocation. The motivation is sound — Issues1. Multi-paragraph docstrings violate CLAUDE.md style
|
Code Review — PR #376: Relocate
|
…ests
Post-v3.0.0 release surfaced 5 failing integration tests (release was
merged with bypassed status checks). All five are test maintenance,
not SDK bugs:
Coverage harness:
- Expected resource set now includes v3 sub-resources RFQsResource
and QuotesResource (21 classes, was 19).
- Register PortfolioResource.{fills, fills_all, positions_all} —
relocated from OrdersResource in #351/#376.
- Register MarketsResource.list_all_trades (canonical v3 name).
- Register FcmResource.positions_all (added in #344).
- Register RFQsResource + QuotesResource public methods.
Integration tests for v3 surfaces:
- tests/integration/test_communications.py: add TestRFQsV3Sync,
TestQuotesV3Sync, TestQuotesV3RealApiOnly — exercise the namespaced
client.communications.{rfqs,quotes}.* surface end-to-end on demo.
- tests/integration/test_portfolio.py: add fills/fills_all/positions_all
smoke tests on both sync and async.
- tests/integration/test_markets.py: add test_list_all_trades.
- tests/integration/test_fcm.py: add positions_all sync + async.
Demo-drift fixes in test_errors.py:
- test_malformed_params_returns_validation_error +
test_validation_error_details_attribute: demo now silently accepts
malformed cursors. Switched to status='not-a-real-status' which
reliably triggers 400 invalid_status_filter.
- test_bad_auth_returns_auth_error: KalshiConfig(base_url=...) now
rejects split REST/WS environments (defense-in-depth from #261).
Switched to KalshiConfig.demo().
Verification:
Unit: 2954 passed, 3 skipped
Integration: 233 passed, 38 skipped (was 218 passed / 5 failed)
Summary
fillsandfills_all(sync + async) now live onPortfolioResource/AsyncPortfolioResource, alongsidesettlements,deposits, andwithdrawals— the rest of the/portfolio/*family. The endpoint URL(
GET /portfolio/fills), response shape (Page[Fill]), and filters(
ticker,order_id,min_ts,max_ts,cursor,subaccount) areidentical to the previous location; only the access path changes.
OrdersResource.fills/OrdersResource.fills_all(and async counterparts)remain in v3.0.0 as
@typing_extensions.deprecatedthin forwarders thatdelegate to the same
/portfolio/fillsprimitive and emit aDeprecationWarningper call. They will be removed in a future release.Issues closed
OrdersResource.fills/fills_allhit/portfolio/fillsand belong onPortfolioResource.Migration (BREAKING in v3.0.0)
Before (v2.x):
After (v3.0.0):
The old call sites still compile and run in v3.0.0, but each call emits a
single
DeprecationWarningpointing at the new location.Behavioral changes
client.orders.fills(...)/client.orders.fills_all(...)now emitDeprecationWarning(one per call). Existing wire behavior is unchanged.client.portfolio.fills(...)/client.portfolio.fills_all(...)are newpublic methods with identical signatures and identical request shape.
Tests
tests/test_portfolio.py—TestPortfolioFills,TestPortfolioFillsAll,TestAsyncPortfolioFills,TestAsyncPortfolioFillsAllcover the newlocation (happy path, cursor/filter parity, sync + async iterator).
tests/test_orders.py::TestIssue351OrdersFillsDeprecated— asserts theold forwarders still resolve and emit exactly one
DeprecationWarningper call.
tests/test_async_orders.py::TestIssue351AsyncOrdersFillsDeprecated—same for the async forwarders.
TestOrdersFills/TestAsyncOrdersFillstest classes arepreserved unchanged; they still cover the forwarder's wire behavior and
produce informational
DeprecationWarnings in test output.Source
Round-3 independent audit closure plan, wave W4 (v3.0.0 breaking renames).