Actions15
- Calculation Actions
- MarketData Actions
- News Actions
- Symbol Actions
- Trade Actions
- Trading Actions
Overview
This node integrates with the XTB Trading API, allowing users to interact with various trading-related resources. Specifically, for the Trade resource and the Get Trades operation, it retrieves trade data from the user's account. This can be used to fetch either all trades or only those that are currently open.
Common scenarios include:
- Monitoring active trades in real-time.
- Auditing past trades by retrieving historical trade data.
- Integrating trade data into dashboards or reporting tools.
For example, a trader might use this node to pull all open trades to analyze current exposure or risk.
Properties
| Name | Meaning |
|---|---|
| Opened Only | Whether to retrieve only opened (active) trades (true or false). |
Output
The node outputs an array of JSON objects representing trades. Each object contains details about individual trades fetched from the XTB API. The exact structure depends on the API response but typically includes trade identifiers, status (open/closed), symbol, volume, price, and timestamps.
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.
- Uses the external package
@sharplygroup/xtb-api-jsfor API operations.
Troubleshooting
- Connection Issues: If the node fails to connect, verify that the API credentials are correct and that the XTB API service is reachable.
- Unknown Resource Error: This error occurs if an unsupported resource name is provided; ensure "trade" is selected as the resource.
- Operation Errors: If the operation parameter is incorrect or missing, the node will throw an error. Confirm that "getTrades" is selected.
- Partial Failures: If some items fail during execution and "Continue On Fail" is enabled, errors will be returned in the output array for those items.
- Timeouts or Disconnections: Since the node uses WebSocket connections, network instability may cause disconnections. Retrying the node or checking network stability can help.
Links and References
- XTB Trading API Documentation
- n8n Documentation on Creating Custom Nodes
- @sharplygroup/xtb-api-js GitHub Repository (for reference on API client usage)