Skip to main content

List Orders

Retrieves the order book (list of buy and sell orders) for a specific trading pair on Gate.io. Essential for analyzing market depth, liquidity, and finding the best execution prices.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Currency Pair - The trading pair to get order book for (e.g., BTC_USDT, ETH_USDT).
  • Limit - Maximum number of orders to return (default: 10). Controls depth of order book.

Options

  • Order Type - Type of orders to retrieve:
    • buy - List buy orders (bids)
    • sell - List sell orders (asks)

Output

  • Result - An array of price levels, where each element is an array containing:
    • [0] - Price as string
    • [1] - Amount available at this price as string

Example output:

[
["50000.5", "0.5"], // 0.5 BTC available at $50,000.5
["50000.0", "1.2"], // 1.2 BTC available at $50,000.0
["49999.5", "0.8"] // 0.8 BTC available at $49,999.5
]

How It Works

The List Orders node executes the following steps:

  1. Validates that Currency Pair is not empty
  2. Sets default limit to 10 if not specified or invalid
  3. Creates a new Gate.io client (no authentication required for public data)
  4. Fetches the order book for the specified trading pair
  5. Filters for either buy (bids) or sell (asks) orders based on Order Type option
  6. Returns the specified number of price levels

Requirements

  • Valid trading pair that exists on Gate.io
  • No authentication required (this is public market data)
  • Limit should be a positive number (1-100 recommended)

Error Handling

The node will return specific errors in the following cases:

  • ErrInvalidArg - Currency Pair is empty
  • ErrListOrderBook - Failed to fetch order book from Gate.io
  • ErrInvalidOrderType - Order Type option is not set

