Actions15
- Calculation Actions
- MarketData Actions
- News Actions
- Symbol Actions
- Trade Actions
- Trading Actions
Overview
This node integrates with the XTB Trading API to perform various operations related to trading, market data, account management, and calculations. Specifically, for the Calculation resource and the Get Commission Definition operation, it retrieves the commission details applicable for a given trading symbol and volume. This is useful for traders or automated trading systems that need to understand the cost structure before placing trades.
Practical examples include:
- Calculating expected commissions for a specific trade volume on a particular symbol.
- Incorporating commission costs into profit/loss calculations or margin requirements.
- Displaying commission information in custom dashboards or reports.
Properties
| Name | Meaning |
|---|---|
| Symbol | The trading symbol (e.g., currency pair, stock ticker) for which to get the commission definition. |
| Volume | The trade volume (amount of units/contracts) to calculate the commission for. |
Output
The node outputs an array of JSON objects where each object contains the commission definition details returned by the XTB API for the specified symbol and volume. The exact structure depends on the API response but typically includes fields such as commission amount, commission type, and any related parameters.
No binary data output is produced by this operation.
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 executing operations 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 unsupported symbol or invalid volume may cause errors or empty results. Ensure symbols conform to XTB's supported instruments and volumes are positive numbers.
- API rate limits or downtime: Temporary API unavailability or rate limiting can cause failures. Retry after some time or check XTB service status.
- Unknown resource error: If the resource parameter is set incorrectly, the node will throw an "Unknown resource" error. Make sure to select "Calculation" as the resource for this operation.
Links and References
- XTB Trading API Documentation
- n8n Documentation on Creating Custom Nodes
- @sharplygroup/xtb-api-js GitHub Repository (for underlying API client library)