Actions15
- Calculation Actions
- MarketData Actions
- News Actions
- Symbol Actions
- Trade Actions
- Trading Actions
Overview
This node integrates with the XTB Trading API, enabling users to perform various trading-related operations programmatically within n8n workflows. Specifically, for the Calculation resource and the Get Margin Trade operation, it retrieves margin trade details based on a given trading symbol and volume. This is useful for traders or automated systems that need to calculate margin requirements dynamically before placing trades.
Practical examples include:
- Calculating the margin needed for a specific trade volume on a particular financial instrument.
- Automating risk management by fetching margin data before executing trades.
- Integrating margin calculations into larger trading strategies or portfolio management workflows.
Properties
| Name | Meaning |
|---|---|
| Symbol | The trading symbol (e.g., currency pair, stock ticker) for which to get margin trade info. |
| Volume | The amount/volume of the asset to calculate the margin trade for. |
Output
The node outputs an array of JSON objects representing the results of the requested operation(s). For the Get Margin Trade operation, the output JSON contains detailed information about the margin trade calculation corresponding to the provided symbol and volume.
The exact structure depends on the XTB API response but typically includes fields such as required margin, leverage, and other trade parameters relevant to margin trading.
No binary data output is produced by this node.
Dependencies
- Requires an active connection to the XTB Trading API via a WebSocket manager.
- Needs valid API credentials (an API key or authentication token) configured in n8n to authenticate requests.
- Depends on the
@sharplygroup/xtb-api-jslibrary for interacting with the XTB API. - The node manages connection lifecycle: connects before execution and disconnects afterward.
Troubleshooting
- Connection errors: If the node fails to connect to the XTB API, verify that the API credentials are correct and that the network allows WebSocket connections to the XTB service.
- Invalid symbol or volume: Providing an incorrect or unsupported symbol or invalid volume may cause errors or empty responses. Ensure symbols conform to XTB's supported instruments.
- API rate limits or downtime: The XTB API might throttle requests or be temporarily unavailable; handle such errors gracefully or retry later.
- NodeOperationError: Generic errors thrown by the node indicate issues during execution; check the error message for specifics and ensure all required parameters are set.
Links and References
- XTB Trading API Documentation
- n8n Documentation
- @sharplygroup/xtb-api-js GitHub Repository (for the underlying API client library)