Gainium icon

Gainium

Operates with official Gainium API

Overview

This node operation allows you to reduce funds from a specific deal managed by the Gainium trading platform via its official API. It is useful in scenarios where you want to decrease the amount of capital allocated to an active trading deal, either partially or by a certain percentage, without closing the deal entirely.

Practical examples include:

  • Adjusting risk exposure by reducing the invested quantity in a deal.
  • Managing portfolio allocation dynamically based on market conditions.
  • Testing strategies in paper trading mode by simulating fund reductions.

Properties

Name Meaning
Bot Id ID of the bot associated with the deal for which funds will be reduced.
Deal Id (Optional) ID of the specific deal to reduce funds from.
Symbol (Optional) Trading pair symbol (e.g., BTC/USDT) related to the deal.
Quantity Amount of funds to reduce from the deal.
Qty Type Whether the quantity is a fixed amount ("Fixed") or a percentage ("Percentage") of the current funds.
Asset Type of asset to reduce funds from: either the base currency or the quote currency of the trading pair.
Paper Boolean flag indicating whether to perform the operation in paper trading mode (simulated) or real trading mode.
Please refer to official documentation of Gainium API for request formats. Notice property reminding users to consult the official Gainium API documentation for detailed request format information.

Output

The output JSON contains the response data from the Gainium API after attempting to reduce funds from the specified deal. The structure typically includes confirmation details about the updated deal state or error messages if the operation failed.

No binary data output is produced by this operation.

Example output structure (simplified):

{
  "data": {
    "dealId": "string",
    "botId": "string",
    "qtyReduced": "number",
    "asset": "base|quote",
    "symbol": "string",
    "type": "fixed|perc",
    "paperContext": true|false,
    "status": "success|failed",
    "message": "string"
  }
}

Dependencies

  • Requires an API key credential for authenticating with the Gainium API.
  • The node uses HMAC SHA-256 signing for request authentication.
  • Network access to the Gainium API endpoint configured in the credentials.
  • Proper configuration of the Gainium API base URL and token in n8n credentials.

Troubleshooting

  • Common issues:

    • Invalid or missing API credentials leading to authentication errors.
    • Incorrect deal or bot IDs causing "not found" errors.
    • Providing invalid quantity values or types may cause request rejection.
    • Using real trading mode without sufficient funds or permissions.
    • Network connectivity problems preventing API communication.
  • Error messages:

    • Error: <reason> — Generic API error returned by Gainium; check the reason message for specifics.
    • HMAC generation failed: Web Crypto API not available — Indicates environment does not support required cryptographic functions; ensure running in supported environment.
    • Operation Reduce Funds From Deal is not supported — Occurs if operation name is incorrect or unsupported; verify operation selection.
    • JSON parsing errors when inputting complex parameters (not typical for this operation but possible in others).
  • Resolutions:

    • Verify API credentials and permissions.
    • Double-check all input parameters for correctness.
    • Use paper trading mode for testing before applying changes to live deals.
    • Ensure n8n environment supports Web Crypto API or use compatible runtime.

Links and References


This summary focuses exclusively on the "Reduce Funds From Deal" operation within the "Deals" resource of the Gainium node as requested.

Discussion