> ## 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.

# Update SL Order for Position

> Update an existing stop-loss order for a position

**Function:**

```
{package}::dex_accounts_entry::update_sl_order_for_position
```

**ABI Object:**

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

**Parameters:**

* `signer` - The account signer
* `subaccount` - The Trading Account object
* `order_id` - The SL order ID to update (u128)
* `market` - The PerpMarket object
* `sl_trigger_price` - Optional new stop-loss trigger price `` `<Option<u64>>` ``
* `sl_limit_price` - Optional new stop-loss limit price `` `<Option<u64>>` ``
* `sl_size` - Optional new stop-loss size `` `<Option<u64>>` ``

**Example:**

<CodeGroup>
  ```typescript Typescript theme={null}
  const transaction = await aptos.transaction.build.simple({
    sender: account.accountAddress,
    data: {
      function: `${PACKAGE}::dex_accounts_entry::update_sl_order_for_position`,
      typeArguments: [],
      functionArguments: [
        "0x123...abc", // subaccountAddr
        12345678901234567890, // orderId (u128)
        "0x456...def", // marketAddr (PerpMarket object address)
        5400000000, // slTriggerPrice (optional, 5.4 with 9 decimals)
        5350000000, // slLimitPrice (optional, 5.35 with 9 decimals)
        750000000, // slSize (optional, 0.75 with 9 decimals)
      ],
    },
  });
  ```

  ```python Python theme={null}
  transaction = rest_client.build_transaction(
      sender=account.address(),
      payload={
          "function": f"{PACKAGE}::dex_accounts_entry::update_sl_order_for_position",
          "type_arguments": [],
          "function_arguments": [
              "0x123...abc",  # subaccountAddr
              12345678901234567890,  # orderId (u128)
              "0x456...def",  # marketAddr (PerpMarket object address)
              5400000000,  # slTriggerPrice (optional, 5.4 with 9 decimals)
              5350000000,  # slLimitPrice (optional, 5.35 with 9 decimals)
              750000000,  # slSize (optional, 0.75 with 9 decimals)
          ],
      },
  )
  ```
</CodeGroup>
