🚀 Automate Your Hedge Strategy Deployment with n8n

Hey everyone,

I just built a new n8n automation templateusing our new Gainium n8n community node integration to help you deploy hedge strategies faster and more reliably. It’s modular, easy to tweak, and includes 3 main components:


:brain: 1. The Chat

This is your control panel. It lets you:

  • Start a new strategy for any token by adding the first base order to the base tracker.
  • Replenish base using the add funds function when your base dips.
  • Clone long and short templates to start the hedge strategy for that token automatically.

Think of this as your manual trigger zone for one-off or new pair deployments.


:clipboard: 2. The Pairs List

This is the automation powerhouse.

  • Drop in a list of token pairs.
  • The template will automatically run all 3 actions for each pair: add base, fund, and start hedge.
  • Useful for scaling across multiple tokens without doing it one by one.

Set it and let it run across the board.


:chart_with_upwards_trend: 3. The Profit Tracker

This is a scheduled task that:

  • Queries available (free) USDT daily on both the long and short exchanges.
  • Tracks your capital allocation and helps measure strategy performance over time.

Great for visibility without needing to log in and check manually.


New video coming up soon.

Happy hedging :shield:

Download n8n template

Hedge_Automation.json (26.6 KB)

3 Likes

Hope to see video tutorials or demos for this someday. :slight_smile:

Made it work in the end - there is an error after duplicating around 7 bots

Problem in node ‘Start new deal1‘
429 - "Too many requests, please try again later."

tried multiple time but the system won’t let n8n bulk creating bots atm

@maksym.shamko is it something from your end or do I need to add a cooldown between actions so there is a bit of time in between?

429 is a rate limit error, we have a limit of 60 requests per minute. In the response headers you should be able to see left requests and timestamp when the limits will reset.

I think the limit is 50 requests per minute

if that’s the case this workflow can’t be used unless we add a cooldown and split the workflow in parts

I guess the workflow would require a rate limiter on its side as well to not hit the rate limit of the API.

Yes, sorry 50

May I ask you how requests are count? is it every action sent to Gainium from an external resource or also those actions performed internally by gainium inside gainium (for example any running bots actions)? thanks

Usually every API call is a single request.

Every API call indeed

Yes a wait node should be added to avoid rate limits, also it needs a wait of 1 second after adding the pair and starting a deal, as I’ve encountered that without that little delay it may try to open the deal before the bot has finished saving the new pair. I will post an updated version of the workflow soon.

Yes I also added a log report which basically sits at the end of the task before looping - it just tells you what bots have been duplicated and what coins have been bought.

I added this because sometimes it just stops either because you click somewhere or because of the connection breaks - then you can look at the log and restart from where it left

@maksym.shamko when duplicating the bots using n8n for some reasons the global variables aren’t copied but replaced with the actual value

@aressanch tried everything but for some reasons the workflow now doesn’t duplicate the SHORT bot anymore


Have you replaced bot id in clone long and clone short?
I have no problem from my side to clone template bots.

yes - checked everything - the day before worked amazingly the day after stopped working - I can paste the whole text error

I also reduce the workflow down to just duplicating the bots to see where the error was but even though only the long is duplicated - very odd

Wondered if has anything to do with the enterprise plan?

If you can plase paste whole error, to see where it occurs

{
  "errorMessage": "Error: [object Object]",
  "errorDetails": {},
  "n8nDetails": {
    "n8nVersion": "1.64.3 (Self Hosted)",
    "binaryDataMode": "default",
    "stackTrace": [
      "Error: Error: [object Object]",
      "    at Object.execute (/Users/rossano/.n8n/nodes/node_modules/n8n-nodes-gainium/dist/nodes/Gainium/Gainium.node.js:1352:27)",
      "    at processTicksAndRejections (node:internal/process/task_queues:95:5)",
      "    at Workflow.runNode (/opt/homebrew/lib/node_modules/n8n/node_modules/n8n-workflow/src/Workflow.ts:1382:8)",
      "    at /opt/homebrew/lib/node_modules/n8n/node_modules/n8n-core/src/WorkflowExecute.ts:1167:27",
      "    at /opt/homebrew/lib/node_modules/n8n/node_modules/n8n-core/src/WorkflowExecute.ts:1887:11"
    ]
  }
}

Can you send bot ids you are using as templates?

would the bot id work only with my API (AKA account)?
If I use your bot ID above would I be able to copy your bot?