Actions23
- General Actions
- Bots Actions
- Deals Actions
- User Actions
Overview
This node operation updates an existing DCA (Dollar-Cost Averaging) deal on the Gainium platform via its official API. It allows users to modify various parameters of a DCA deal such as order count, take profit and stop loss percentages, average price, order size, trailing settings, multi-target stop loss/take profit configurations, and other advanced deal management options.
Typical use cases include:
- Adjusting active DCA deals dynamically based on market conditions.
- Modifying risk management parameters like stop loss or take profit levels.
- Changing volume scaling or step sizes for ongoing DCA strategies.
- Enabling or disabling features like trailing stop loss or smart orders within a deal.
For example, a trader might update a DCA deal to increase the number of orders or adjust the stop loss percentage after analyzing recent market volatility.
Properties
| Name | Meaning |
|---|---|
| Paper Trading | Boolean flag indicating whether the operation should be performed in paper trading mode (simulated) or real trading mode. |
| Deal Id | The unique identifier of the DCA deal that you want to update. |
| Deal Settings | A JSON object containing all the settings for the DCA deal to be updated. This includes multiple configurable fields such as: - ordersCount: Number of orders.- tpPerc, slPerc: Take profit and stop loss percentages.- profitCurrency: Currency type for profit.- avgPrice: Average price.- orderSize: Size of each order.- Flags like useTp, useSl, useDca, useSmartOrders.- Counts like activeOrdersCount.- Scaling factors like volumeScale, stepScale.- Conditions for closing the deal ( dealCloseConditionSL, dealCloseCondition).- Multi stop loss and take profit arrays with targets and amounts. - Trailing stop loss and take profit settings. - DCA condition type and custom steps. Refer to the official Gainium API documentation for detailed format and valid values. |
Output
The output is a JSON object representing the response from the Gainium API after updating the DCA deal. Typically, this will contain confirmation of the update, the updated deal details, or error information if the update failed.
The exact structure depends on the API response but generally includes:
- Status indicators.
- Updated deal data reflecting the new settings.
- Possible error messages if the update was unsuccessful.
No binary data output is produced by this operation.
Dependencies
- Requires an API key credential for authenticating with the Gainium API.
- The node uses HMAC SHA-256 signing for request authentication.
- Requires network access to the Gainium API endpoint specified in the credentials.
- The user must have write permissions enabled on their API key to perform update operations.
- Proper configuration of the "paper trading" context is necessary depending on whether the user wants to affect live or simulated deals.
Troubleshooting
Common Issues:
- Invalid JSON in the "Deal Settings" property can cause parsing errors. Ensure the JSON is well-formed and matches the expected schema.
- Insufficient API permissions (missing write access) will result in authorization errors.
- Incorrect or expired API keys will cause authentication failures.
- Using a wrong or non-existent Deal Id will lead to errors indicating the deal cannot be found.
- Network connectivity issues may prevent successful API calls.
Error Messages:
"Error: <reason>"— Generic error returned from the API; check the reason message for specifics."HMAC generation failed: Web Crypto API not available"— Indicates the environment does not support required cryptographic functions.- JSON parsing errors when the "Deal Settings" input is malformed.
Resolutions:
- Validate and test the JSON input before running the node.
- Verify API key permissions and renew keys if expired.
- Confirm the Deal Id exists and belongs to the authenticated user.
- Check network connectivity and proxy/firewall settings.
- Ensure the runtime environment supports Web Crypto API for signature generation.
Links and References
- Gainium Official API Documentation (Please refer to the official Gainium API docs for detailed request formats and parameter descriptions.)
- n8n Documentation on HTTP Request Node (for understanding how HTTP requests are made)
- Understanding Dollar-Cost Averaging (DCA) (general concept explanation)