XTB icon

XTB

Interact with XTB Trading API. Supports Account resources.

Overview

This node integrates with the XTB Trading API, enabling users to perform various trading-related operations programmatically within n8n workflows. Specifically, for the "Trading" resource and the "Trade Transaction" operation, it allows executing trade transactions such as placing, modifying, or closing trades on the XTB platform.

Common scenarios where this node is beneficial include:

  • Automating trade execution based on external signals or data.
  • Managing open positions dynamically in response to market conditions.
  • Integrating trading actions into broader automated workflows involving alerts, notifications, or portfolio management.

For example, a user could set up a workflow that listens to market data changes and automatically triggers a trade transaction when certain criteria are met, streamlining active trading strategies without manual intervention.

Properties

Name Meaning
Trade Transaction Info A string input containing information or parameters required to execute the trade transaction. This typically includes details like trade type, volume, symbol, price, or other relevant trade instructions.

Output

The node outputs an array of JSON objects representing the results of the executed trade transactions. Each object corresponds to one input item processed and contains the response data from the XTB Trading API related to the trade transaction performed.

If the node encounters errors during processing and "Continue On Fail" is enabled, error messages will be included in the output objects under an error field.

The node does not output binary data.

Dependencies

  • Requires an active connection to the XTB Trading API via WebSocket.
  • Needs valid API credentials (an API key or authentication token) configured in n8n to authenticate requests.
  • Depends on the @sharplygroup/xtb-api-js library for interacting with the XTB API.
  • The node manages connection lifecycle: connects before processing and disconnects after all items are processed.

Troubleshooting

  • Connection Issues: Failure to connect to the XTB API WebSocket may occur due to invalid credentials, network issues, or API downtime. Verify API credentials and network connectivity.
  • Unknown Resource Error: If the resource parameter is set incorrectly, the node throws an error indicating an unknown resource. Ensure the resource is set to "trading" for this operation.
  • Operation Errors: Errors returned by the XTB API during trade execution (e.g., invalid trade parameters, insufficient funds) will cause the node to throw exceptions unless "Continue On Fail" is enabled.
  • Invalid Input Data: Providing malformed or incomplete trade transaction info can lead to API errors. Validate the input string format and required fields before execution.

Links and References

Discussion