Skip to main content
Function:
{package}::dex_accounts_entry::place_tp_sl_order_for_position
ABI Object:
const functionAbi: MoveFunction = {
  name: "place_tp_sl_order_for_position",
  visibility: "private",
  is_entry: true,
  is_view: false,
  generic_type_params: [],
  params: [
    "&signer",
    "0x1::object::Object<{package}::dex_accounts::Subaccount>",
    "0x1::object::Object<{package}::perp_market::PerpMarket>",
    "0x1::option::Option<u64>",
    "0x1::option::Option<u64>",
    "0x1::option::Option<u64>",
    "0x1::option::Option<u64>",
    "0x1::option::Option<u64>",
    "0x1::option::Option<u64>",
    "0x1::option::Option<address>",
    "0x1::option::Option<u64>",
  ],
  return: [],
};
Parameters:
  • signer - The account signer
  • subaccount - The Trading Account object
  • market - The PerpMarket object
  • tp_trigger_price - Optional take-profit trigger price `<Option<u64>>`
  • tp_limit_price - Optional take-profit limit price `<Option<u64>>`
  • tp_size - Optional take-profit size `<Option<u64>>`
  • sl_trigger_price - Optional stop-loss trigger price `<Option<u64>>`
  • sl_limit_price - Optional stop-loss limit price `<Option<u64>>`
  • sl_size - Optional stop-loss size `<Option<u64>>`
  • builder_address - Optional builder address `<Option<address>>`
  • builder_fees - Optional builder fee `<Option<u64>>`
Example:
const transaction = await aptos.transaction.build.simple({
  sender: account.accountAddress,
  data: {
    function: `${PACKAGE}::dex_accounts_entry::place_tp_sl_order_for_position`,
    typeArguments: [],
    functionArguments: [
      "0x123...abc", // subaccountAddr
      "0x456...def", // marketAddr (PerpMarket object address)
      6000000000, // tpTriggerPrice (optional, 6.0 with 9 decimals)
      6050000000, // tpLimitPrice (optional, 6.05 with 9 decimals)
      500000000, // tpSize (optional, 0.5 with 9 decimals)
      5500000000, // slTriggerPrice (optional, 5.5 with 9 decimals)
      5450000000, // slLimitPrice (optional, 5.45 with 9 decimals)
      500000000, // slSize (optional, 0.5 with 9 decimals)
      null, // builderAddress (optional)
      null, // builderFees (optional)
    ],
  },
});