> ## 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 Bulk Order

> Cancel a full spot ladder or a single price level

Two entry functions are available: cancel the entire resting ladder, or remove a single price level and leave the rest in place.

## Cancel the Full Ladder

**Function:**

```
{package}::dex_accounts_spot_entry::cancel_spot_bulk_order_to_subaccount
```

**ABI Object:**

```typescript theme={null}
const functionAbi: MoveFunction = {
  name: "cancel_spot_bulk_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>",
  ],
  return: [],
};
```

**Parameters:**

* `auth` - The account signer
* `subaccount` - The Trading Account object
* `market` - The SpotMarket object

## Cancel a Single Price Level

**Function:**

```
{package}::dex_accounts_spot_entry::cancel_spot_bulk_order_at_price_level_to_subaccount
```

**ABI Object:**

```typescript theme={null}
const functionAbi: MoveFunction = {
  name: "cancel_spot_bulk_order_at_price_level_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>",
    "u64",
    "bool",
  ],
  return: [],
};
```

**Parameters:**

* `auth` - The account signer
* `subaccount` - The Trading Account object
* `market` - The SpotMarket object
* `price` - The price level to cancel, in raw quote units `` `<u64>` ``
* `is_bid` - True to cancel the bid at that price, false for the ask

For wallet-direct ladders, use `cancel_spot_bulk_order` and `cancel_spot_bulk_order_at_price_level`, which take the same arguments without the `subaccount` parameter.

**Example:**

<CodeGroup>
  ```typescript Typescript theme={null}
  // Cancel the entire ladder
  const cancelAll = await aptos.transaction.build.simple({
    sender: account.accountAddress,
    data: {
      function: `${PACKAGE}::dex_accounts_spot_entry::cancel_spot_bulk_order_to_subaccount`,
      typeArguments: [],
      functionArguments: [
        "0x123...abc", // subaccountAddr
        "0x456...def", // marketAddr (SpotMarket object address)
      ],
    },
  });

  // Cancel only the ask resting at one price level
  const cancelLevel = await aptos.transaction.build.simple({
    sender: account.accountAddress,
    data: {
      function: `${PACKAGE}::dex_accounts_spot_entry::cancel_spot_bulk_order_at_price_level_to_subaccount`,
      typeArguments: [],
      functionArguments: [
        "0x123...abc", // subaccountAddr
        "0x456...def", // marketAddr (SpotMarket object address)
        45100000, // price (raw quote units)
        false, // isBid (false cancels the ask at that price)
      ],
    },
  });
  ```

  ```python Python theme={null}
  # Cancel the entire ladder
  cancel_all = rest_client.build_transaction(
      sender=account.address(),
      payload={
          "function": f"{PACKAGE}::dex_accounts_spot_entry::cancel_spot_bulk_order_to_subaccount",
          "type_arguments": [],
          "function_arguments": [
              "0x123...abc",  # subaccountAddr
              "0x456...def",  # marketAddr (SpotMarket object address)
          ],
      },
  )

  # Cancel only the ask resting at one price level
  cancel_level = rest_client.build_transaction(
      sender=account.address(),
      payload={
          "function": f"{PACKAGE}::dex_accounts_spot_entry::cancel_spot_bulk_order_at_price_level_to_subaccount",
          "type_arguments": [],
          "function_arguments": [
              "0x123...abc",  # subaccountAddr
              "0x456...def",  # marketAddr (SpotMarket object address)
              45100000,  # price (raw quote units)
              False,  # isBid (false cancels the ask at that price)
          ],
      },
  )
  ```
</CodeGroup>
