Post
Share your knowledge.
AMM Bot in Sui Ecosystem
What are the key features and functionalities of AMM bots within the Sui ecosystem? How do they improve upon traditional trading mechanisms, and what advantages do they offer to users engaging with DeFi protocols on the Sui network?
Do I need to build one or I can use Turbos Finance for example
- Sui
Answers
2If you're looking for a quick and efficient way to engage with AMM functionalities in the Sui ecosystem, you don't necessarily need to build your own bot. Platforms like Turbos Finance already offer advanced AMM features, including automated trading and liquidity provision, which are designed to enhance user experience. Leveraging existing solutions like Turbos Finance allows you to take advantage of optimized and tested tools without the complexity of development.
But my most favorite is this one https://github.com/OmniBTC/Sui-AMM-swap
cmd for tests
$ issue XBTC and USDT test coins
XBTC="0x985c26f5edba256380648d4ad84b202094a4ade3::coins::XBTC"
USDT="0x985c26f5edba256380648d4ad84b202094a4ade3::coins::USDT"
SUI="0x2::sui::SUI"
$ sui client publish --gas-budget 10000
package=0xc6f8ce30d96bb9b728e000be94e25cab1a6011d1
global=0x28ae932ee07d4a0881e4bd24f630fe7b0d18a332
$ sui client objects
sui_coin=0x525c0eb0e1f4d8744ae21984de2e8a089366a557
usdt_coin=0x8e81c2362ff1e7101b2ef2a0d1ff9b3c358a1ac9
$ sui client call --gas-budget 10000 \
--package=$package \
--module=interface \
--function=add_liquidity \
--args $global $sui_coin 1 $usdt_coin 1 \
--type-args $SUI $USDT
lp_sui_usdt=0xdf622fddc8447b0c1d15f8418e010933dd5f0a6c
pool_sui_usdt=0x5058b90e728df97c4cb5cade5e5c77fcb662a4b9
$ sui client split-coin --gas-budget 10000 \
--coin-id $lp_sui_usdt \
--amounts 100000
lp_sui_usdt2=0x6cde2fe9277c92e196585fb12c6e3d5aaa4eab34
$ sui client call --gas-budget 10000 \
--package=$package \
--module=interface \
--function=remove_liquidity \
--args $global $lp_sui_usdt2 \
--type-args $SUI $USDT
new_usdt_coin=0xc090e45f9461e39abb0452cf3ec297a40efbfdc3
new_sui_coin=0x9c8c1cc38cc61a94264911933c69a772ced07a09
# sui -> usdt
$ sui client call --gas-budget 10000 \
--package=$package \
--module=interface \
--function=swap \
--args $global $new_sui_coin 1 \
--type-args $SUI $USDT
out_usdt_coin=0x80076d95c8bd1d5a0f97b537669008a1a369ce12
# usdt -> sui
sui client call --gas-budget 10000 \
--package=$package \
--module=interface \
--function=swap \
--args $global $out_usdt_coin 1 \
--type-args $USDT $SUI
out_sui_coin=0xaa89836115e1e1a4f5fa990ebd2c7be3a5124d07
$ sui client call --gas-budget 10000 \
--package=$package \
--module=interface \
--function=add_liquidity \
--args $global $out_sui_coin 100 $new_usdt_coin 1000 \
--type-args $SUI $USDT
Hey Vens, if you’re looking to plug into Sui-native modules like DeepBook. Turbos and similar AMMs already provide the smart contract infrastructure and frontend interfaces, meaning you can spin up a bot (e.g., in Rust or TypeScript using the Sui SDK) to do things like auto-swap, run arbitrage, or manage LP positions. However, if you want more control, building directly with DeepBook because Sui’s native liquidity layer that lets you build a DEX with order book logic, fee customization, and custody control.
For example, you can: • Create a shared pool object with create_pool, specifying tick_size, lot_size, and fee tiers. • Set up custodial accounts via create_account to manage asset balances with high Like Create a Pool on DeepBook
sui client call \ --package <DEEPBOOK_PACKAGE_ID> \ --module deepbook \ --function create_pool \ --type-args 0x2::sui::SUI 0x2::usdc::USDC \ --args 1000000 1000000 <CREATION_FEE_OBJECT> \ --gas-budget 10000000
Before placing limit orders, your bot needs to set up a custodian account:
sui client call \
--package <DEEPBOOK_PACKAGE_ID> \
--module deepbook \
--function create_account \
--gas-budget 5000000
Deposit SUI (base asset):
sui client call \
--package <DEEPBOOK_PACKAGE_ID> \
--module deepbook \
--function deposit_base \
--type-args 0x2::sui::SUI 0x2::usdc::USDC \
--args <POOL_ID> <SUI_COIN_OBJECT> <ACCOUNT_CAP_ID> \
--gas-budget 3000000
Deposit USDC (quote asset):
sui client call \
--package <DEEPBOOK_PACKAGE_ID> \
--module deepbook \
--function deposit_quote \
--type-args 0x2::sui::SUI 0x2::usdc::USDC \
--args <POOL_ID> <USDC_COIN_OBJECT> <ACCOUNT_CAP_ID> \
--gas-budget 3000000
Place a Limit Order
sui client call \
--package <DEEPBOOK_PACKAGE_ID> \
--module deepbook \
--function place_limit_order \
--type-args 0x2::sui::SUI 0x2::usdc::USDC \
--args <POOL_ID> <CLIENT_ORDER_ID> <PRICE> <QUANTITY> 0 true <EXPIRE_TS> 0 <CLOCK_ID> <ACCOUNT_CAP_ID> \
--gas-budget 5000000
Place a Market Order
sui client call \
--package <DEEPBOOK_PACKAGE_ID> \
--module deepbook \
--function place_market_order \
--type-args 0x2::sui::SUI 0x2::usdc::USDC \
--args <POOL_ID> <ACCOUNT_CAP_ID> <CLIENT_ORDER_ID> <QUANTITY> true <BASE_COIN_ID> <QUOTE_COIN_ID> <CLOCK_ID> \
--gas-budget 5000000
Swap Between Base and Quote
sui client call \
--package <DEEPBOOK_PACKAGE_ID> \
--module deepbook \
--function swap_exact_base_for_quote \
--type-args 0x2::sui::SUI 0x2::usdc::USDC \
--args <POOL_ID> <CLIENT_ORDER_ID> <ACCOUNT_CAP_ID> <QUANTITY> <SUI_COIN_OBJECT> <USDC_COIN_OBJECT> <CLOCK_ID> \
--gas-budget 5000000
Otherwise
sui client call \
--package <DEEPBOOK_PACKAGE_ID> \
--module deepbook \
--function swap_exact_quote_for_base \
--type-args 0x2::sui::SUI 0x2::usdc::USDC \
--args <POOL_ID> <CLIENT_ORDER_ID> <ACCOUNT_CAP_ID> <QUANTITY> <CLOCK_ID> <USDC_COIN_OBJECT> \
--gas-budget 5000000
Do you know the answer?
Please log in and share it.
Sui is a Layer 1 protocol blockchain designed as the first internet-scale programmable blockchain platform.

- MiniBob... SUI+31
1
- HaGiang... SUI+26
2
- harry phan... SUI+21
3
- ... SUIMarlKey+20
- ... SUI
- ... SUI0xduckmove+15
- ... SUIVens.sui+15
- ... SUICarlkawIy+12
- ... SUI
- ... SUIkryptoschain+10