XTB icon

XTB

Interact with XTB Trading API. Supports Account resources.

Overview

This node interacts with the XTB Trading API, specifically providing access to various trading-related resources. For the Trade resource and the Get Trades History operation, it retrieves historical trade data within a specified date range. This is useful for traders or analysts who want to review past trades, analyze performance, or generate reports based on historical trading activity.

Practical examples include:

  • Fetching all trades executed between two timestamps to audit trading strategies.
  • Extracting trade history for compliance or record-keeping purposes.
  • Integrating trade history data into dashboards or external analytics tools.

Properties

Name Meaning
End The end date timestamp (in milliseconds) defining the upper bound of the trade history period to retrieve.
Start The start date timestamp (in milliseconds) defining the lower bound of the trade history period to retrieve.

Both properties are required and define the time window for which the trade history will be fetched.

Output

The node outputs an array of JSON objects representing individual trades within the specified date range. Each object contains details about a single trade as returned by the XTB Trading API's trade history endpoint. The exact structure depends on the API response but typically includes fields such as trade ID, open/close times, symbol, volume, profit/loss, and other trade-specific metadata.

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-js library 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 have sufficient permissions.
  • Invalid date range: Ensure that the "Start" and "End" timestamps are valid numbers and that "Start" is less than or equal to "End".
  • Empty results: If no trades are returned, confirm that there were trades executed in the specified date range.
  • API rate limits or downtime: Temporary failures may occur if the API service is unavailable or rate-limited; retry after some time.
  • Unhandled resource or operation: The node throws an error if an unknown resource or operation is specified; ensure the Resource is set to "Trade" and Operation to "Get Trades History".

Links and References

Discussion