How-to
This guide provides practical examples for interacting with Neutron's DEX module through the web interface and command-line tools.
User Interfaces
Neutron App (Web Interface)
The primary web interface is available at app.neutron.org
Orderbook Interface
Access the orderbook at app.neutron.org/orderbook
Features:
- Live Price Chart: The charting technology is provided by TradingView, a platform for traders and investors. It offers advanced charting tools so that you can plan your trade with the context of your own saved notes and measurements, and other features such as major upcoming events in the TradingView economic calendar
- Order Book Table: Real-time liquidity depth and price levels
- Recent Trades: Live trade feed with transaction links
- Order Form: Interface for placing limit and market orders
- Order History: Track your active and completed orders
Token Pair Navigation:
- Use the pair selector to choose from available trading pairs
- View pair summary with recent activity metrics
- Access price history and volume data
Order Form Usage:
- Limit Orders: Specify exact price and expiration (optional)
- Market Orders: Execute immediately with slippage protection
- Order Types: Choose from GTC, GTT, FOK, IOC based on your strategy
- Simulation: Preview trade outcomes before execution
Order Management:
- Active Orders: Monitor open positions in the Trades tab
- Order History: Review completed trades
- Withdraw/Cancel: Manage filled or active orders
Bridge Interface
Access the bridge at app.neutron.org/bridge
- Transfer tokens from other chains to Neutron
- View current token balances on Neutron
- Withdraw tokens back to origin chains
- Support for major IBC-enabled chains
CLI Interface
All DEX functionality is available through the neutrond command-line interface using positional arguments.
Adding Liquidity
Basic Single-Tick Deposit
neutrond tx dex deposit \
alice \
untrn \
ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2 \
1000000 \
1000000 \
0 \
3000 \
false \
false \
--from mykey \
--chain-id neutron-1
Arguments:
receiver- Address to receive the liquidity positiontoken-a- First token denominationtoken-b- Second token denominationamounts-a- Comma-separated amounts of token A (e.g., "1000000,500000")amounts-b- Comma-separated amounts of token B (e.g., "1000000,500000")tick-indexes- Comma-separated tick indexes (e.g., "0,-100,100")fees- Comma-separated fee tiers (e.g., "3000,3000,3000")disable-autoswap- Comma-separated boolean values (e.g., "false,false,false")fail-tx-on-bel- Comma-separated boolean values (e.g., "false,false,false")
Multi-Tick Liquidity Strategy
neutrond tx dex deposit \
alice \
untrn \
ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2 \
1000000,1000000,1000000 \
1000000,1000000,1000000 \
[-100,0,100] \
3000,3000,3000 \
false,false,false \
false,false,false \
--from mykey \
--chain-id neutron-1
Removing Liquidity
Basic Withdrawal
neutrond tx dex withdrawal \
alice \
untrn \
ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2 \
500000 \
0 \
3000 \
--from mykey \
--chain-id neutron-1
Arguments:
receiver- Address to receive withdrawn tokenstoken-a- First token denominationtoken-b- Second token denominationshares-to-remove- Comma-separated share amounts to removetick-indexes-a-to-b- Comma-separated tick indexesfees- Comma-separated fee tiers
Trading
Multi-Hop Swap
neutrond tx dex multi-hop-swap \
alice \
"untrn,ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2" \
1000000 \
0.95 \
true \
--from mykey \
--chain-id neutron-1
Arguments:
receiver- Address to receive output tokensroutes- Semicolon-separated routes, each route is comma-separated tokensamount-in- Amount of input tokensexit-limit-price- Minimum acceptable output pricepick-best-route- Whether to pick the best route (true/false)
Place Limit Order
neutrond tx dex place-limit-order \
alice \
untrn \
ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2 \
100 \
1000000 \
GOOD_TIL_CANCELLED \
--from mykey \
--chain-id neutron-1
Arguments:
receiver- Address to receive proceedstoken-in- Token being soldtoken-out- Token being boughttick-index- Price tick for the orderamount-in- Amount of input tokenorder-type- Order type (GOOD_TIL_CANCELLED, GOOD_TIL_TIME, FILL_OR_KILL, IMMEDIATE_OR_CANCEL, JUST_IN_TIME)expiration-time- (Optional) Expiration time for GTT orders
Order Management
Cancel Limit Order
neutrond tx dex cancel-limit-order \
tranche-key-here \
--from mykey \
--chain-id neutron-1
Withdraw Filled Limit Order
neutrond tx dex withdraw-filled-limit-order \
tranche-key-here \
--from mykey \
--chain-id neutron-1
Querying DEX State
Pool Information
List All Pool Metadata
neutrond query dex list-pool-metadata
Get Pool by ID
neutrond query dex show-pool-by-id 1
Get Pool by Parameters
neutrond query dex show-pool "untrn<>uatom" 0 3000
Check Pool Reserves
neutrond query dex show-pool-reserves "untrn<>uatom" untrn 0 3000
List All Pool Reserves for Pair
neutrond query dex list-pool-reserves "untrn<>uatom" untrn
User Positions
Check Your Liquidity Positions
neutrond query dex list-user-deposits neutron1... --include-pool-data
Check Your Limit Orders
neutrond query dex list-user-limit-orders neutron1...
Get Specific Limit Order Tranche User
neutrond query dex show-limit-order-tranche-user neutron1... tranche-key
Market Data
View Tick Liquidity
neutrond query dex list-tick-liquidity "untrn<>uatom" untrn
List Limit Order Tranches
neutrond query dex list-limit-order-tranche "untrn<>uatom" untrn
Get Specific Limit Order Tranche
neutrond query dex show-limit-order-tranche "untrn<>uatom" untrn 100 tranche-key
Simulation and Testing
Use simulation queries to preview operations before executing them.
Simulate Deposit
Use the simulate-deposit endpoint with a JSON message body containing the same parameters as the deposit transaction.
Simulate Withdrawal
Use the simulate-withdrawal endpoint with a JSON message body containing the same parameters as the withdrawal transaction.
Simulate Multi-Hop Swap
Use the simulate-multi-hop-swap endpoint with a JSON message body containing the same parameters as the swap transaction.
Simulate Limit Order
Use the simulate-place-limit-order endpoint with a JSON message body containing the same parameters as the place limit order transaction.
Best Practices
For Liquidity Providers
- Fee Tier Selection: Choose appropriate fee tiers based on pair volatility
- Position Management: Regularly monitor and rebalance positions
- Risk Assessment: Understand impermanent loss implications
For Traders
- Order Type Selection: Choose the right order type for your strategy
- Price Protection: Always set reasonable exit limit prices
- Gas Optimization: Consider transaction costs vs. trade size
General
- Testing: Always use simulation endpoints before executing transactions
- Validation: Verify all parameters before submitting transactions
- Monitoring: Track your positions and orders regularly
For complete command syntax and additional options, use neutrond tx dex --help and neutrond query dex --help.