Skip to main content

Market Order

Executes an immediate buy or sell order at the current market price, guaranteeing execution but not the exact price.

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).
  • Order Amount - The order amount in either base or quote asset, depending on Unit Type selection.

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.
  • Unit Type - Specifies whether the Order Amount is in base asset or quote asset:
    • Amount - Order amount is in base asset (e.g., 0.001 BTC)
    • Total - Order amount is in quote asset (e.g., 100 USDT)
  • Order Type - The order side:
    • Buy - Purchase the base asset
    • Sell - Sell the base asset

Output

  • Result - An object containing the order execution response with details including order ID, filled price, and quantity.

How It Works

The Market Order node executes an order immediately at the best available market price.

When executed, the node:

  1. Retrieves the Binance client (from Client Id or creates one from credentials)
  2. Validates all required inputs
  3. Determines the order side (Buy or Sell) and unit type (Amount or Total)
  4. Creates a market order with the appropriate parameters
  5. Executes the order immediately
  6. Returns the order details including fill price and quantity

Requirements

  • Either a Client Id from Connect node OR API credentials in options
  • Sufficient balance (quote asset for buys, base asset for sells)
  • Valid trading pair that exists on Binance
  • Order amount that meets Binance's minimum requirements
  • Appropriate API permissions (spot trading enabled)

Error Handling

The node will return specific errors in the following cases:

  • ErrInternal - Failed to retrieve input values
  • ErrInvalidArg - Empty or invalid inputs (currency pair, amount, credentials, or options not selected)
  • ErrCreateMarketOrder - Order execution failed (e.g., insufficient balance, invalid pair)

Usage Notes

  • Market orders execute immediately at the best available price
  • You don't specify a price - the order fills at current market rates
  • Market orders can experience slippage, especially for large amounts
  • Use Amount when you want to buy/sell a specific quantity of the base asset
  • Use Total when you want to spend/receive a specific amount of the quote asset
  • Market orders are useful when speed of execution is more important than price precision

Order Response

The result object typically includes:

{
"symbol": "BTCUSDT",
"orderId": 123456791,
"orderListId": -1,
"clientOrderId": "...",
"transactTime": 1640000000000,
"price": "0.00",
"origQty": "0.001",
"executedQty": "0.001",
"cummulativeQuoteQty": "50.50",
"status": "FILLED",
"timeInForce": "GTC",
"type": "MARKET",
"side": "BUY",
"fills": [...]
}

Example: Buy Bitcoin with USDT

Scenario: Buy Bitcoin using exactly 100 USDT

Inputs:

  • Client Id: (from Connect node)
  • Currency Pair: BTCUSDT
  • Order Amount: 100

Options:

  • Unit Type: Total (amount is in USDT)
  • Order Type: Buy

Result: You'll receive approximately 100 USDT worth of BTC at current market price.

Example: Sell Specific BTC Amount

Scenario: Sell exactly 0.001 BTC

Inputs:

  • Client Id: (from Connect node)
  • Currency Pair: BTCUSDT
  • Order Amount: 0.001

Options:

  • Unit Type: Amount (amount is in BTC)
  • Order Type: Sell

Result: You'll receive USDT equivalent of 0.001 BTC at current market price.

Example: Quick Exit Strategy

[Price Alert Triggered]
|
v
[Connect]
|
v
[Get Balance: BTC]
|
v
[Market Order]
| Unit Type: Amount
| Order Type: Sell
| Order Amount: (full balance)
v
[Send Alert: "Sold BTC at market"]
|
v
[Disconnect]

Understanding Unit Types

Amount (Base Asset):

  • For BTCUSDT: Amount is in BTC
  • Buy: Specify how much BTC you want to buy
  • Sell: Specify how much BTC you want to sell

Total (Quote Asset):

  • For BTCUSDT: Total is in USDT
  • Buy: Specify how much USDT you want to spend
  • Sell: Specify how much USDT you want to receive (approximately)

Market Order vs Limit Order

FeatureMarket OrderLimit Order
Execution SpeedImmediateWhen price reaches limit
Price ControlNo controlExact price specified
Guaranteed FillYes (if liquidity exists)No (may not reach price)
Best ForSpeed, certaintyPrice precision
Slippage RiskHigherNone

Trading Tips

  • Slippage: Large market orders may fill at worse prices due to slippage
  • Liquidity: Check order book depth before placing large market orders
  • Volatile Markets: Market orders can fill at unexpected prices during high volatility
  • Total vs Amount: Use Total when you want to spend a specific amount; use Amount for specific quantities
  • Emergency Exits: Market orders are ideal for quickly exiting positions

Common Errors

  • Insufficient balance - Not enough funds to execute the order
  • Invalid symbol - Trading pair doesn't exist or is delisted
  • LOT_SIZE violation - Quantity doesn't meet minimum/maximum/step size requirements
  • MIN_NOTIONAL violation - Order value is below minimum (usually 10-20 USDT)
  • Market order not allowed - Some pairs may not support market orders during certain conditions

Best Practices

  • Use Get Balance to verify sufficient funds before placing market orders
  • Be aware of slippage, especially for large orders or low-liquidity pairs
  • Consider using limit orders instead if price precision is important
  • Use Get Price to check current price before executing to estimate costs
  • Monitor the fills array in the response to see actual execution prices
  • For large orders, consider splitting into smaller market orders to reduce slippage
  • Avoid market orders during periods of high volatility or low liquidity

Risk Considerations

  • Price Slippage: Market orders may fill at worse prices than expected
  • No Price Guarantee: You don't control the execution price
  • Flash Crashes: During extreme volatility, market orders can fill at very unfavorable prices
  • Partial Information: You won't know the exact fill price until after execution
  • Large Orders: Big market orders can move the market against you