> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gtfo.vc/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel orders

> Cancel open limit orders (CANCEL) through the Controller.execute batching API.

All trading actions are batched via `Controller.execute`. For each item in `actionList` you provide an **ABI‑encoded** params struct in `paramsDataList`.

## CANCEL (full or partial)

The CANCEL action allows you to cancel an open limit order, either fully or partially.

`leftQuoteAmount` is the remaining quote you want **after** cancellation (0 for full cancellation).

### CancelOrderParams struct

```
CancelOrderParams(
  id: uint256,
  leftQuoteAmount: uint256
)
```

### Example

```ts theme={null}
const cancelTypes = [
  { name: 'id', type: 'uint256' },
  { name: 'leftQuoteAmount', type: 'uint256' },
] as const;

const cancelData = encodeAbiParameters(cancelTypes, [orderId, 0n]);
await writeExecute([Action.CANCEL], [cancelData]);
```

### Parameters

* **id**: The order ID
* **leftQuoteAmount**: The amount of quote tokens you want to remain in the order after cancellation
  * Set to `0` for full cancellation
  * Set to a positive value for partial cancellation (the difference will be returned to your vault)

### Partial cancellation example

```ts theme={null}
// If you have an order with 1000 quote tokens and want to cancel 400 tokens:
const cancelData = encodeAbiParameters(cancelTypes, [orderId, 600n]); // Leave 600 tokens
await writeExecute([Action.CANCEL], [cancelData]);
```
