WebSocket Trading¶
Trading method parameter and result models for Kraken WebSocket API v2.
Classes:
-
OrderTrigger–Trigger configuration for conditional orders.
-
ConditionalClose–Conditional close order template attached to a parent order.
-
AddOrderParams–Parameters for the add_order trading method.
-
EditOrderParams–Parameters for the edit_order trading method.
-
CancelOrderParams–Parameters for the cancel_order trading method.
-
CancelAllParams–Parameters for the cancel_all trading method.
-
BatchAddParams–Parameters for the batch_add trading method.
-
AmendOrderParams–Parameters for the amend_order trading method.
-
BatchCancelParams–Parameters for the batch_cancel trading method.
-
CancelAllOrdersAfterParams–Parameters for the cancel_all_orders_after trading method.
-
AddOrderResult–Result from a successful add_order response.
-
EditOrderResult–Result from a successful edit_order response.
-
CancelOrderResult–Result from a successful cancel_order response.
-
CancelAllResult–Result from a successful cancel_all response.
-
BatchAddResult–Result from a successful batch_add response.
-
AmendOrderResult–Result from a successful amend_order response.
-
BatchCancelResult–Result from a successful batch_cancel response.
-
CancelAllOrdersAfterResult–Result from a successful cancel_all_orders_after response.
OrderTrigger
¶
Trigger configuration for conditional orders.
Attributes:
-
reference(str) –Trigger price reference ("index" or "last").
-
price(float) –Trigger price.
-
price_type(Unset | str) –Price interpretation ("static", "pct", "quote").
ConditionalClose
¶
Conditional close order template attached to a parent order.
Attributes:
-
order_type(str) –Order type for the close order.
-
limit_price(Unset | float) –Limit price for the close order.
-
trigger_price(Unset | float) –Trigger price for the close order.
AddOrderParams
¶
Parameters for the add_order trading method.
Attributes:
-
symbol(str) –Currency pair (e.g. "BTC/USD").
-
side(str) –Order side ("buy" or "sell").
-
order_type(str) –Order type (limit, market, etc.).
-
order_qty(float) –Order quantity.
-
token(str) –Authentication token.
-
limit_price(Unset | float) –Limit price (for limit orders).
-
limit_price_type(Unset | str) –Price interpretation ("static", "pct", "quote").
-
triggers(Unset | OrderTrigger) –Trigger configuration for conditional orders.
-
time_in_force(Unset | str) –Time-in-force ("gtc", "gtd", "ioc").
-
margin(Unset | bool) –Whether this is a margin order.
-
post_only(Unset | bool) –Whether to post-only.
-
reduce_only(Unset | bool) –Whether to reduce-only.
-
effective_time(Unset | str) –Scheduled start time (RFC3339).
-
expire_time(Unset | str) –Expiration time for GTD orders (RFC3339).
-
deadline(Unset | str) –Response deadline (RFC3339, 500ms-60s).
-
cl_ord_id(Unset | str) –Client order identifier string.
-
order_userref(Unset | int) –Client numeric reference.
-
conditional(Unset | ConditionalClose) –Conditional close order template.
-
display_qty(Unset | float) –Display quantity for iceberg orders.
-
fee_preference(Unset | str) –Fee currency preference ("base" or "quote").
-
stp_type(Unset | str) –Self-trade prevention type.
-
cash_order_qty(Unset | float) –Buy market order quantity in quote currency.
-
validate(Unset | bool) –Validation-only mode (no execution).
EditOrderParams
¶
Parameters for the edit_order trading method.
Edit is cancel-and-replace — a new order_id is returned.
Attributes:
-
order_id(str) –Order to edit.
-
symbol(str) –Currency pair.
-
token(str) –Authentication token.
-
order_qty(Unset | float) –New order quantity.
-
limit_price(Unset | float) –New limit price.
-
display_qty(Unset | float) –New display quantity (iceberg).
-
post_only(Unset | bool) –New post-only flag.
-
reduce_only(Unset | bool) –New reduce-only flag.
-
deadline(Unset | str) –Response deadline (RFC3339).
-
fee_preference(Unset | str) –Fee currency preference.
-
order_userref(Unset | int) –Client numeric reference.
-
validate(Unset | bool) –Validation-only mode.
-
triggers(Unset | OrderTrigger) –New trigger configuration.
CancelOrderParams
¶
Parameters for the cancel_order trading method.
At least one of order_id or cl_ord_id must be provided.
Attributes:
-
token(str) –Authentication token.
-
order_id(Unset | list[str]) –List of order IDs to cancel.
-
cl_ord_id(Unset | list[str]) –List of client order IDs to cancel.
CancelAllParams
¶
Parameters for the cancel_all trading method.
Attributes:
-
token(str) –Authentication token.
BatchAddParams
¶
Parameters for the batch_add trading method.
Attributes:
-
symbol(str) –Single currency pair for the entire batch.
-
token(str) –Authentication token.
-
orders(list[AddOrderParams]) –List of 2-15 order parameter objects.
-
deadline(Unset | str) –Response deadline (RFC3339).
-
validate(Unset | bool) –Validation-only mode.
AmendOrderParams
¶
Parameters for the amend_order trading method.
Amend modifies an order in-place — same order_id, preserves queue priority.
Attributes:
-
order_id(str) –Order to amend.
-
token(str) –Authentication token.
-
order_qty(Unset | float) –New order quantity.
-
limit_price(Unset | float) –New limit price.
-
display_qty(Unset | float) –New display quantity (iceberg).
-
post_only(Unset | bool) –New post-only flag.
-
reduce_only(Unset | bool) –New reduce-only flag.
-
deadline(Unset | str) –Response deadline (RFC3339).
-
trigger_price(Unset | float) –New trigger price.
-
trigger_price_type(Unset | str) –Price interpretation ("static", "pct", "quote").
BatchCancelParams
¶
Parameters for the batch_cancel trading method.
Attributes:
-
token(str) –Authentication token.
-
orders(list[str]) –List of order IDs to cancel.
-
cl_ord_id(Unset | list[str]) –List of client order IDs to cancel.
CancelAllOrdersAfterParams
¶
Parameters for the cancel_all_orders_after trading method.
Dead man's switch — auto-cancel all orders after timeout expires without being refreshed. Send timeout=0 to disable.
Attributes:
-
token(str) –Authentication token.
-
timeout(int) –Seconds until auto-cancel. 0 disables the timer.
AddOrderResult
¶
Result from a successful add_order response.
Attributes:
-
order_id(str) –Assigned order identifier.
-
cl_ord_id(Unset | str) –Client order ID if provided in request.
-
order_userref(Unset | int) –Client numeric reference if provided in request.
-
warnings(Unset | list[str]) –List of warning messages.
EditOrderResult
¶
Result from a successful edit_order response.
Edit is cancel-and-replace — a new order_id is assigned.
Attributes:
-
order_id(str) –New order identifier.
-
original_order_id(str) –Identifier of the replaced order.
-
warnings(Unset | list[str]) –List of warning messages.
CancelOrderResult
¶
Result from a successful cancel_order response.
Attributes:
-
order_id(str) –Cancelled order identifier.
-
cl_ord_id(Unset | str) –Client order ID if applicable.
-
warnings(Unset | list[str]) –List of warning messages.
CancelAllResult
¶
Result from a successful cancel_all response.
Attributes:
-
count(int) –Number of orders cancelled.
-
warnings(Unset | list[str]) –List of warning messages.
BatchAddResult
¶
Result from a successful batch_add response.
Attributes:
-
orders(list[AddOrderResult]) –List of individual order results.
AmendOrderResult
¶
Result from a successful amend_order response.
Amend preserves the original order_id and queue priority.
Attributes:
-
order_id(str) –The amended order identifier (unchanged).
-
amend_id(str) –Unique identifier for this amend operation.
-
warnings(Unset | list[str]) –List of warning messages.
BatchCancelResult
¶
Result from a successful batch_cancel response.
Attributes:
-
count(int) –Number of orders cancelled.
-
warnings(Unset | list[str]) –List of warning messages.
CancelAllOrdersAfterResult
¶
Result from a successful cancel_all_orders_after response.
Attributes:
-
current_time(str) –Server time when the request was processed (RFC3339).
-
trigger_time(str) –When orders will be cancelled if not refreshed (RFC3339).