Skip to content

Add transfer_position() for POST /portfolio/subaccounts/positions/transfer (spec 3.23.0) #464

Description

@TexasCoding

Summary

OpenAPI 3.23.0 added a brand-new endpoint the SDK does not yet expose:

  • Path: POST /portfolio/subaccounts/positions/transfer
  • operationId: ApplySubaccountPositionTransfer
  • New schemas: ApplySubaccountPositionTransferRequest (required: client_transfer_id, from_subaccount, to_subaccount, market_ticker, side, count, price_cents) and ApplySubaccountPositionTransferResponse (position_transfer_id).

This is a genuine new capability — moving an open position between subaccounts, distinct from the existing cash-only transfer() (POST /portfolio/subaccounts/transfer). The generated models already picked the schemas up (kalshi/_generated/models.py), but there is no facade method.

The contract drift suite does not flag this — it has no spec-path completeness gate, so a spec path with no SDK method is invisible.

Scope

  • Add ApplySubaccountPositionTransferRequest / ApplySubaccountPositionTransferResponse models to kalshi/models/subaccounts.py.
  • Add transfer_position(...) to SubaccountsResource + AsyncSubaccountsResource (kalshi/resources/subaccounts.py), building the request model internally and serializing via model_dump(exclude_none=True, by_alias=True, mode="json").
  • Register in METHOD_ENDPOINT_MAP (with request_body_schema) and BODY_MODEL_MAP; add response contract-map entries where applicable.
  • Export the new models; add tests (happy/error/edge).

Provenance

Surfaced during the #463 spec-drift reconciliation (3.22.0 → 3.23.0) as an out-of-scope new capability. #463 covered only the 18 drift-test failures + defensive optional-ization of removed/relaxed fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestspec-driftUpstream OpenAPI/AsyncAPI spec changed since last sync

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions