npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

n8n-nodes-bitget-f-close

v1.1.1

Published

n8n custom node for Bitget Futures — Flash Close All (positions + orders + TP/SL)

Downloads

304

Readme

n8n-nodes-bitget-futures

A custom n8n community node for Bitget Futures trading — featuring a Flash Close All operation that closes every open position and cancels every order (including TP/SL) in a single node execution, just like Bitget's own "Flash Close" button.


📦 Installation

Option A — n8n Community Nodes (Recommended)

  1. In n8n, go to Settings → Community Nodes
  2. Click Install
  3. Enter package name: n8n-nodes-bitget-futures
  4. Click Install

Option B — Manual (this ZIP)

  1. Copy this folder to your n8n custom extensions directory:

    ~/.n8n/custom/

    So the path becomes: ~/.n8n/custom/n8n-nodes-bitget-futures/

  2. Restart n8n. The Bitget Futures node will appear in the node palette.

Option C — Docker

Mount the folder as a volume and set the env var:

environment:
  - N8N_CUSTOM_EXTENSIONS=/home/node/.n8n/custom
volumes:
  - ./n8n-nodes-bitget-futures:/home/node/.n8n/custom/n8n-nodes-bitget-futures

🔑 Credentials Setup

  1. In n8n go to Credentials → New Credential → Bitget Futures API
  2. Fill in:
    • API Key — from Bitget API management page
    • Secret Key — your API secret
    • Passphrase — the passphrase you set when creating the key
    • Trading Environment — choose Demo (safe) or Live (real money)

⚠️ Always test with Demo first! Live trading uses real funds.

API Key Permissions Required

  • Trade — required for all order/position operations
  • Read — required for fetching positions

⚙️ Operations

⚡ Flash Close All — Positions + Orders + TP/SL (Main Feature)

Executes a full account nuke in 3 sequential steps:

| Step | API Endpoint | What it does | |------|-------------|--------------| | 1 | POST /api/v2/mix/order/cancel-all-orders | Cancels ALL regular open limit/market orders | | 2 | POST /api/v2/mix/order/cancel-plan-order | Cancels ALL TP/SL plan orders (per-symbol, auto-detected from positions) | | 3 | POST /api/v2/mix/order/close-positions | Flash-closes ALL open positions at market price |

Parameters:

  • Product Type — USDT-FUTURES / COIN-FUTURES / USDC-FUTURES
  • Margin Coin — USDT, USDC, or base coin
  • Symbol (optional) — restrict to one trading pair (e.g. BTCUSDT), empty = ALL
  • Hold Side (hedge mode) — Both / Long only / Short only
  • Continue on Partial Failure — if true, continues even if one step errors

Returns:

{
  "environment": "DEMO",
  "productType": "SUSDT-FUTURES",
  "symbol": "ALL",
  "overallStatus": "success",
  "cancelAllOrders": { "status": "success", "data": {...} },
  "cancelTpslOrders": { "status": "success", "data": [...] },
  "flashClosePositions": { "status": "success", "data": {...} },
  "timestamp": "2024-01-15T10:30:00.000Z"
}

Flash Close Positions Only

Closes all open positions at market price without touching pending orders.

  • Endpoint: POST /api/v2/mix/order/close-positions

Cancel All Open Orders

Cancels all regular limit/market orders (not plan/TP/SL orders).

  • Endpoint: POST /api/v2/mix/order/cancel-all-orders

Cancel All TP/SL Plan Orders

Cancels all take-profit and stop-loss plan orders.

  • Endpoint: POST /api/v2/mix/order/cancel-plan-order
  • Auto-fetches open positions to determine which symbols to target

Get All Open Positions

Returns a full list of currently open futures positions.

  • Endpoint: GET /api/v2/mix/position/all-position

🌍 Demo vs Live Environment

The environment can be set in two places:

  1. Credential level — set a default in the API credential
  2. Node level — per-node override via Trading Environment dropdown

The node-level setting wins over the credential setting (unless set to "Use Credential Setting").

How Demo Works

Bitget uses separate product type prefixes for demo accounts:

| Live | Demo | |------------------|-------------------| | USDT-FUTURES | SUSDT-FUTURES | | COIN-FUTURES | SCOIN-FUTURES | | USDC-FUTURES | SUSDC-FUTURES |

The node automatically maps product types when demo mode is active — you always select the "live" name and it converts internally.


🔐 Authentication (Technical)

Bitget uses HMAC-SHA256 signed requests:

Signature = Base64(HMAC-SHA256(timestamp + METHOD + path + body, secretKey))

Headers required on every request:

  • ACCESS-KEY — your API key
  • ACCESS-SIGN — computed signature
  • ACCESS-TIMESTAMP — Unix ms timestamp
  • ACCESS-PASSPHRASE — your API passphrase
  • Content-Type: application/json

All signing is handled automatically by the node.


📁 File Structure

n8n-nodes-bitget-futures/
├── package.json                          # npm package manifest + n8n registration
├── tsconfig.json                         # TypeScript config
├── README.md                             # This file
├── src/                                  # TypeScript source
│   ├── index.ts
│   ├── credentials/
│   │   └── BitgetFuturesApi.credentials.ts
│   └── nodes/
│       └── BitgetFutures/
│           ├── BitgetFutures.node.ts     # Main node logic
│           ├── bitgetApi.ts              # API signing + request helper
│           └── bitget.svg                # Node icon
└── dist/                                 # Pre-compiled JavaScript (ready to use)
    ├── index.js
    ├── credentials/
    │   └── BitgetFuturesApi.credentials.js
    └── nodes/
        └── BitgetFutures/
            ├── BitgetFutures.node.js
            ├── bitgetApi.js
            └── bitget.svg

🔧 Building from Source (Optional)

If you want to modify the TypeScript source and rebuild:

npm install
npm run build

Requires Node.js 18+ and TypeScript 5+.


⚠️ Disclaimer

This node is provided as-is for automation purposes. Futures trading involves significant financial risk. Always test with the Demo environment before using with real funds. The authors are not responsible for any trading losses.