Modify and Cancel Orders

Modify Order

Signature

pub async fn modify_order(&self, id: i64, order: OrderRequest) -> Result<Option<OrderIdResult>, TigerError>

Description

Modify a submitted order. Only pending/partially-filled orders can be modified.

Parameters

ParameterTypeRequiredDescription
idi64YesGlobal order ID
orderOrderRequestYesFields to modify (unchanged fields left as None)

Common modification fields: total_quantity, limit_price, aux_price, order_type, time_in_force, outside_rth, trailing_percent.

Response

FieldTypeDescription
idi64Order ID

Example

let mut modify = OrderRequest::default();
modify.limit_price = Some(196.0);
let result = trade.modify_order(31234567, modify).await?;
if let Some(r) = result {
    println!("Modified order id={}", r.id);
}

Response Example

{
  "id": 31234567
}

Cancel Order

Signature

pub async fn cancel_order(&self, id: i64) -> Result<Option<OrderIdResult>, TigerError>

Description

Cancel a pending order.

Parameters

ParameterTypeRequiredDescription
idi64YesGlobal order ID

Response

FieldTypeDescription
idi64Cancelled order ID

Example

let result = trade.cancel_order(31234567).await?;
if let Some(r) = result {
    println!("Cancelled order id={}", r.id);
}

Response Example

{
  "id": 31234567
}

Did this page help you?