Overview
The provided source code snippet is part of a custom n8n node named "Binance Trigger." This node is designed to trigger workflows based on events or data from the Binance platform, a popular cryptocurrency exchange. The node listens for specific conditions or updates related to Binance and initiates workflow execution when those conditions are met.
In the context of the "Default" resource with the "Candle" operation (as specified by you), the node likely monitors candlestick data (price movements over time intervals) from Binance. Users can set thresholds and flags to control when the trigger activates based on candle data changes.
Practical examples include:
- Triggering a workflow when a candlestick's price change exceeds a certain percentage.
- Reacting to candle data after a specific time threshold.
- Using the "Is Final" flag to determine if the candle is closed/finalized before triggering.
This node is beneficial for automated trading strategies, alerting systems, or analytics workflows that depend on real-time or near-real-time market data from Binance.
Properties
| Name | Meaning |
|---|---|
| Percent Threshold | A numeric value representing the minimum percentage change in candle data to trigger the node. |
| TimeThreshold | A numeric value specifying the minimum time duration threshold related to candle data before triggering. |
| Is Final | A boolean flag indicating whether to trigger only on finalized (closed) candles (true) or also on intermediate updates (false). |
Output
The node outputs JSON data representing the candle information from Binance that triggered the event. This typically includes details such as open, close, high, low prices, volume, timestamp, and other relevant candlestick metrics.
If binary data output is supported (not evident from the snippet), it would generally represent raw data streams or files related to the candle data, but this is not indicated here.
Dependencies
- Requires an API key credential for authenticating with the Binance API.
- Depends on internal trigger logic defined in
./triggers/binance.triggerand properties from./triggers/binance.properties. - Uses helper methods from
./methodsfor loading options or additional functionality.
No explicit environment variables are mentioned, but proper API credentials must be configured within n8n for this node to function.
Troubleshooting
Common Issues:
- Missing or invalid API credentials will prevent the node from connecting to Binance.
- Incorrect threshold values (e.g., negative percentages or zero time thresholds) might cause the trigger to never activate.
- Network connectivity issues can disrupt real-time data streaming.
Error Messages:
- Authentication errors usually indicate problems with the API key setup.
- Timeout or connection errors suggest network or Binance service availability problems.
To resolve these, verify API credentials, check network access, and ensure threshold values are logically set.