Skip to main content

List Orders

Retrieves the current order book (bids or asks) for a trading pair, showing the best available buy and sell orders.

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

  • Client Id - The unique identifier from the Connect node (optional if using direct credentials).
  • Currency Pair - The trading pair symbol (e.g., BTCUSDT, ETHUSDT, BNBUSDT).
  • Limit - Maximum number of orders to retrieve (default: 10 if not specified or invalid).

Options

  • Api Key - (Optional) Binance API key credential. Use if not providing Client Id.
  • Secret Key - (Optional) Binance API secret key credential. Use if not providing Client Id.
  • Order Type - The side of the order book to retrieve:
    • Buy - Bid orders (buyers waiting to buy)
    • Sell - Ask orders (sellers waiting to sell)

Output

  • Result - An array of price level objects showing prices and quantities.

How It Works

The List Orders node retrieves the current order book depth for a trading pair.

When executed, the node:

  1. Retrieves the Binance client (from Client Id or creates one from credentials)
  2. Validates Currency Pair and Limit inputs
  3. Queries Binance's order book depth
  4. Filters for either bids (buy orders) or asks (sell orders) based on Order Type
  5. Returns the requested number of price levels

Requirements

  • Either a Client Id from Connect node OR API credentials in options
  • Valid trading pair symbol
  • Appropriate API permissions (reading enabled)
  • Order Type option must be selected

Error Handling

The node will return specific errors in the following cases:

  • ErrInternal - Failed to retrieve input values
  • ErrInvalidArg - Empty Currency Pair
  • ErrNEwDepthService - Failed to retrieve order book from Binance
  • ErrInvalidOrderType - Order Type option not selected

Usage Notes

  • Returns real-time order book data
  • Bids are sorted highest to lowest (best bid first)
  • Asks are sorted lowest to highest (best ask first)
  • Limit defaults to 10 if not provided or ≤ 0
  • Order book updates frequently as orders are placed/canceled
  • Useful for analyzing liquidity and market depth

Order Book Response

Each price level object contains:

{
"Price": "50000.00",
"Quantity": "1.5"
}

Buy Orders (Bids) Example:

[
{ "Price": "50000.00", "Quantity": "1.5" }, // Best bid
{ "Price": "49999.00", "Quantity": "2.3" },
{ "Price": "49998.00", "Quantity": "0.8" },
{ "Price": "49997.00", "Quantity": "3.1" },
{ "Price": "49996.00", "Quantity": "1.2" }
]

Sell Orders (Asks) Example:

[
{ "Price": "50001.00", "Quantity": "0.9" }, // Best ask
{ "Price": "50002.00", "Quantity": "1.7" },
{ "Price": "50003.00", "Quantity": "2.4" },
{ "Price": "50004.00", "Quantity": "0.5" },
{ "Price": "50005.00", "Quantity": "3.2" }
]

Example: Check Best Bid/Ask

Scenario: Get the best buy and sell prices for Bitcoin

Buy Orders:

  • Client Id: (from Connect node)
  • Currency Pair: BTCUSDT
  • Limit: 5
  • Order Type: Buy

Sell Orders:

  • Same as above but Order Type: Sell

Example: Calculate Spread

[Connect]
|
v
[List Orders: BTCUSDT, Buy, Limit: 1]
|
v
[Store: best_bid = result[0].Price]
|
v
[List Orders: BTCUSDT, Sell, Limit: 1]
|
v
[Store: best_ask = result[0].Price]
|
v
[Calculate: spread = best_ask - best_bid]
[Calculate: spread_percent = (spread / best_bid) * 100]
|
v
[Log: "Spread: $" + spread + " (" + spread_percent + "%)"]
|
v
[Disconnect]

Example: Liquidity Analysis

[List Orders: BTCUSDT, Buy, Limit: 20]
|
v
[Calculate Total Liquidity]
|
v
[Sum: total_buy_quantity = sum of all quantities]
[Calculate: total_buy_value = sum(price * quantity)]
|
v
[If: total_buy_value < 100000]
|
v
[Alert: "Low liquidity - high slippage risk"]
|
v
[Disconnect]