Usage Notes

  • This retrieves public order book data (doesn't require authentication)
  • Buy orders (bids) are sorted from highest to lowest price
  • Sell orders (asks) are sorted from lowest to highest price
  • Data is real-time snapshot of the order book
  • Each price level shows total amount available at that price
  • Order book data changes rapidly in active markets
  • No Client Id required - this is public market data

Best Practices

  • Use reasonable limits (10-50) to get meaningful depth without excessive data
  • Check both buy and sell orders to understand market spread
  • Monitor order book depth to assess market liquidity
  • Use for identifying support/resistance levels
  • Implement caching for high-frequency access
  • Combine with Get Price for comprehensive market analysis
  • Use larger limits for low-liquidity pairs

Example Usage Scenarios

Get Top 10 Buy Orders

Inputs:
- Currency Pair: BTC_USDT
- Limit: 10

Options:
- Order Type: buy

Output:
[
["49999.9", "0.5"], // Highest bid
["49999.5", "1.2"],
["49999.0", "0.8"],
...
]

Get Top 20 Sell Orders

Inputs:
- Currency Pair: ETH_USDT
- Limit: 20

Options:
- Order Type: sell

Output:
[
["2000.1", "2.5"], // Lowest ask
["2000.5", "1.8"],
["2001.0", "3.2"],
...
]

Example Flow: Analyze Market Depth

[List Orders: BTC_USDT, Limit=20, Type=buy]
|
+-> [Store: buy_orders]
|
[List Orders: BTC_USDT, Limit=20, Type=sell]
|
+-> [Store: sell_orders]
|
[Calculate]
|
+-> Best bid: buy_orders[0][0]
+-> Best ask: sell_orders[0][0]
+-> Spread: sell_orders[0][0] - buy_orders[0][0]
+-> Total buy volume: sum of buy_orders amounts
+-> Total sell volume: sum of sell_orders amounts
|
[Log Market Depth Analysis]

Example Flow: Find Best Execution Price

[Get Balance: USDT]
|
+-> [Store: available_usdt]
|
[List Orders: BTC_USDT, Limit=50, Type=sell]
|
+-> [Calculate]
|
+-> [Iterate through orders]
+-> [Accumulate: amount_needed = available_usdt / price]
+-> [Find: price levels needed to fill order]
+-> [Calculate: average_price]
|
[Log: Can buy X BTC at average price Y]

Example Flow: Spread Alert System

[Loop Every 1 Minute]
|
+-> [List Orders: BTC_USDT, Limit=1, Type=buy]
| |
| +-> [Store: best_bid]
|
+-> [List Orders: BTC_USDT, Limit=1, Type=sell]
| |
| +-> [Store: best_ask]
|
+-> [Calculate: spread = best_ask - best_bid]
+-> [Calculate: spread_percent = (spread / best_ask) * 100]
|
+-> [If: spread_percent > 0.5%]
|
+-> [Send Alert: Large spread detected]

Example Flow: Market Liquidity Check

[List Orders: BTC_USDT, Limit=100, Type=buy]
|
+-> [Store: buy_orders]
|
[List Orders: BTC_USDT, Limit=100, Type=sell]
|
+-> [Store: sell_orders]
|
[Calculate Total Liquidity]
|
+-> [Sum buy volumes]
+-> [Sum sell volumes]
+-> [Calculate depth at ±1%, ±5%, ±10% from mid price]
|
[If: liquidity < threshold]
|
+-> [Log: Warning - Low liquidity market]
+-> [Adjust trading strategy]

Understanding Order Book Data

Buy Orders (Bids)

Sorted from highest to lowest price:

["50000.0", "1.0"]  ← Willing to pay $50,000 (highest)
["49999.5", "0.5"]
["49999.0", "2.0"] ← Willing to pay $49,999 (lower)

If you sell at market, you'll receive the highest bid price.

Sell Orders (Asks)

Sorted from lowest to highest price:

["50001.0", "0.8"]  ← Selling for $50,001 (lowest)
["50001.5", "1.2"]
["50002.0", "0.5"] ← Selling for $50,002 (higher)

If you buy at market, you'll pay the lowest ask price.

Calculating Market Metrics

Spread

const bestBid = parseFloat(buyOrders[0][0]);
const bestAsk = parseFloat(sellOrders[0][0]);
const spread = bestAsk - bestBid;
const spreadPercent = (spread / bestAsk) * 100;

Mid Price

const midPrice = (bestBid + bestAsk) / 2;

Total Volume at Top N Levels

const topVolume = orders.slice(0, 10).reduce((sum, order) => {
return sum + parseFloat(order[1]);
}, 0);

Average Price for Large Order

let remaining = 1.0; // Want to buy 1 BTC
let totalCost = 0;
let totalAmount = 0;

for (const [price, amount] of sellOrders) {
const priceNum = parseFloat(price);
const amountNum = parseFloat(amount);

if (remaining <= amountNum) {
totalCost += remaining * priceNum;
totalAmount += remaining;
break;
} else {
totalCost += amountNum * priceNum;
totalAmount += amountNum;
remaining -= amountNum;
}
}

const averagePrice = totalCost / totalAmount;

Example: Order Book Imbalance Strategy

[List Orders: BTC_USDT, Limit=50, Type=buy]
[List Orders: BTC_USDT, Limit=50, Type=sell]
|
+-> [Calculate]
|
+-> total_buy_volume
+-> total_sell_volume
+-> imbalance = (buy_volume - sell_volume) / (buy_volume + sell_volume)
|
[If: imbalance > 0.3] // 30% more buy volume
|
+-> [Buy Order: Expect price increase]
|
[If: imbalance < -0.3] // 30% more sell volume
|
+-> [Sell Order: Expect price decrease]

Common Patterns

Check Market Depth at Percentage Levels

[Get Price: current price]
|
[List Orders: sufficient limit]
|
[Calculate depth at:]
+-> 1% above/below current price
+-> 5% above/below current price
+-> 10% above/below current price

Find Wall (Large Order)

const walls = orders.filter(([price, amount]) => {
return parseFloat(amount) > 10; // Orders larger than 10 BTC
});
  • Get Price - Get current market price and ticker data
  • Buy Order - Use order book to determine optimal buy price
  • Sell Order - Use order book to determine optimal sell price
  • List Pairs - Find available trading pairs to analyze