# execute-batched-orders (/docs/tx/execute-batched-orders)

| Signer    | Origin                                 | Pallet      | Wraps                                                                                   |
| --------- | -------------------------------------- | ----------- | --------------------------------------------------------------------------------------- |
| `coldkey` | signed account (pallet role may apply) | LimitOrders | [`LimitOrders.execute_batched_orders`](/code/pallets/limit-orders/src/lib.rs#L666-L681) |

## Parameters [#parameters]

| Parameter     | Type    | Required | Description                                             |
| ------------- | ------- | -------- | ------------------------------------------------------- |
| `orders`      | array   | yes      | Complete SignedOrder objects.                           |
| `should_fail` | boolean | no       | Revert the batch if any order fails.                    |
| `netuid`      | integer | no       | Subnet shared by all orders in the atomic netted batch. |

Address parameters (`--hotkey`, `--coldkey`, `--dest`, ...) accept a raw ss58
address, an address-book or proxy-book name, or a local wallet/hotkey name.

## CLI [#cli]

Preview with `--dry-run` (shows fee, effects, and policy result without
submitting), then submit:

```bash
btcli tx execute-batched-orders \
  --orders <a,b,c> --dry-run
btcli tx execute-batched-orders \
  --orders <a,b,c> -w my_coldkey
```

## Python [#python]

```python
import bittensor as bt
from bittensor.wallet import Wallet

wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.ExecuteBatchedOrders(orders=[...])

sub = bt.Subtensor()
plan = sub.plan(intent, wallet)   # fee, effects, policy — no submission
result = sub.execute(intent, wallet)
if not result.success:
    print(result.error.code, result.error.remediation)
```

(`bt.Subtensor` is also the async client — `async with bt.Subtensor() as client:`
— see [The client](/docs/concepts/client).) Or build the intent by op name, as
an agent would:

```python
result = sub.execute_tool("execute_batched_orders", {...}, wallet)
```

## On-chain implementation [#on-chain-implementation]

`LimitOrders.execute_batched_orders` — [`pallets/limit-orders/src/lib.rs#L668`](/code/pallets/limit-orders/src/lib.rs#L666-L681):

```rust
#[pallet::call_index(1)]
#[pallet::weight(Pallet::<T>::execute_batched_orders_weight(orders))]
pub fn execute_batched_orders(
    origin: OriginFor<T>,
    netuid: NetUid,
    orders: BoundedVec<SignedOrder<T::AccountId>, T::MaxOrdersPerBatch>,
) -> DispatchResult {
    let relayer = ensure_signed(origin)?;
    ensure!(
        LimitOrdersEnabled::<T>::get(),
        Error::<T>::LimitOrdersDisabled
    );

    Self::check_authorized_batch_bound(&orders)?;
    Self::do_execute_batched_orders(netuid, orders, relayer)
}
```

Delegates to [`check_authorized_batch_bound`](/code/pallets/limit-orders/src/authorization.rs#L153).

Every file is browsable under [/code](/code) exactly as built into the runtime, or as plain text under `/code/raw/<path>` (index: [`/code/index.json`](/code/index.json)).