Example: Order Placement Strategy

[List Orders: ETHUSDT, Buy, Limit: 10]
|
v
[Extract: best_bid = result[0].Price]
|
v
[Calculate: my_bid = best_bid + 0.01] // Slightly higher than best bid
|
v
[Buy Order]
| Currency Pair: ETHUSDT
| Order Price: my_bid
| Quantity: desired_amount
v
[Log: "Placed order at competitive price"]

Understanding Order Book

Bids (Buy Orders):

  • Prices buyers are willing to pay
  • Sorted from highest to lowest
  • Higher bids have priority
  • First element is the best bid (highest price)

Asks (Sell Orders):

  • Prices sellers are asking
  • Sorted from lowest to highest
  • Lower asks have priority
  • First element is the best ask (lowest price)

Spread:

  • Difference between best ask and best bid
  • Smaller spread = more liquid market
  • Wider spread = less liquidity

Market Depth Analysis

// Calculate cumulative liquidity
let cumulativeQuantity = 0;
let cumulativeValue = 0;

orders.forEach(order => {
const price = parseFloat(order.Price);
const quantity = parseFloat(order.Quantity);

cumulativeQuantity += quantity;
cumulativeValue += price * quantity;
});

// Average price for all orders
const avgPrice = cumulativeValue / cumulativeQuantity;

Use Cases

Price Discovery:

  • Find best available buy/sell prices
  • Calculate current spread
  • Identify price levels

Liquidity Analysis:

  • Check market depth before large orders
  • Identify potential slippage
  • Assess trading conditions

Order Placement:

  • Position limit orders competitively
  • Avoid slippage on large orders
  • Find optimal entry/exit prices

Arbitrage:

  • Compare spreads across markets
  • Identify arbitrage opportunities
  • Monitor price inefficiencies

Market Making:

  • Place orders on both sides
  • Maintain spread
  • Provide liquidity

Trading Tips

  • Check depth before placing large orders to estimate slippage
  • Place limit orders between bid and ask to avoid fees (maker orders)
  • Wide spreads indicate low liquidity - be cautious
  • Thin order books mean your orders can move the market
  • Clustering of orders at certain prices indicates support/resistance

Best Practices

  • Always check both bids and asks to understand full market picture
  • Use sufficient limit to see market depth (try 10-20 levels)
  • Monitor order book before placing large trades
  • Calculate potential slippage for your order size
  • Consider market depth when choosing between limit and market orders
  • Refresh order book data before each trade (it changes quickly)
  • Be aware that order book can change instantly
  • Use spread to gauge market liquidity

Slippage Estimation

// Calculate expected price for a market buy order
function estimateMarketBuyPrice(askOrders, quantityToBuy) {
let remaining = quantityToBuy;
let totalCost = 0;

for (const order of askOrders) {
const price = parseFloat(order.Price);
const available = parseFloat(order.Quantity);

if (remaining <= available) {
totalCost += remaining * price;
remaining = 0;
break;
} else {
totalCost += available * price;
remaining -= available;
}
}

if (remaining > 0) {
return null; // Not enough liquidity
}

return totalCost / quantityToBuy; // Average fill price
}

Common Patterns

Spread Monitoring:

Get bid orders (limit 1)
Get ask orders (limit 1)
Calculate spread
Alert if spread > threshold

Liquidity Check:

Get orders (limit 20)
Sum quantities
Calculate total value
Verify sufficient for trade

Competitive Pricing:

Get best bid/ask
Calculate mid-price
Place order at competitive price

Order Book Depth Levels

Common limit values:

  • 5-10 - Quick spread and best prices check
  • 20-50 - Good liquidity assessment
  • 100+ - Detailed market depth analysis

Understanding Price Impact

Large orders can "walk through" the order book:

  1. Fill best price completely
  2. Move to next price level
  3. Continue until order filled
  4. Average price gets worse with each level

This is why checking depth is important for large trades!