Actions16
- Account Actions
- Trading Actions
- Market Data Actions
Overview
This node integrates with the FXCM trading platform to perform various operations related to trading, market data retrieval, and account management. Specifically, for the Market Data resource with the Close Position operation (though "Close Position" is under Trading resource in the code), it allows users to close an open trading position by specifying its identifier.
Common scenarios where this node is beneficial include:
- Automating trade management workflows such as closing positions programmatically based on custom logic.
- Integrating FXCM trading actions into broader automation pipelines without manual intervention.
- Fetching market data or managing trades directly from n8n workflows.
Practical example:
- A user wants to automatically close a losing position when certain conditions are met in their workflow. They can use this node’s Close Position operation to close that position by providing the position ID.
Properties
| Name | Meaning |
|---|---|
| Instrument | Trading instrument to get data for (e.g., "EUR/USD") |
Note: For the Close Position operation specifically, the key input property used is positionId (not listed in your provided properties but visible in the code). This property represents the unique identifier of the position to be closed.
Output
The output of the Close Position operation is a JSON object containing the response from the FXCM API about the closed position. This typically includes details such as confirmation of closure, position details, and any relevant status messages.
Example output structure (simplified):
{
"positionId": "12345",
"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 (an API key or token) configured in n8n to authenticate requests.
- The node depends on the internal
FxcmClientclass which handles communication with the FXCM API. - Network connectivity to FXCM's API endpoints is necessary.
Troubleshooting
Common issues:
- Invalid or expired API credentials will cause authentication failures.
- Providing an incorrect or non-existent
positionIdwill result in errors indicating the position cannot be found or closed. - Network issues may cause timeouts or connection errors.
Error messages and resolutions:
"Authentication failed": Verify that the API key/token is correct and has not expired."Position not found": Check that thepositionIdis valid and corresponds to an open position."Network error": Ensure stable internet connection and that FXCM API endpoints are reachable.
Using the node’s "Continue On Fail" option can help workflows proceed even if closing a position fails, allowing error handling downstream.
Links and References
- FXCM API Documentation
- n8n Documentation on Credentials
- n8n Community Forum for troubleshooting and examples