@bitget-ai/bitget-agent-skill 1.2.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,429 +0,0 @@
1
- # futures_place_order — Futures Place Order
2
-
3
- ## Official Description
4
- Place one or more futures perpetual contract orders with optional take-profit/stop-loss presets. Supports both one-way and hedge position modes.
5
-
6
- **Endpoint:** `POST /api/v2/mix/order/place-order` (single) | `POST /api/v2/mix/order/batch-place-order` (batch)
7
- **Auth required:** Yes
8
- **Rate limit:** 10 req/s per UID; batch: 5 req/s
9
-
10
- ---
11
-
12
- ## ⚠️ CRITICAL: How to Close a Position
13
-
14
- **The most common mistake is using the wrong `side` when closing.** The rule is:
15
-
16
- | To close... | Use `side` | Why |
17
- |-------------|------------|-----|
18
- | Close a **long** | `sell` | You bought to open, you sell to close |
19
- | Close a **short** | `buy` | You sold to open, you buy to close |
20
-
21
- **Never use `sell` to close a short — that opens MORE short, it does not close it.**
22
-
23
- ### One-Way Mode Close (use `reduceOnly`)
24
-
25
- ```bash
26
- # Close LONG: side=sell + reduceOnly=YES
27
- bgc futures futures_place_order --orders '[{
28
- "symbol": "BTCUSDT", "productType": "USDT-FUTURES",
29
- "marginMode": "crossed", "marginCoin": "USDT",
30
- "side": "sell", "orderType": "market", "force": "gtc",
31
- "size": "0.01", "reduceOnly": "YES"
32
- }]'
33
-
34
- # Close SHORT: side=buy + reduceOnly=YES
35
- bgc futures futures_place_order --orders '[{
36
- "symbol": "BTCUSDT", "productType": "USDT-FUTURES",
37
- "marginMode": "crossed", "marginCoin": "USDT",
38
- "side": "buy", "orderType": "market", "force": "gtc",
39
- "size": "0.01", "reduceOnly": "YES"
40
- }]'
41
- ```
42
-
43
- > `reduceOnly=YES` is essential — it prevents the order from accidentally flipping into an opposite position if the size exceeds what you hold.
44
-
45
- ### Hedge Mode Close (use `tradeSide=close`)
46
-
47
- ```bash
48
- # Close LONG in hedge mode: side=sell + tradeSide=close
49
- bgc futures futures_place_order --orders '[{
50
- "symbol": "BTCUSDT", "productType": "USDT-FUTURES",
51
- "marginMode": "crossed", "marginCoin": "USDT",
52
- "side": "sell", "tradeSide": "close",
53
- "orderType": "market", "force": "gtc", "size": "0.01"
54
- }]'
55
-
56
- # Close SHORT in hedge mode: side=buy + tradeSide=close
57
- bgc futures futures_place_order --orders '[{
58
- "symbol": "BTCUSDT", "productType": "USDT-FUTURES",
59
- "marginMode": "crossed", "marginCoin": "USDT",
60
- "side": "buy", "tradeSide": "close",
61
- "orderType": "market", "force": "gtc", "size": "0.01"
62
- }]'
63
- ```
64
-
65
- ---
66
-
67
- ## ⚠️ CRITICAL: TP/SL Without Plan Orders
68
-
69
- **There is no `futures_place_plan_order` in the bgc CLI.** The options are:
70
-
71
- 1. **Preset TP/SL on the entry order** — `presetStopSurplusPrice` / `presetStopLossPrice` set at order placement
72
- 2. **Add/modify TP/SL after placement** — `futures_modify_order` with `newPresetStopSurplusPrice` / `newPresetStopLossPrice`; does **not** cancel the order; pass `"0"` to delete
73
- 3. **Manual limit order with `reduceOnly=YES`** — place a separate limit close order at your target price
74
-
75
- ### TP/SL Preset (set when opening position)
76
-
77
- ```bash
78
- # Open long with TP at 72000 and SL at 61000
79
- bgc futures futures_place_order --orders '[{
80
- "symbol": "BTCUSDT", "productType": "USDT-FUTURES",
81
- "marginMode": "crossed", "marginCoin": "USDT",
82
- "side": "buy", "orderType": "limit", "force": "gtc",
83
- "price": "65000", "size": "0.01",
84
- "presetStopSurplusPrice": "72000",
85
- "presetStopLossPrice": "61000"
86
- }]'
87
- ```
88
-
89
- > Presets are trigger prices. The position closes at market once the mark price hits the trigger.
90
-
91
- ### Manual TP: Limit Close Order with reduceOnly
92
-
93
- ```bash
94
- # Already holding a long. Place a take-profit limit sell at 72000.
95
- bgc futures futures_place_order --orders '[{
96
- "symbol": "BTCUSDT", "productType": "USDT-FUTURES",
97
- "marginMode": "crossed", "marginCoin": "USDT",
98
- "side": "sell", "orderType": "limit", "force": "gtc",
99
- "price": "72000", "size": "0.01",
100
- "reduceOnly": "YES"
101
- }]'
102
- ```
103
-
104
- > This rests as a pending limit order in the book. When price hits 72000, it fills and closes the long.
105
-
106
- ### Manual SL: Limit Close Order with reduceOnly
107
-
108
- ```bash
109
- # Already holding a long. Place a stop-loss limit sell at 61000.
110
- bgc futures futures_place_order --orders '[{
111
- "symbol": "BTCUSDT", "productType": "USDT-FUTURES",
112
- "marginMode": "crossed", "marginCoin": "USDT",
113
- "side": "sell", "orderType": "limit", "force": "gtc",
114
- "price": "61000", "size": "0.01",
115
- "reduceOnly": "YES"
116
- }]'
117
- ```
118
-
119
- > ⚠️ A limit SL may not fill in a fast-moving market — it can be skipped if price gaps through. For hard stops, prefer the `presetStopLossPrice` preset (market execution on trigger).
120
-
121
- ---
122
-
123
- ## bgc CLI Usage
124
-
125
- ```bash
126
- bgc futures futures_place_order --orders '<JSON array>'
127
- ```
128
-
129
- ---
130
-
131
- ## Order Object Parameters
132
-
133
- | Parameter | Type | Required | Allowed Values | Description |
134
- |-----------|------|----------|----------------|-------------|
135
- | `symbol` | string | Yes | e.g. `BTCUSDT` | Contract symbol (uppercase) |
136
- | `productType` | string | Yes | `USDT-FUTURES`, `COIN-FUTURES`, `USDC-FUTURES` | Contract product type |
137
- | `marginMode` | string | Yes | `isolated`, `crossed` | Margin mode for this order |
138
- | `marginCoin` | string | Yes | e.g. `USDT`, `BTC` | Collateral coin (must match productType) |
139
- | `size` | string | Yes | e.g. `"0.01"` | Order size in base coin |
140
- | `price` | string | Conditional | e.g. `"65000"` | Required for limit orders |
141
- | `side` | string | Yes | `buy`, `sell` | Order direction (see close table above) |
142
- | `tradeSide` | string | Conditional | `open`, `close` | **Hedge mode only** — omit in one-way mode |
143
- | `orderType` | string | Yes | `limit`, `market` | Order type |
144
- | `force` | string | Conditional | `gtc`, `ioc`, `fok`, `post_only` | Required for limit orders; default `gtc` |
145
- | `clientOid` | string | No | e.g. `"fut-001"` | Custom order ID |
146
- | `reduceOnly` | string | No | `YES`, `NO` (default) | **One-way mode only**: ensures order only reduces/closes position |
147
- | `presetStopSurplusPrice` | string | No | e.g. `"70000"` | Take-profit trigger price (mark price) |
148
- | `presetStopSurplusExecutePrice` | string | No | e.g. `"69900"` | TP execution price (limit); omit for market TP |
149
- | `presetStopLossPrice` | string | No | e.g. `"60000"` | Stop-loss trigger price (mark price) |
150
- | `presetStopLossExecutePrice` | string | No | e.g. `"59900"` | SL execution price (limit); omit for market SL |
151
- | `stpMode` | string | No | `none`, `cancel_taker`, `cancel_maker`, `cancel_both` | Self-trade prevention |
152
-
153
- ---
154
-
155
- ## Position Mode Logic
156
-
157
- ### One-Way Mode (default for most accounts)
158
-
159
- `tradeSide` is **NOT used** in one-way mode — omit it entirely. Use `side` + `reduceOnly`:
160
-
161
- | Action | `side` | `reduceOnly` |
162
- |--------|--------|--------------|
163
- | Open long | `buy` | `NO` (or omit) |
164
- | Open short | `sell` | `NO` (or omit) |
165
- | Close long | `sell` | `YES` |
166
- | Close short | `buy` | `YES` |
167
-
168
- ### Hedge Mode
169
-
170
- `tradeSide` is **required** in hedge mode. Do NOT use `reduceOnly`:
171
-
172
- | Action | `side` | `tradeSide` |
173
- |--------|--------|-------------|
174
- | Open long | `buy` | `open` |
175
- | Open short | `sell` | `open` |
176
- | Close long | `sell` | `close` |
177
- | Close short | `buy` | `close` |
178
-
179
- > **How to check your mode:** `bgc futures futures_get_positions --productType USDT-FUTURES --symbol BTCUSDT` — look at `posMode` field: `one_way_mode` or `hedge_mode`.
180
-
181
- ---
182
-
183
- ## Common Errors and Fixes
184
-
185
- | Error | Cause | Fix |
186
- |-------|-------|-----|
187
- | "No position to close" / "position not found" | Wrong `side` direction for close, or wrong mode params | Check `holdSide` in positions; use the close table above |
188
- | "Type mismatch" / parameter error | Using `tradeSide` in one-way mode, or omitting it in hedge mode | Check your `posMode` first; match params to mode |
189
- | "Insufficient balance" on close order | Order was interpreted as an **open** (not a close), consuming margin | Add `reduceOnly=YES` (one-way) or `tradeSide=close` (hedge) |
190
- | Close order turns into open | No `reduceOnly` or wrong `tradeSide` | Always add close protection params |
191
- | TP/SL not triggered | `presetStopSurplusPrice` / `presetStopLossPrice` are trigger prices vs **mark price** | Verify mark price direction matches trigger |
192
-
193
- ---
194
-
195
- ## Response Fields
196
-
197
- | Field | Type | Description |
198
- |-------|------|-------------|
199
- | `orderId` | string | Exchange-assigned order ID |
200
- | `clientOid` | string | Your custom order ID |
201
-
202
- ---
203
-
204
- ## Usage Cases
205
-
206
- ### Case 1: Open long — limit order (one-way mode)
207
- ```bash
208
- bgc futures futures_place_order --orders '[{
209
- "symbol": "BTCUSDT",
210
- "productType": "USDT-FUTURES",
211
- "marginMode": "crossed",
212
- "marginCoin": "USDT",
213
- "side": "buy",
214
- "orderType": "limit",
215
- "force": "gtc",
216
- "price": "65000",
217
- "size": "0.01"
218
- }]'
219
- ```
220
-
221
- ### Case 2: Open short — limit order (one-way mode)
222
- ```bash
223
- bgc futures futures_place_order --orders '[{
224
- "symbol": "BTCUSDT",
225
- "productType": "USDT-FUTURES",
226
- "marginMode": "crossed",
227
- "marginCoin": "USDT",
228
- "side": "sell",
229
- "orderType": "limit",
230
- "force": "gtc",
231
- "price": "68000",
232
- "size": "0.01"
233
- }]'
234
- ```
235
-
236
- ### Case 3: Open short — with preset TP/SL at entry
237
- ```bash
238
- bgc futures futures_place_order --orders '[{
239
- "symbol": "BTCUSDT",
240
- "productType": "USDT-FUTURES",
241
- "marginMode": "isolated",
242
- "marginCoin": "USDT",
243
- "side": "sell",
244
- "orderType": "limit",
245
- "force": "gtc",
246
- "price": "67000",
247
- "size": "0.01",
248
- "presetStopSurplusPrice": "63000",
249
- "presetStopLossPrice": "70000"
250
- }]'
251
- ```
252
- > Short at $67,000. TP at $63,000 (price falls = profit). SL at $70,000 (price rises = loss protected).
253
- > The close direction (`buy`) is handled automatically by the preset — you do not specify it.
254
-
255
- ### Case 4: Close long — market (one-way mode)
256
- ```bash
257
- bgc futures futures_place_order --orders '[{
258
- "symbol": "BTCUSDT",
259
- "productType": "USDT-FUTURES",
260
- "marginMode": "crossed",
261
- "marginCoin": "USDT",
262
- "side": "sell",
263
- "orderType": "market",
264
- "force": "gtc",
265
- "size": "0.01",
266
- "reduceOnly": "YES"
267
- }]'
268
- ```
269
-
270
- ### Case 5: Close short — market (one-way mode)
271
- ```bash
272
- bgc futures futures_place_order --orders '[{
273
- "symbol": "BTCUSDT",
274
- "productType": "USDT-FUTURES",
275
- "marginMode": "crossed",
276
- "marginCoin": "USDT",
277
- "side": "buy",
278
- "orderType": "market",
279
- "force": "gtc",
280
- "size": "0.01",
281
- "reduceOnly": "YES"
282
- }]'
283
- ```
284
- > **Short = opened with `sell`. To close: `buy` + `reduceOnly=YES`.**
285
-
286
- ### Case 6: Place TP + SL as separate limit orders after opening (one-way mode)
287
- ```bash
288
- # Assume holding 0.01 BTC long. Place both orders simultaneously.
289
-
290
- # Take-profit at 72000
291
- bgc futures futures_place_order --orders '[{
292
- "symbol": "BTCUSDT", "productType": "USDT-FUTURES",
293
- "marginMode": "crossed", "marginCoin": "USDT",
294
- "side": "sell", "orderType": "limit", "force": "gtc",
295
- "price": "72000", "size": "0.01", "reduceOnly": "YES"
296
- }]'
297
-
298
- # Stop-loss at 61000
299
- bgc futures futures_place_order --orders '[{
300
- "symbol": "BTCUSDT", "productType": "USDT-FUTURES",
301
- "marginMode": "crossed", "marginCoin": "USDT",
302
- "side": "sell", "orderType": "limit", "force": "gtc",
303
- "price": "61000", "size": "0.01", "reduceOnly": "YES"
304
- }]'
305
- ```
306
- > Both orders have `reduceOnly=YES` so they won't add to position. Whichever fills first, the system will auto-cancel the other (if it would exceed available position size).
307
-
308
- ### Case 7: Hedge mode — open long
309
- ```bash
310
- bgc futures futures_place_order --orders '[{
311
- "symbol": "ETHUSDT",
312
- "productType": "USDT-FUTURES",
313
- "marginMode": "crossed",
314
- "marginCoin": "USDT",
315
- "side": "buy",
316
- "tradeSide": "open",
317
- "orderType": "limit",
318
- "force": "gtc",
319
- "price": "3200",
320
- "size": "1"
321
- }]'
322
- ```
323
-
324
- ### Case 8: Hedge mode — close short
325
- ```bash
326
- bgc futures futures_place_order --orders '[{
327
- "symbol": "ETHUSDT",
328
- "productType": "USDT-FUTURES",
329
- "marginMode": "crossed",
330
- "marginCoin": "USDT",
331
- "side": "buy",
332
- "tradeSide": "close",
333
- "orderType": "market",
334
- "force": "gtc",
335
- "size": "1"
336
- }]'
337
- ```
338
- > Closing a short uses `side=buy` + `tradeSide=close`. Do NOT use `reduceOnly` in hedge mode.
339
-
340
- ### Case 9: COIN-margined (inverse) — open long BTC
341
- ```bash
342
- bgc futures futures_place_order --orders '[{
343
- "symbol": "BTCUSD",
344
- "productType": "COIN-FUTURES",
345
- "marginMode": "crossed",
346
- "marginCoin": "BTC",
347
- "side": "buy",
348
- "orderType": "market",
349
- "force": "gtc",
350
- "size": "1"
351
- }]'
352
- ```
353
-
354
- ### Case 10: Full TP/SL preset with execution prices
355
- ```bash
356
- bgc futures futures_place_order --orders '[{
357
- "symbol": "BTCUSDT",
358
- "productType": "USDT-FUTURES",
359
- "marginMode": "isolated",
360
- "marginCoin": "USDT",
361
- "side": "buy",
362
- "orderType": "limit",
363
- "force": "gtc",
364
- "price": "65000",
365
- "size": "0.01",
366
- "presetStopSurplusPrice": "72000",
367
- "presetStopSurplusExecutePrice": "71900",
368
- "presetStopLossPrice": "61000",
369
- "presetStopLossExecutePrice": "60900"
370
- }]'
371
- ```
372
- > `presetStopSurplusExecutePrice` / `presetStopLossExecutePrice` set execution as limit prices.
373
- > Omit them to execute at market price when trigger is hit.
374
-
375
- ---
376
-
377
- ## Step-by-Step: Open and Manage a Position (One-Way Mode)
378
-
379
- ```bash
380
- # Step 1: Check current position mode
381
- bgc futures futures_get_positions --productType USDT-FUTURES --symbol BTCUSDT
382
- # Look for posMode: "one_way_mode"
383
-
384
- # Step 2: Open long with preset TP/SL
385
- bgc futures futures_place_order --orders '[{
386
- "symbol": "BTCUSDT", "productType": "USDT-FUTURES",
387
- "marginMode": "crossed", "marginCoin": "USDT",
388
- "side": "buy", "orderType": "limit", "force": "gtc",
389
- "price": "65000", "size": "0.01",
390
- "presetStopSurplusPrice": "72000",
391
- "presetStopLossPrice": "61000"
392
- }]'
393
-
394
- # Step 3: (Optional) Add additional TP limit order
395
- bgc futures futures_place_order --orders '[{
396
- "symbol": "BTCUSDT", "productType": "USDT-FUTURES",
397
- "marginMode": "crossed", "marginCoin": "USDT",
398
- "side": "sell", "orderType": "limit", "force": "gtc",
399
- "price": "72000", "size": "0.01", "reduceOnly": "YES"
400
- }]'
401
-
402
- # Step 4: Emergency close at market
403
- bgc futures futures_place_order --orders '[{
404
- "symbol": "BTCUSDT", "productType": "USDT-FUTURES",
405
- "marginMode": "crossed", "marginCoin": "USDT",
406
- "side": "sell", "orderType": "market", "force": "gtc",
407
- "size": "0.01", "reduceOnly": "YES"
408
- }]'
409
- ```
410
-
411
- ---
412
-
413
- ## Important Notes
414
-
415
- - `marginMode` and `marginCoin` must be on every order
416
- - For `USDT-FUTURES`: `marginCoin=USDT`; for `COIN-FUTURES`: `marginCoin` = base coin (e.g., `BTC`)
417
- - **Do NOT mix `tradeSide` and `reduceOnly`** — use one or the other depending on position mode
418
- - `tradeSide` is only valid in hedge mode; using it in one-way mode causes parameter errors
419
- - `reduceOnly` is only valid in one-way mode; in hedge mode use `tradeSide=close`
420
- - Preset TP/SL prices trigger against **mark price**, not last trade price
421
- - There is no `futures_place_plan_order` in bgc — use presets or manual limit orders with `reduceOnly`
422
- - In one-way mode, multiple `reduceOnly` orders are allowed; they auto-cancel if combined size exceeds position
423
- - Set leverage before trading: `bgc futures futures_set_leverage ...`
424
-
425
- ---
426
-
427
- ## Official Docs
428
- - Futures Place Order: https://www.bitget.com/api-doc/contract/trade/Place-Order
429
- - Futures Batch Orders: https://www.bitget.com/api-doc/contract/trade/Batch-Place-Orders
@@ -1,154 +0,0 @@
1
- # futures_get_positions — Futures Positions
2
-
3
- ## Official Description
4
- Get current open positions or position history for futures contracts. Returns full position details including size, entry price, leverage, unrealized PnL, liquidation price, and margin.
5
-
6
- **Endpoints:**
7
- - Current positions: `GET /api/v2/mix/position/single-position` (single) | `GET /api/v2/mix/position/all-position` (all)
8
- - Position history: `GET /api/v2/mix/position/history-position`
9
-
10
- **Auth required:** Yes
11
- **Rate limit:** 10 req/s per UID
12
-
13
- ---
14
-
15
- ## bgc CLI Usage
16
-
17
- ```bash
18
- bgc futures futures_get_positions \
19
- --productType <PRODUCT_TYPE> \
20
- [--symbol <SYMBOL>] \
21
- [--marginCoin <coin>] \
22
- [--history true]
23
- ```
24
-
25
- ---
26
-
27
- ## Parameters
28
-
29
- | Parameter | Type | Required | Allowed Values | Description |
30
- |-----------|------|----------|----------------|-------------|
31
- | `productType` | string | Yes | `USDT-FUTURES`, `COIN-FUTURES`, `USDC-FUTURES` | Contract type |
32
- | `symbol` | string | No | e.g. `BTCUSDT` | Filter to one contract |
33
- | `marginCoin` | string | No | e.g. `USDT` | Filter by margin coin |
34
- | `history` | boolean | No | `true` | Get closed position history instead of open |
35
-
36
- ---
37
-
38
- ## Key Response Fields (Current Positions)
39
-
40
- | Field | Type | Description |
41
- |-------|------|-------------|
42
- | `symbol` | string | Contract pair |
43
- | `holdSide` | string | `long` or `short` |
44
- | `marginMode` | string | `isolated` or `crossed` |
45
- | `marginCoin` | string | Collateral coin |
46
- | `margin` | string | Margin allocated to this position |
47
- | `available` | string | Closeable size |
48
- | `total` | string | Total position size |
49
- | `openPriceAvg` | string | Average entry price |
50
- | `leverage` | string | Current leverage |
51
- | `unrealizedPL` | string | Unrealized profit/loss |
52
- | `liquidationPrice` | string | Liquidation price |
53
- | `keepMarginRate` | string | Maintenance margin rate |
54
- | `achievedProfits` | string | Realized PnL (partial closes) |
55
- | `marketPrice` | string | Current mark price |
56
- | `autoMargin` | string | Auto-margin status: `on` or `off` |
57
- | `cTime` | string | Position opened timestamp (ms) |
58
- | `uTime` | string | Last updated timestamp (ms) |
59
-
60
- ---
61
-
62
- ## Before Closing a Position — Read This First
63
-
64
- Always run this before placing a close order:
65
- ```bash
66
- bgc futures futures_get_positions --productType USDT-FUTURES --symbol BTCUSDT
67
- ```
68
-
69
- From the response, note:
70
- - **`holdSide`**: `long` or `short` — determines which `side` to use for closing
71
- - **`posMode`**: `one_way_mode` or `hedge_mode` — determines which close method to use
72
- - **`available`**: closeable size — use this as max `size` in your close order
73
- - **`total`**: total size (may differ from `available` if reduce-only orders already exist)
74
-
75
- ### Closing cheatsheet based on what you see
76
-
77
- | `holdSide` | `posMode` | Close order `side` | Extra param |
78
- |------------|-----------|-------------------|-------------|
79
- | `long` | `one_way_mode` | `sell` | `reduceOnly: "YES"` |
80
- | `short` | `one_way_mode` | `buy` | `reduceOnly: "YES"` |
81
- | `long` | `hedge_mode` | `sell` | `tradeSide: "close"` |
82
- | `short` | `hedge_mode` | `buy` | `tradeSide: "close"` |
83
-
84
- **Common mistake**: Using `sell` to close a `short` — this opens MORE short, it does not close it.
85
-
86
- ---
87
-
88
- ## Usage Cases
89
-
90
- ### Case 1: View all open positions (USDT futures)
91
- ```bash
92
- bgc futures futures_get_positions --productType USDT-FUTURES
93
- ```
94
- > Shows all open longs and shorts across all USDT-margined contracts.
95
-
96
- ### Case 2: Check position for a specific contract
97
- ```bash
98
- bgc futures futures_get_positions --productType USDT-FUTURES --symbol BTCUSDT
99
- ```
100
- > Check size, entry price, unrealized PnL, and liquidation price for your BTC position.
101
-
102
- ### Case 3: Check COIN-margined positions
103
- ```bash
104
- bgc futures futures_get_positions --productType COIN-FUTURES --marginCoin BTC
105
- ```
106
-
107
- ### Case 4: View position history (closed positions)
108
- ```bash
109
- bgc futures futures_get_positions --productType USDT-FUTURES --history true
110
- ```
111
- > Shows recently closed positions with realized PnL.
112
-
113
- ### Case 5: Assess liquidation risk
114
- ```bash
115
- bgc futures futures_get_positions --productType USDT-FUTURES --symbol BTCUSDT
116
- # Check "liquidationPrice" vs current market price
117
- # Check "keepMarginRate" — higher means closer to liquidation
118
- ```
119
-
120
- ### Case 6: Check available size before placing close order
121
- ```bash
122
- bgc futures futures_get_positions --productType USDT-FUTURES --symbol BTCUSDT
123
- # Use "available" field as max size for close order
124
- ```
125
-
126
- ### Case 7: Monitor unrealized PnL across all positions
127
- ```bash
128
- bgc futures futures_get_positions --productType USDT-FUTURES
129
- # Sum "unrealizedPL" fields across all positions
130
- ```
131
-
132
- ---
133
-
134
- ## Hedge Mode vs One-Way Mode
135
-
136
- In **hedge mode**, you may have both a long and short position on the same symbol simultaneously. Each appears as a separate position with `holdSide` of `long` or `short`.
137
-
138
- In **one-way mode**, there is at most one position per symbol, with `holdSide` reflecting the current direction.
139
-
140
- ---
141
-
142
- ## Important Notes
143
-
144
- - Positions with `total=0` are closed — they may briefly appear before being removed
145
- - `available` may be less than `total` if you have open close orders occupying the position
146
- - `liquidationPrice` is approximate — it changes as funding is applied
147
- - For COIN-FUTURES, `margin` and PnL are denominated in the base coin (e.g., BTC), not USDT
148
-
149
- ---
150
-
151
- ## Official Docs
152
- - All Positions: https://www.bitget.com/api-doc/contract/position/Get-All-Position
153
- - Single Position: https://www.bitget.com/api-doc/contract/position/Get-Single-Position
154
- - History Positions: https://www.bitget.com/api-doc/contract/position/Get-History-Position
@@ -1,87 +0,0 @@
1
- # spot_cancel_orders — Spot Cancel Orders
2
-
3
- ## Official Description
4
- Cancel one or more open spot orders by order ID, batch of IDs, or cancel all open orders for a symbol.
5
-
6
- **Endpoint:** `POST /api/v2/spot/trade/cancel-order` (single) | `POST /api/v2/spot/trade/batch-cancel-order` (batch) | `POST /api/v2/spot/trade/cancel-symbol-order` (cancel-all)
7
- **Auth required:** Yes
8
- **Rate limit:** 10 req/s per UID
9
-
10
- ---
11
-
12
- ## bgc CLI Usage
13
-
14
- ```bash
15
- bgc spot spot_cancel_orders --symbol <SYMBOL> [--orderId <id> | --orderIds '[...]' | --cancelAll true]
16
- ```
17
-
18
- ---
19
-
20
- ## Parameters
21
-
22
- | Parameter | Type | Required | Description |
23
- |-----------|------|----------|-------------|
24
- | `symbol` | string | Yes | Trading pair, e.g. `BTCUSDT` |
25
- | `orderId` | string | No | Cancel a single order by exchange order ID |
26
- | `orderIds` | array | No | Cancel up to 50 orders by ID list |
27
- | `cancelAll` | boolean | No | If `true`, cancel ALL open orders for the symbol |
28
-
29
- > Exactly one of `orderId`, `orderIds`, or `cancelAll` should be used per call.
30
-
31
- ---
32
-
33
- ## Response Fields
34
-
35
- | Field | Type | Description |
36
- |-------|------|-------------|
37
- | `orderId` | string | Cancelled order ID |
38
- | `clientOid` | string | Custom order ID if set |
39
-
40
- For batch cancels, response includes `successList` and `failureList`.
41
-
42
- ---
43
-
44
- ## Usage Cases
45
-
46
- ### Case 1: Cancel a single order
47
- ```bash
48
- bgc spot spot_cancel_orders --symbol BTCUSDT --orderId "1234567890"
49
- ```
50
- > Cancel one specific open order.
51
-
52
- ### Case 2: Cancel multiple specific orders
53
- ```bash
54
- bgc spot spot_cancel_orders --symbol BTCUSDT --orderIds '["1234567890","9876543210","1122334455"]'
55
- ```
56
- > Cancel up to 50 orders in one API call. Useful for clearing a DCA ladder.
57
-
58
- ### Case 3: Cancel ALL open orders for a symbol
59
- ```bash
60
- bgc spot spot_cancel_orders --symbol BTCUSDT --cancelAll true
61
- ```
62
- > Wipe all open orders on BTCUSDT at once. Use before a major position change or in emergency exit.
63
-
64
- ### Case 4: Cancel by clientOid (look up orderId first)
65
- ```bash
66
- # Step 1: find the orderId
67
- bgc spot spot_get_orders --symbol BTCUSDT --status open
68
-
69
- # Step 2: cancel it
70
- bgc spot spot_cancel_orders --symbol BTCUSDT --orderId "<found-orderId>"
71
- ```
72
- > The cancel endpoint requires the exchange `orderId`. If you only have `clientOid`, query orders first.
73
-
74
- ---
75
-
76
- ## Important Notes
77
-
78
- - Cancelling an already-filled or cancelled order returns an error — check order status first if unsure
79
- - `cancelAll` is the fastest way to exit all open orders on a symbol in a single call
80
- - Batch cancel response includes `failureList` — partial cancellations are possible
81
- - For plan/trigger orders use `spot_cancel_plan_orders` instead
82
-
83
- ---
84
-
85
- ## Official Docs
86
- - Cancel Order: https://www.bitget.com/api-doc/spot/trade/Cancel-Order
87
- - Batch Cancel: https://www.bitget.com/api-doc/spot/trade/Batch-Cancel-Orders