Skip to main content

Order Types on GTX DEX

GTX DEX supports professional-grade order types designed for both retail and institutional traders. Every order type is optimized to generate yield while providing precise execution control.

Market Orders

Execute trades immediately at the best available market price.

How Market Orders Work

Market orders prioritize speed over price control:
  1. Immediate Execution - Order executes against existing liquidity
  2. Price Taking - You pay the current ask (buy) or receive current bid (sell)
  3. No Yield Period - Executes instantly, no yield accumulation time

When to Use Market Orders

Urgent Execution

When you need immediate entry or exit from a position

High Liquidity Markets

In deep markets where price impact is minimal

Market Order Example

// Buy 1.5 ETH at current market price
{
  type: "MARKET",
  side: "BUY", 
  quantity: "1.5",
  symbol: "ETHUSDC"
}

// Expected execution: Immediate at best ask price
// Yield generation: None (instant execution)

Advantages & Disadvantages

✅ Advantages❌ Disadvantages
Immediate executionNo price control
Guaranteed fillPotential slippage
Simple to useHigher effective cost

Limit Orders

Execute trades only at your specified price or better, while earning yield.

How Limit Orders Work

Limit orders provide price control and yield generation:
  1. Price Control - Sets maximum buy price or minimum sell price
  2. Queue Position - Joins order book at specified price level
  3. Yield Accrual - Earns yield while waiting for execution
  4. Partial Fills - Can execute in portions as liquidity becomes available

When to Use Limit Orders

Price Discipline

When you have a specific target price in mind

Yield Generation

To earn returns while waiting for execution

Market Making

To provide liquidity and earn trading fees

Limit Order Examples

// Buy 2.0 ETH at $2400 or lower
{
  type: "LIMIT",
  side: "BUY",
  quantity: "2.0", 
  price: "2400.00",
  symbol: "ETHUSDC"
}

// Yield earnings while order is open:
// - Base yield rate on position value
// - Potential maker fee rebates
// - Protocol reward tokens

Limit Order Execution Priority

Orders execute based on Price-Time Priority:
  1. Best Price First - Higher bids and lower asks get priority
  2. Time Priority - Among same price, earlier orders execute first
  3. Pro-Rata - Large orders may split execution fairly

Order Management

Order Status Types

StatusDescriptionYield Earning
NEWOrder submitted, not yet in book
OPENActive in order book
PARTIALLY_FILLEDPartially executed✅ (on remaining)
FILLEDCompletely executed
CANCELLEDCancelled by user

Modifying Orders

Remove orders from the order book:
// Cancel specific order
await gtx.cancelOrder(orderId);

// Cancel all orders for symbol
await gtx.cancelAllOrders("ETHUSDC");
Note: Yield stops accruing immediately upon cancellation
Modify price or quantity:
// Cancel and replace with new parameters
await gtx.replaceOrder(orderId, {
  price: "2550.00",
  quantity: "1.5"
});
Note: Replacement creates new order, losing time priority

Advanced Order Strategies

Iceberg Orders

Break large orders into smaller chunks to avoid market impact:
// Large order split into smaller pieces
{
  type: "ICEBERG",
  side: "BUY",
  totalQuantity: "10.0",
  visibleQuantity: "1.0", // Only show 1.0 at a time
  price: "2500.00",
  symbol: "ETHUSDC"
}
Benefits:
  • Reduced market impact
  • Maintain yield on entire position
  • Hide trading intentions

Time-in-Force Options

Control how long orders remain active:
TypeDescriptionYield Impact
GTCGood Till CancelledMaximum yield time
IOCImmediate or CancelMinimal yield opportunity
FOKFill or KillNo yield (instant decision)

Market Making Strategies

Spread Trading

// Place both buy and sell orders
const buyOrder = {
  type: "LIMIT",
  side: "BUY", 
  quantity: "1.0",
  price: "2495.00", // Below market
  symbol: "ETHUSDC"
};

const sellOrder = {
  type: "LIMIT", 
  side: "SELL",
  quantity: "1.0", 
  price: "2505.00", // Above market
  symbol: "ETHUSDC"
};

// Earn yield on both orders + spread profit when filled

Dynamic Pricing

// Adjust orders based on market conditions
setInterval(async () => {
  const ticker = await gtx.getTicker("ETHUSDC");
  const midPrice = (ticker.bid + ticker.ask) / 2;
  
  // Update orders around mid price
  await gtx.replaceOrder(buyOrderId, {
    price: (midPrice * 0.999).toFixed(2) // 0.1% below mid
  });
  
  await gtx.replaceOrder(sellOrderId, {
    price: (midPrice * 1.001).toFixed(2) // 0.1% above mid  
  });
}, 5000); // Update every 5 seconds

Order Book Interaction

Reading the Order Book

// Get current order book depth
const depth = await gtx.getOrderBook("ETHUSDC", 10);

console.log("Best Bid:", depth.bids[0]); // [price, quantity]
console.log("Best Ask:", depth.asks[0]); // [price, quantity]

// Calculate spread
const spread = depth.asks[0][0] - depth.bids[0][0];
console.log("Spread:", spread);

Understanding Market Impact

// Calculate potential market impact
function estimateMarketImpact(orderBook, side, quantity) {
  const orders = side === "BUY" ? orderBook.asks : orderBook.bids;
  let remaining = quantity;
  let totalCost = 0;
  
  for (const [price, available] of orders) {
    const fillQty = Math.min(remaining, available);
    totalCost += fillQty * price;
    remaining -= fillQty;
    
    if (remaining <= 0) break;
  }
  
  const avgPrice = totalCost / (quantity - remaining);
  const marketPrice = orders[0][0];
  const impact = Math.abs(avgPrice - marketPrice) / marketPrice;
  
  return { avgPrice, impact: impact * 100 }; // Impact as percentage
}

Best Practices

For Maximum Yield

1

Use Limit Orders

Prefer limit orders over market orders to earn yield while waiting
2

Set Competitive Prices

Price orders close to market for higher execution probability
3

Monitor Markets

Adjust orders as market conditions change
4

Diversify Timeframes

Mix short-term and long-term orders for consistent yield

For Better Execution

  • Check Liquidity - Review order book depth before large orders
  • Avoid Round Numbers - Use prices like 2501.50 instead of 2500.00
  • Time Your Orders - Place during high-liquidity periods
  • Monitor Fills - Watch for partial executions and adjust accordingly

Risk Management

Order Risks to Consider:
  • Limit orders may never execute if price doesn’t reach your level
  • Market orders can experience slippage in volatile conditions
  • Yield is not guaranteed and varies based on market conditions
  • Always monitor positions and market conditions

Order Examples by Scenario

Conservative Trading

// Conservative approach: Close to market prices
{
  type: "LIMIT",
  side: "BUY",
  quantity: "1.0", 
  price: currentAsk * 0.995, // 0.5% below ask
  symbol: "ETHUSDC"
}

Aggressive Trading

// Aggressive approach: Further from market  
{
  type: "LIMIT",
  side: "BUY",
  quantity: "1.0",
  price: currentAsk * 0.98, // 2% below ask
  symbol: "ETHUSDC"  
}

Yield Optimization

// Maximum yield: Patient orders
{
  type: "LIMIT", 
  side: "BUY",
  quantity: "5.0",
  price: currentAsk * 0.95, // 5% below ask
  symbol: "ETHUSDC",
  timeInForce: "GTC" // Keep earning until filled
}

Every order type on GTX DEX is designed to maximize your trading efficiency while generating yield. Choose the right order type based on your strategy, risk tolerance, and yield objectives.