Binance icon

Binance

Consume Binance API

Actions7

Overview

This n8n node interacts with the Binance API to retrieve candlestick (candle) data for futures trading pairs. It allows users to specify a trading symbol, time interval, and optional time range to fetch historical price data in the form of OHLCV (Open, High, Low, Close, Volume) candles. This is useful for building trading bots, performing technical analysis, or integrating market data into automated workflows.

Example scenarios:

  • Fetching recent 1-minute candles for BTCUSDT futures to trigger alerts on price movements.
  • Downloading hourly candle data for backtesting trading strategies.
  • Integrating Binance futures data into dashboards or reporting tools.

Properties

Name Type Meaning
Symbol Name or ID options The futures trading pair to query (e.g., BTCUSDT). Can be selected from a list or specified via expression.
Interval Name or ID options The time interval for each candle (e.g., 1m, 5m, 1h). Selectable from a list or via expression.
Limit number Maximum number of candles to return (between 1 and 1000).
Start Time dateTime (Optional) The start timestamp for the data range.
End Time dateTime (Optional) The end timestamp for the data range.

Output

The node outputs an array of objects, each representing a single candlestick. Each object typically contains:

  • openTime: Start time of the candle (timestamp).
  • open: Opening price.
  • high: Highest price during the interval.
  • low: Lowest price during the interval.
  • close: Closing price.
  • volume: Trading volume during the interval.
  • closeTime: End time of the candle (timestamp).
  • Additional fields may include quote asset volume, number of trades, etc.

Example output:

[
  {
    "openTime": 1718006400000,
    "open": "67000.00",
    "high": "67100.00",
    "low": "66950.00",
    "close": "67050.00",
    "volume": "123.456",
    "closeTime": 1718006459999
    // ...other fields
  }
]

Dependencies

  • External Service: Requires access to the Binance API (Futures endpoint).
  • Credentials: Needs a configured binanceApi credential in n8n with appropriate API key and secret.

Troubleshooting

  • Invalid API Key/Secret: If credentials are incorrect or missing, you may receive authentication errors such as "API-key format invalid" or "Signature for this request is not valid." Ensure your API keys are correct and have the necessary permissions.
  • Symbol or Interval Not Found: If an invalid symbol or interval is provided, the node may throw errors like "Invalid symbol" or "Invalid interval." Double-check the available options or use expressions to provide valid values.
  • Limit Exceeded: Setting the limit above 1000 will result in an error. Keep the limit within the allowed range (1–1000).
  • Time Range Issues: If startTime is after endTime, or if the requested range is too large, the API may return no data or an error.

Links and References

Discussion