Package Information
Available Nodes
Documentation
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)
- In n8n, go to Settings ā Community Nodes
- Click Install
- Enter package name:
n8n-nodes-bitget-futures - Click Install
Option B ā Manual (this ZIP)
Copy this folder to your n8n custom extensions directory:
~/.n8n/custom/So the path becomes:
~/.n8n/custom/n8n-nodes-bitget-futures/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
- In n8n go to Credentials ā New Credential ā Bitget Futures API
- 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) orLive(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-FUTURESMargin Coinā USDT, USDC, or base coinSymbol(optional) ā restrict to one trading pair (e.g.BTCUSDT), empty = ALLHold Side(hedge mode) ā Both / Long only / Short onlyContinue 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:
- Credential level ā set a default in the API credential
- Node level ā per-node override via
Trading Environmentdropdown
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 keyACCESS-SIGNā computed signatureACCESS-TIMESTAMPā Unix ms timestampACCESS-PASSPHRASEā your API passphraseContent-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.