> ## 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 TP Order for Position

> Update an existing take-profit order for a position

**Function:**

```
{package}::dex_accounts_entry::update_tp_order_for_position
```

**ABI Object:**

```typescript theme={null}
const functionAbi: MoveFunction = {
  name: "update_tp_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 TP order ID to update (u128)
* `market` - The PerpMarket object
* `tp_trigger_price` - Optional new take-profit trigger price `` `<Option<u64>>` ``
* `tp_limit_price` - Optional new take-profit limit price `` `<Option<u64>>` ``
* `tp_size` - Optional new take-profit 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_tp_order_for_position`,
      typeArguments: [],
      functionArguments: [
        "0x123...abc", // subaccountAddr
        12345678901234567890, // orderId (u128)
        "0x456...def", // marketAddr (PerpMarket object address)
        6100000000, // tpTriggerPrice (optional, 6.1 with 9 decimals)
        6150000000, // tpLimitPrice (optional, 6.15 with 9 decimals)
        750000000, // tpSize (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_tp_order_for_position",
          "type_arguments": [],
          "function_arguments": [
              "0x123...abc",  # subaccountAddr
              12345678901234567890,  # orderId (u128)
              "0x456...def",  # marketAddr (PerpMarket object address)
              6100000000,  # tpTriggerPrice (optional, 6.1 with 9 decimals)
              6150000000,  # tpLimitPrice (optional, 6.15 with 9 decimals)
              750000000,  # tpSize (optional, 0.75 with 9 decimals)
          ],
      },
  )
  ```
</CodeGroup>
