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

# Cancel Spot Order

> Cancel a resting order on a spot market

**Function:**

```
{package}::dex_accounts_spot_entry::cancel_spot_order_to_subaccount
```

**ABI Object:**

```typescript theme={null}
const functionAbi: MoveFunction = {
  name: "cancel_spot_order_to_subaccount",
  visibility: "private",
  is_entry: true,
  is_view: false,
  generic_type_params: [],
  params: [
    "&signer",
    "0x1::object::Object<{package}::dex_accounts::Subaccount>",
    "0x1::object::Object<{package}::spot_market::SpotMarket>",
    "u128",
  ],
  return: [],
};
```

**Parameters:**

* `auth` - The account signer
* `subaccount` - The Trading Account object
* `market` - The SpotMarket object
* `order_id` - The spot order ID to cancel `` `<u128>` ``

<Info>
  Spot has no client-assigned order IDs, so cancellation is by `order_id` only. There is no spot equivalent of `cancel_client_order`.
</Info>

Canceling releases the order's escrowed funds — quote for a bid, base for an ask — back to the account it was funded from.

To cancel an order placed directly from a wallet, use `cancel_spot_order`, which takes the same arguments without the `subaccount` parameter.

**Example:**

<CodeGroup>
  ```typescript Typescript theme={null}
  const transaction = await aptos.transaction.build.simple({
    sender: account.accountAddress,
    data: {
      function: `${PACKAGE}::dex_accounts_spot_entry::cancel_spot_order_to_subaccount`,
      typeArguments: [],
      functionArguments: [
        "0x123...abc", // subaccountAddr
        "0x456...def", // marketAddr (SpotMarket object address)
        "12345678901234567890", // orderId (u128 as string)
      ],
    },
  });
  ```

  ```python Python theme={null}
  transaction = rest_client.build_transaction(
      sender=account.address(),
      payload={
          "function": f"{PACKAGE}::dex_accounts_spot_entry::cancel_spot_order_to_subaccount",
          "type_arguments": [],
          "function_arguments": [
              "0x123...abc",  # subaccountAddr
              "0x456...def",  # marketAddr (SpotMarket object address)
              "12345678901234567890",  # orderId (u128 as string)
          ],
      },
  )
  ```
</CodeGroup>
