Skip to main content

Buy Order

Places a limit buy order on Binance, allowing you to specify the exact price at which you want to purchase a cryptocurrency.

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 Quantity - The amount of the base asset to buy (e.g., 0.001 BTC).
  • Order Price - The limit price per unit in the quote asset (e.g., 50000 USDT).

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.

Output

  • Result - An object containing the order creation response with details including order ID, status, and filled information.

How It Works

The Buy Order node creates a limit buy order that will only execute at your specified price or better.

When executed, the node:

  1. Retrieves the Binance client (from Client Id or creates one from credentials)
  2. Validates all required inputs
  3. Creates a limit buy order with Time In Force = GTC (Good Till Canceled)
  4. Submits the order to Binance
  5. Returns the order details including the unique order ID

Requirements

  • Either a Client Id from Connect node OR API credentials in options
  • Sufficient quote asset balance (e.g., USDT) to cover the order
  • Valid trading pair that exists on Binance
  • Order quantity and price that meet 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, quantity, price, or credentials)
  • ErrCreateBuyOrder - Order creation failed (e.g., insufficient balance, invalid pair, minimum size not met)

Usage Notes

  • Limit orders only execute at the specified price or better
  • Orders remain open until filled, canceled, or expired
  • The order uses GTC (Good Till Canceled) time in force - it stays active until filled or manually canceled
  • Minimum order sizes vary by trading pair - check Binance trading rules
  • Some pairs have price and quantity filters (minimum, maximum, step size)
  • The result includes the order ID which can be used to track or cancel the order

Order Response

The result object typically includes:

{
"symbol": "BTCUSDT",
"orderId": 123456789,
"orderListId": -1,
"clientOrderId": "...",
"transactTime": 1640000000000,
"price": "50000.00",
"origQty": "0.001",
"executedQty": "0.000",
"cummulativeQuoteQty": "0.00",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY"
}

Example: Buy Bitcoin

Scenario: Buy 0.001 BTC when price reaches $50,000 USDT

Inputs:

  • Client Id: (from Connect node)
  • Currency Pair: BTCUSDT
  • Order Quantity: 0.001
  • Order Price: 50000

Output: The result contains the order ID and status. Save the order ID to track or cancel the order later.

Example: Dollar Cost Averaging

[Timer Trigger: Daily]
|
v
[Connect]
|
v
[Get Balance: USDT]
|
v
[Calculate: amount = balance * 0.1]
|
v
[Get Price: BTCUSDT]
|
v
[Calculate: quantity = amount / price]
|
v
[Buy Order]
|
v
[Disconnect]

Trading Tips

  • Limit vs Market: Use limit orders when you want price control; use market orders for immediate execution
  • Price Setting: Set your buy price slightly below current market price to increase fill probability
  • Partial Fills: Large orders may fill partially; check executedQty in the response
  • Order Book: Use List Orders node to see current bid/ask spread before placing orders
  • Minimum Notional: Ensure your order value meets the minimum notional value requirement (usually 10-20 USDT)

Common Errors

  • Insufficient balance - Not enough quote asset (e.g., USDT) to cover the order
  • Invalid symbol - Trading pair doesn't exist or is delisted
  • LOT_SIZE violation - Quantity doesn't meet minimum/maximum/step size requirements
  • PRICE_FILTER violation - Price doesn't meet minimum/maximum/tick size requirements
  • MIN_NOTIONAL violation - Order value (quantity × price) is below minimum

Best Practices

  • Always validate sufficient balance before placing orders
  • Use Get Price to check current market price before setting your limit price
  • Store the order ID from the result for tracking purposes
  • Implement error handling for common trading errors
  • Consider using Test with Continue On Error to handle order rejections gracefully
  • Monitor order status using Get Order node with the returned order ID