OrderOperations
OrderOperations¶
Info
Access via client.order property.
High-level order management operations.
Initialize order operations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subaccount
|
Subaccount
|
Subaccount instance providing access to auth, config, and APIs |
required |
Functions¶
cancel
¶
cancel(
*, instrument_name: str, order_id: str
) -> PrivateCancelResultSchema
Cancel a single order.
cancel_by_instrument
¶
cancel_by_instrument(
*, instrument_name: str
) -> PrivateCancelByInstrumentResultSchema
Cancel all orders for this instrument.
cancel_by_label
¶
cancel_by_label(
*, label: str, instrument_name: Optional[str] = None
) -> PrivateCancelByLabelResultSchema
Cancel all open orders for a given subaccount and a given label.
If instrument_name is provided, only orders for that instrument will be cancelled.
cancel_by_nonce
¶
cancel_by_nonce(
*, instrument_name: str, nonce: int
) -> PrivateCancelByNonceResultSchema
Cancel a single order by nonce. Uses up that nonce if the order does not exist, so any future orders with that nonce will fail.
create
¶
create(
*,
amount: Decimal,
direction: Direction,
instrument_name: str,
limit_price: Decimal,
max_fee: Decimal = Decimal("1000"),
nonce: Optional[int] = None,
signature_expiry_sec: Optional[int] = None,
extra_fee: Decimal = Decimal("0.000001"),
is_atomic_signing: Optional[bool] = False,
label: str = "",
mmp: bool = False,
order_type: OrderType = limit,
reduce_only: bool = False,
reject_timestamp: int = INT64_MAX,
time_in_force: TimeInForce = gtc,
trigger_price: Optional[Decimal] = None,
trigger_price_type: Optional[TriggerPriceType] = None,
trigger_type: Optional[TriggerType] = None
) -> OrderResponseSchema
Create a new order.
Amount and limit_price are automatically quantized to match instrument specifications.
list
¶
list(
*,
instrument_name: Optional[str] = None,
label: Optional[str] = None,
page: int = 1,
page_size: int = 100,
status: Optional[OrderStatus] = None
) -> List[OrderResponseSchema]
Get orders for a subaccount, with optional filtering.
replace
¶
replace(
*,
amount: Decimal,
direction: Direction,
instrument_name: str,
limit_price: Decimal,
max_fee: Decimal = Decimal("1000"),
nonce: Optional[int] = None,
signature_expiry_sec: Optional[int] = None,
expected_filled_amount: Optional[Decimal] = None,
extra_fee: Decimal = Decimal("0.000001"),
is_atomic_signing: Optional[bool] = False,
label: str = "",
mmp: bool = False,
nonce_to_cancel: Optional[int] = None,
order_id_to_cancel: Optional[str] = None,
order_type: OrderType = limit,
reduce_only: bool = False,
reject_timestamp: int = INT64_MAX,
time_in_force: TimeInForce = gtc,
trigger_price: Optional[Decimal] = None,
trigger_price_type: Optional[TriggerPriceType] = None,
trigger_type: Optional[TriggerType] = None
) -> PrivateReplaceResultSchema
Cancel an existing order with nonce or order_id and create new order with different order_id in a single RPC call.
If the cancel fails, the new order will not be created.
If the cancel succeeds but the new order fails, the old order will still be cancelled.
Amount and limit_price are automatically quantized to match instrument specifications.