FXCM

Execute FXCM trading operations

Overview

This node integrates with the FXCM trading platform to perform various trading-related operations. Specifically, for the "Trading" resource and the "Close Position" operation, it allows users to close an existing open position on a specified instrument. This is useful in automated trading workflows where positions need to be programmatically closed based on certain conditions or strategies.

Practical examples include:

  • Automatically closing a forex position when a target profit or loss threshold is reached.
  • Integrating with other nodes to manage risk by closing positions after receiving signals from market data analysis.
  • Closing positions as part of end-of-day cleanup in algorithmic trading systems.

Properties

Name Meaning
Instrument Trading instrument to get data for (e.g., "EUR/USD"). Required for identifying the market instrument involved in trading operations.

Note: For the "Close Position" operation, the key input parameter used internally is positionId (not exposed in the provided properties), which identifies the specific position to close.

Output

The node outputs a JSON object representing the result of the close position request. This typically includes details about the closed position such as its ID, status, and any relevant trade information returned by the FXCM API.

No binary data output is produced by this operation.

Example output structure (conceptual):

{
  "positionId": "123456",
  "status": "closed",
  "closedAmount": 1000,
  "closePrice": 1.2345,
  "timestamp": "2024-06-01T12:34:56Z"
}

Dependencies

  • Requires an active FXCM API connection authenticated via an API key credential configured in n8n.
  • The node depends on the bundled FxcmClient class to communicate with the FXCM API.
  • Proper network connectivity to FXCM's trading servers is necessary.

Troubleshooting

  • Common issues:

    • Invalid or expired API credentials will cause authentication failures.
    • Attempting to close a non-existent or already closed position will result in errors.
    • Network connectivity problems can prevent successful API calls.
  • Error messages:

    • Errors thrown by the FXCM API client are caught; if "Continue On Fail" is disabled, the node execution stops with the error message.
    • Typical error messages might include "Position not found", "Unauthorized access", or "Network timeout".
  • Resolutions:

    • Verify that the API key credential is valid and has sufficient permissions.
    • Confirm the position ID exists and is currently open before attempting to close.
    • Check internet connectivity and firewall settings.

Links and References

Discussion