Skip to content

Stop sending order type to Kalshi API#9

Merged
arshka merged 3 commits intomainfrom
dev/remove-order-type
Mar 11, 2026
Merged

Stop sending order type to Kalshi API#9
arshka merged 3 commits intomainfrom
dev/remove-order-type

Conversation

@Agnimandur
Copy link
Collaborator

Summary

  • Kalshi deprecated the order_type/"type" field — only limit orders are supported, so specifying "type": "limit" is redundant and should not be sent
  • Removes "type": "limit" from order payloads in _build_order_data
  • Strips "type" from user-provided batch order dicts in _build_batch_orders (backward-compatible — users can still pass it, it just gets dropped)
  • Removes OrderType from README examples and cleans up docstrings

Test plan

  • All 309 unit tests pass
  • Verify integration tests pass against demo API

🤖 Generated with Claude Code

Agnimandur and others added 3 commits March 11, 2026 04:44
Kalshi deprecated the order_type field — only limit orders are supported,
so specifying "type" is redundant and should not be sent. This change:
- Removes "type": "limit" from order payloads in _build_order_data
- Strips "type" from batch order dicts in _build_batch_orders (backward-compat)
- Removes OrderType from README examples
- Updates docstrings and tests accordingly

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Kalshi API no longer accepts the "type" field, and the client-side
market order simulation (hardcoded $0.99/$0.01) was misleading. Instead
of quietly dropping documentation, properly deprecate order_type with a
DeprecationWarning following the existing compat layer pattern.

- Move order_type to keyword-only with DeprecationWarning when used
- Remove market order simulation from _build_order_data
- Update examples to remove OrderType usage
- Add deprecation test in test_compat.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pre-1.0 library — no need for a deprecation cycle. Kalshi removed
the "type" field from CreateOrder in Feb 2026. Verified against the
live API: the field is silently ignored. The OrderType enum and
Order.type property are kept since the API still returns "type" in
order responses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@arshka arshka merged commit cbbc9cd into main Mar 11, 2026
5 of 6 checks passed
@arshka arshka deleted the dev/remove-order-type branch March 11, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants