Actions16
- Account Actions
- Trading Actions
- Market Data Actions
Overview
This node integrates with the FXCM trading platform to perform various trading-related operations. Specifically, for the Account resource and the Close Position operation, it allows users to close an existing open trading position on FXCM.
Common scenarios where this node is beneficial include:
- Automated trading workflows that need to programmatically close positions based on certain conditions or signals.
- Risk management strategies that require closing positions when stop-loss or take-profit levels are reached.
- Portfolio rebalancing by closing specific positions without manual intervention.
For example, a user might set up a workflow that monitors market data and automatically closes a position in EUR/USD when a target profit is achieved.
Properties
| Name | Meaning |
|---|---|
| Instrument | Trading instrument to get data for (e.g., "EUR/USD") |
Note: Although the provided properties JSON only lists "Instrument", the Close Position operation actually requires a positionId parameter internally (not exposed in the given properties). This means the node expects the unique identifier of the position to close, which must be supplied in the node parameters.
Output
The output of the node is a JSON object representing the result of the close position request returned from the FXCM API client. This typically includes details about the closed position such as its ID, status, and any relevant trade information confirming the closure.
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:00:00Z"
}
Dependencies
- Requires an active FXCM API credential configured in n8n to authenticate requests.
- Depends on the internal
FxcmClientclass to communicate with the FXCM API. - The node disconnects from the FXCM service after execution to clean up resources.
Troubleshooting
- Missing or invalid position ID: Since the close position operation requires a valid position identifier, failure to provide this or providing an incorrect one will cause errors. Ensure the correct position ID is passed.
- API authentication errors: If the FXCM API credentials are missing, expired, or invalid, the node will fail to connect. Verify the API key and permissions.
- Network or connectivity issues: Temporary network failures can cause the node to throw errors. Retrying the operation may help.
- Error messages: Errors thrown by the FXCM API client are caught; if "Continue On Fail" is enabled, they appear in the output JSON under an
errorfield. Otherwise, the node execution stops with the error.