FXCM

Execute FXCM trading operations

Overview

This node integrates with the FXCM trading platform to perform various trading operations and retrieve market data. Specifically, the "Close Position" operation 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 stop loss level is reached.
  • Integrating with other nodes to manage risk by closing positions after specific signals.
  • Closing positions as part of end-of-day cleanup in trading automation.

Properties

Name Meaning
Instrument Trading instrument to get data for (e.g., "EUR/USD")

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

Output

The output JSON contains the response from the FXCM API after attempting to close the position. It typically includes details about the closed position such as its ID, status, and any relevant trade information confirming the closure.

Example structure (simplified):

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

No binary data output is produced by this operation.

Dependencies

  • Requires an active FXCM API credential configured in n8n to authenticate requests.
  • Depends on the internal FxcmClient class to communicate with the FXCM API.
  • The node requires network access to FXCM's trading API endpoints.

Troubleshooting

  • Common issues:

    • Invalid or expired API credentials will cause authentication failures.
    • Providing an incorrect or non-existent positionId will result in errors indicating the position cannot be found.
    • Network connectivity problems can lead to timeouts or failed requests.
  • Error messages:

    • "Position not found": Verify that the positionId is correct and that the position is still open.
    • "Authentication failed": Check that the API key credential is valid and has necessary permissions.
    • "Request timed out": Ensure stable internet connection and retry.

To resolve these, verify credentials, confirm position IDs, and ensure network stability.

Links and References

Discussion