Skip to main content
The Bulk Order API allows a client to submit and manage multiple limit orders (both bids and asks) in a single atomic transaction. Eac account can have at most one Bulk Order per market. This API cancels all existing resting liquidity for the market provided and replaces it with the new bulk set of orders (bids and asks). Partial failures (e.g., an order that cannot be posted due to a PostOnly violation) do not revert the transaction — that particular order will simply be skipped or partially placed. Cancelled price levels and sizes will be returned explicitly in the update event. ** NOTE **
  • Bulk Order Placements with a non-increasing sequence_number will be rejected.
  • Order updates that reduce size will maintain its position in the matching queue, order updates that increase size will be moved to the end of the matching queue.
Function:
{package}::dex_accounts_entry::place_bulk_orders_to_subaccount
ABI Object:
const functionAbi: MoveFunction = {
  name: "place_bulk_orders_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}::perp_market::PerpMarket>",
    "u64",
    "vector<u64>",
    "vector<u64>",
    "vector<u64>",
    "vector<u64>",
    "0x1::option::Option<address>",
    "0x1::option::Option<u64>",
  ],
  return: [],
};
Parameters:
  • signer - The account signer
  • subaccount - The Trading Account object
  • market - The PerpMarket object
  • sequence_number - The monotonically increasing number associated with this order
  • bid_prices - `vector<u64>` - Array of bid prices in chain units
  • bid_sizes - `vector<u64>` - Array of bid sizes in chain units
  • ask_prices - `vector<u64>` - Array of ask prices in chain units
  • ask_sizes - `vector<u64>` - Array of ask sizes in chain units
  • builder_address - Optional builder address `<Option<address>>`
  • builder_fees - Optional builder fee `<Option<u64>>`

Time in Force

Bulk Orders are Post-Only limit orders. Example:
const transaction = await aptos.transaction.build.simple({
  sender: account.accountAddress,
  data: {
    function: `${PACKAGE}::dex_accounts_entry::place_bulk_orders_to_subaccount`,
    typeArguments: [],
    functionArguments: [
      "0x123...abc", // subaccountAddr
      "0x456...def", // marketAddr (PerpMarket object address)
      1, // sequenceNumber (must be monotonically increasing)
      [5670000000, 5680000000, 5690000000], // bidPrices (in chain units)
      [1000000000, 2000000000, 3000000000], // bidSizes (in chain units)
      [5710000000, 5720000000, 5730000000], // askPrices (in chain units)
      [1000000000, 2000000000, 3000000000], // askSizes (in chain units)
      null, // builderAddress (optional)
      null, // builderFees (optional)
    ],
  },
});