@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.
- package/CHANGELOG.md +23 -0
- package/README.md +189 -57
- package/VERSION +1 -1
- package/package.json +5 -3
- package/references/auth-setup.md +37 -9
- package/references/commands.md +1903 -774
- package/references/demo-trading.md +31 -28
- package/references/discover-guide.md +112 -0
- package/references/error-codes.md +111 -46
- package/references/trading-safety.md +163 -0
- package/scripts/gen-references.js +241 -45
- package/scripts/install.js +8 -1
- package/skills/SKILL.md +158 -139
- package/references/trading/README.md +0 -36
- package/references/trading/futures-cancel-orders.md +0 -113
- package/references/trading/futures-get-orders.md +0 -155
- package/references/trading/futures-leverage-config.md +0 -184
- package/references/trading/futures-modify-order.md +0 -173
- package/references/trading/futures-place-order.md +0 -429
- package/references/trading/futures-positions.md +0 -154
- package/references/trading/spot-cancel-orders.md +0 -87
- package/references/trading/spot-get-orders.md +0 -120
- package/references/trading/spot-modify-order.md +0 -95
- package/references/trading/spot-place-order.md +0 -166
- package/references/trading/spot-plan-orders.md +0 -160
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
# futures_set_leverage / futures_update_config — Futures Leverage & Configuration
|
|
2
|
-
|
|
3
|
-
## Official Description
|
|
4
|
-
Set leverage for a futures contract, or update position mode (one-way/hedge), margin mode (isolated/crossed), or auto-margin settings.
|
|
5
|
-
|
|
6
|
-
**Endpoints:**
|
|
7
|
-
- Set leverage: `POST /api/v2/mix/account/set-leverage`
|
|
8
|
-
- Update config: `POST /api/v2/mix/account/set-margin-mode` | `POST /api/v2/mix/account/set-position-mode` | `POST /api/v2/mix/account/set-auto-margin`
|
|
9
|
-
|
|
10
|
-
**Auth required:** Yes
|
|
11
|
-
**Rate limit:** 5 req/s per UID
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## futures_set_leverage Parameters
|
|
16
|
-
|
|
17
|
-
| Parameter | Type | Required | Allowed Values | Description |
|
|
18
|
-
|-----------|------|----------|----------------|-------------|
|
|
19
|
-
| `productType` | string | Yes | `USDT-FUTURES`, `COIN-FUTURES`, `USDC-FUTURES` | Contract type |
|
|
20
|
-
| `symbol` | string | Yes | e.g. `BTCUSDT` | Contract symbol |
|
|
21
|
-
| `marginCoin` | string | Yes | e.g. `USDT` | Margin coin (must match productType) |
|
|
22
|
-
| `leverage` | string | Yes | e.g. `"10"`, `"20"`, `"125"` | Target leverage multiplier |
|
|
23
|
-
| `holdSide` | string | No | `long`, `short` | Required only in **hedge mode** to set per-side leverage |
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## futures_update_config 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 | Yes | e.g. `BTCUSDT` | Contract symbol |
|
|
33
|
-
| `marginCoin` | string | Yes | e.g. `USDT` | Margin coin |
|
|
34
|
-
| `setting` | string | Yes | `marginMode`, `positionMode`, `autoMargin` | Which setting to change |
|
|
35
|
-
| `value` | string | Yes | (depends on setting) | New value for the setting |
|
|
36
|
-
| `holdSide` | string | No | `long`, `short` | Required for autoMargin setting in hedge mode |
|
|
37
|
-
|
|
38
|
-
### `setting` + `value` Combinations
|
|
39
|
-
|
|
40
|
-
| setting | value options | Description |
|
|
41
|
-
|---------|--------------|-------------|
|
|
42
|
-
| `marginMode` | `isolated`, `crossed` | Isolated = per-position margin; Crossed = shared account margin |
|
|
43
|
-
| `positionMode` | `one_way_mode`, `hedge_mode` | One-way = single position per symbol; Hedge = separate long+short |
|
|
44
|
-
| `autoMargin` | `on`, `off` | Auto top-up margin when approaching liquidation |
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Usage Cases
|
|
49
|
-
|
|
50
|
-
### Case 1: Set leverage to 10x (one-way mode)
|
|
51
|
-
```bash
|
|
52
|
-
bgc futures futures_set_leverage \
|
|
53
|
-
--productType USDT-FUTURES \
|
|
54
|
-
--symbol BTCUSDT \
|
|
55
|
-
--marginCoin USDT \
|
|
56
|
-
--leverage 10
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Case 2: Set leverage to 20x (isolated margin)
|
|
60
|
-
```bash
|
|
61
|
-
bgc futures futures_set_leverage \
|
|
62
|
-
--productType USDT-FUTURES \
|
|
63
|
-
--symbol ETHUSDT \
|
|
64
|
-
--marginCoin USDT \
|
|
65
|
-
--leverage 20
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Case 3: Set different leverage for long vs short (hedge mode)
|
|
69
|
-
```bash
|
|
70
|
-
# Set long-side leverage
|
|
71
|
-
bgc futures futures_set_leverage \
|
|
72
|
-
--productType USDT-FUTURES \
|
|
73
|
-
--symbol BTCUSDT \
|
|
74
|
-
--marginCoin USDT \
|
|
75
|
-
--leverage 10 \
|
|
76
|
-
--holdSide long
|
|
77
|
-
|
|
78
|
-
# Set short-side leverage
|
|
79
|
-
bgc futures futures_set_leverage \
|
|
80
|
-
--productType USDT-FUTURES \
|
|
81
|
-
--symbol BTCUSDT \
|
|
82
|
-
--marginCoin USDT \
|
|
83
|
-
--leverage 5 \
|
|
84
|
-
--holdSide short
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### Case 4: Switch to isolated margin mode
|
|
88
|
-
```bash
|
|
89
|
-
bgc futures futures_update_config \
|
|
90
|
-
--productType USDT-FUTURES \
|
|
91
|
-
--symbol BTCUSDT \
|
|
92
|
-
--marginCoin USDT \
|
|
93
|
-
--setting marginMode \
|
|
94
|
-
--value isolated
|
|
95
|
-
```
|
|
96
|
-
> Isolated mode limits losses to the margin allocated to this position only.
|
|
97
|
-
|
|
98
|
-
### Case 5: Switch to crossed margin mode
|
|
99
|
-
```bash
|
|
100
|
-
bgc futures futures_update_config \
|
|
101
|
-
--productType USDT-FUTURES \
|
|
102
|
-
--symbol BTCUSDT \
|
|
103
|
-
--marginCoin USDT \
|
|
104
|
-
--setting marginMode \
|
|
105
|
-
--value crossed
|
|
106
|
-
```
|
|
107
|
-
> Crossed mode uses all available USDT as margin — higher liquidation threshold but more capital at risk.
|
|
108
|
-
|
|
109
|
-
### Case 6: Enable hedge mode (hold long + short simultaneously)
|
|
110
|
-
```bash
|
|
111
|
-
bgc futures futures_update_config \
|
|
112
|
-
--productType USDT-FUTURES \
|
|
113
|
-
--symbol BTCUSDT \
|
|
114
|
-
--marginCoin USDT \
|
|
115
|
-
--setting positionMode \
|
|
116
|
-
--value hedge_mode
|
|
117
|
-
```
|
|
118
|
-
> Enables holding both long and short positions on the same symbol at the same time.
|
|
119
|
-
|
|
120
|
-
### Case 7: Switch back to one-way mode
|
|
121
|
-
```bash
|
|
122
|
-
bgc futures futures_update_config \
|
|
123
|
-
--productType USDT-FUTURES \
|
|
124
|
-
--symbol BTCUSDT \
|
|
125
|
-
--marginCoin USDT \
|
|
126
|
-
--setting positionMode \
|
|
127
|
-
--value one_way_mode
|
|
128
|
-
```
|
|
129
|
-
> Note: Cannot switch modes while you have open positions or orders on this symbol.
|
|
130
|
-
|
|
131
|
-
### Case 8: Enable auto-margin (prevent liquidation by auto top-up)
|
|
132
|
-
```bash
|
|
133
|
-
bgc futures futures_update_config \
|
|
134
|
-
--productType USDT-FUTURES \
|
|
135
|
-
--symbol BTCUSDT \
|
|
136
|
-
--marginCoin USDT \
|
|
137
|
-
--setting autoMargin \
|
|
138
|
-
--value on
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### Case 9: COIN-FUTURES leverage setup
|
|
142
|
-
```bash
|
|
143
|
-
bgc futures futures_set_leverage \
|
|
144
|
-
--productType COIN-FUTURES \
|
|
145
|
-
--symbol BTCUSD \
|
|
146
|
-
--marginCoin BTC \
|
|
147
|
-
--leverage 10
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
---
|
|
151
|
-
|
|
152
|
-
## Recommended Setup Sequence
|
|
153
|
-
|
|
154
|
-
Before trading a new contract:
|
|
155
|
-
```bash
|
|
156
|
-
# 1. Set position mode (do this first, before any positions)
|
|
157
|
-
bgc futures futures_update_config --productType USDT-FUTURES --symbol BTCUSDT --marginCoin USDT --setting positionMode --value one_way_mode
|
|
158
|
-
|
|
159
|
-
# 2. Set margin mode
|
|
160
|
-
bgc futures futures_update_config --productType USDT-FUTURES --symbol BTCUSDT --marginCoin USDT --setting marginMode --value crossed
|
|
161
|
-
|
|
162
|
-
# 3. Set leverage
|
|
163
|
-
bgc futures futures_set_leverage --productType USDT-FUTURES --symbol BTCUSDT --marginCoin USDT --leverage 10
|
|
164
|
-
|
|
165
|
-
# 4. Verify settings
|
|
166
|
-
bgc futures futures_get_positions --productType USDT-FUTURES --symbol BTCUSDT
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
---
|
|
170
|
-
|
|
171
|
-
## Important Notes
|
|
172
|
-
|
|
173
|
-
- Cannot change `positionMode` while you have open positions or orders on that symbol
|
|
174
|
-
- Cannot change `marginMode` while you have an open position on that symbol
|
|
175
|
-
- Max leverage varies by contract and notional position size — larger positions have lower max leverage
|
|
176
|
-
- `holdSide` for `futures_set_leverage` is only needed in hedge mode; omit in one-way mode
|
|
177
|
-
- `autoMargin=on` draws from your available balance — ensure sufficient USDT to avoid unintended draws
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## Official Docs
|
|
182
|
-
- Set Leverage: https://www.bitget.com/api-doc/contract/account/Set-Leverage
|
|
183
|
-
- Set Margin Mode: https://www.bitget.com/api-doc/contract/account/Set-Margin-Mode
|
|
184
|
-
- Set Position Mode: https://www.bitget.com/api-doc/contract/account/Set-Position-Mode
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
# futures_modify_order — Futures Modify Order
|
|
2
|
-
|
|
3
|
-
## Official Description
|
|
4
|
-
Modify a pending futures order. Can update TP/SL trigger prices, limit price, and size.
|
|
5
|
-
|
|
6
|
-
**Key behavior difference:**
|
|
7
|
-
- Modifying **only TP/SL** (`newPresetStopSurplusPrice` / `newPresetStopLossPrice`): **does NOT cancel the original order** — in-place update
|
|
8
|
-
- Modifying **size/price** (`newSize` + `newPrice`): **cancels and recreates** the order with a new `orderId`
|
|
9
|
-
|
|
10
|
-
**Endpoint:** `POST /api/v2/mix/order/modify-order`
|
|
11
|
-
**Auth required:** Yes
|
|
12
|
-
**Rate limit:** 10 req/s per UID
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## bgc CLI Usage
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
bgc futures futures_modify_order \
|
|
20
|
-
--symbol BTCUSDT \
|
|
21
|
-
--productType USDT-FUTURES \
|
|
22
|
-
--marginCoin USDT \
|
|
23
|
-
--orderId <id> \
|
|
24
|
-
--newClientOid <new-client-id> \
|
|
25
|
-
[--newPresetStopSurplusPrice <price>] \
|
|
26
|
-
[--newPresetStopLossPrice <price>] \
|
|
27
|
-
[--newSize <size> --newPrice <price>]
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## Parameters
|
|
33
|
-
|
|
34
|
-
| Parameter | Type | Required | Description |
|
|
35
|
-
|-----------|------|----------|-------------|
|
|
36
|
-
| `symbol` | string | Yes | Trading pair, e.g. `BTCUSDT` |
|
|
37
|
-
| `productType` | string | Yes | `USDT-FUTURES`, `COIN-FUTURES`, or `USDC-FUTURES` |
|
|
38
|
-
| `marginCoin` | string | Yes | Margin asset, e.g. `USDT` |
|
|
39
|
-
| `orderId` | string | Conditional* | Exchange order ID |
|
|
40
|
-
| `clientOid` | string | Conditional* | Custom order ID. `orderId` takes priority if both given |
|
|
41
|
-
| `newClientOid` | string | Yes | New custom order ID for the modified order |
|
|
42
|
-
| `newSize` | string | No | New order quantity. **Must be provided with `newPrice`** |
|
|
43
|
-
| `newPrice` | string | No | New limit price. **Must be provided with `newSize`** |
|
|
44
|
-
| `newPresetStopSurplusPrice` | string | No | New take-profit trigger price. Pass `"0"` to delete |
|
|
45
|
-
| `newPresetStopLossPrice` | string | No | New stop-loss trigger price. Pass `"0"` to delete |
|
|
46
|
-
|
|
47
|
-
*One of `orderId` or `clientOid` must be provided.
|
|
48
|
-
At least one modification field must be present.
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## Response Fields
|
|
53
|
-
|
|
54
|
-
| Field | Type | Description |
|
|
55
|
-
|-------|------|-------------|
|
|
56
|
-
| `orderId` | string | New order ID (only changes when size/price modified) |
|
|
57
|
-
| `clientOid` | string | New custom order ID |
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## Usage Cases
|
|
62
|
-
|
|
63
|
-
### Case 1: Add TP/SL to an existing pending order
|
|
64
|
-
|
|
65
|
-
You placed a limit order without TP/SL. Now you want to add them without cancelling the order:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
bgc futures futures_modify_order \
|
|
69
|
-
--symbol BTCUSDT \
|
|
70
|
-
--productType USDT-FUTURES \
|
|
71
|
-
--marginCoin USDT \
|
|
72
|
-
--orderId "1234567890" \
|
|
73
|
-
--newClientOid "my-order-v2" \
|
|
74
|
-
--newPresetStopSurplusPrice "72000" \
|
|
75
|
-
--newPresetStopLossPrice "61000"
|
|
76
|
-
```
|
|
77
|
-
> The original order stays active. Only the TP/SL triggers are updated.
|
|
78
|
-
|
|
79
|
-
### Case 2: Adjust existing TP price only
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
bgc futures futures_modify_order \
|
|
83
|
-
--symbol BTCUSDT \
|
|
84
|
-
--productType USDT-FUTURES \
|
|
85
|
-
--marginCoin USDT \
|
|
86
|
-
--orderId "1234567890" \
|
|
87
|
-
--newClientOid "my-order-v3" \
|
|
88
|
-
--newPresetStopSurplusPrice "75000"
|
|
89
|
-
```
|
|
90
|
-
> Move TP target without touching SL or the order itself.
|
|
91
|
-
|
|
92
|
-
### Case 3: Delete TP/SL (pass "0")
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
bgc futures futures_modify_order \
|
|
96
|
-
--symbol BTCUSDT \
|
|
97
|
-
--productType USDT-FUTURES \
|
|
98
|
-
--marginCoin USDT \
|
|
99
|
-
--orderId "1234567890" \
|
|
100
|
-
--newClientOid "my-order-v4" \
|
|
101
|
-
--newPresetStopSurplusPrice "0" \
|
|
102
|
-
--newPresetStopLossPrice "0"
|
|
103
|
-
```
|
|
104
|
-
> Removes both TP and SL presets from the order.
|
|
105
|
-
|
|
106
|
-
### Case 4: Reprice a limit order (cancel-and-replace)
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
bgc futures futures_modify_order \
|
|
110
|
-
--symbol BTCUSDT \
|
|
111
|
-
--productType USDT-FUTURES \
|
|
112
|
-
--marginCoin USDT \
|
|
113
|
-
--orderId "1234567890" \
|
|
114
|
-
--newClientOid "my-order-v5" \
|
|
115
|
-
--newPrice "64500" \
|
|
116
|
-
--newSize "0.01"
|
|
117
|
-
```
|
|
118
|
-
> ⚠️ This cancels the original order and creates a new one. Save the new `orderId` from response.
|
|
119
|
-
|
|
120
|
-
### Case 5: Reprice and update TP/SL together
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
bgc futures futures_modify_order \
|
|
124
|
-
--symbol BTCUSDT \
|
|
125
|
-
--productType USDT-FUTURES \
|
|
126
|
-
--marginCoin USDT \
|
|
127
|
-
--orderId "1234567890" \
|
|
128
|
-
--newClientOid "my-order-v6" \
|
|
129
|
-
--newPrice "64500" \
|
|
130
|
-
--newSize "0.01" \
|
|
131
|
-
--newPresetStopSurplusPrice "71000" \
|
|
132
|
-
--newPresetStopLossPrice "60000"
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
|
-
## Important Notes
|
|
138
|
-
|
|
139
|
-
- Only **pending limit orders** can be modified — filled or partially filled orders cannot
|
|
140
|
-
- `newSize` and `newPrice` must always be provided **together** — you cannot change only one
|
|
141
|
-
- TP/SL-only modifications do **not** change the `orderId`; size/price changes produce a **new `orderId`**
|
|
142
|
-
- TP/SL trigger prices are evaluated against **mark price**, not last trade price
|
|
143
|
-
- After a size/price modification, the original `orderId` is invalidated — update any references
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
## Workflow: Open order + set TP/SL after the fact
|
|
148
|
-
|
|
149
|
-
```bash
|
|
150
|
-
# Step 1: Place a limit buy
|
|
151
|
-
bgc futures futures_place_order --orders '[{
|
|
152
|
-
"symbol": "BTCUSDT", "productType": "USDT-FUTURES",
|
|
153
|
-
"marginMode": "crossed", "marginCoin": "USDT",
|
|
154
|
-
"side": "buy", "orderType": "limit", "force": "gtc",
|
|
155
|
-
"price": "65000", "size": "0.01"
|
|
156
|
-
}]'
|
|
157
|
-
# → save the returned orderId, e.g. "1234567890"
|
|
158
|
-
|
|
159
|
-
# Step 2: Add TP/SL without cancelling the order
|
|
160
|
-
bgc futures futures_modify_order \
|
|
161
|
-
--symbol BTCUSDT \
|
|
162
|
-
--productType USDT-FUTURES \
|
|
163
|
-
--marginCoin USDT \
|
|
164
|
-
--orderId "1234567890" \
|
|
165
|
-
--newClientOid "my-entry-v2" \
|
|
166
|
-
--newPresetStopSurplusPrice "72000" \
|
|
167
|
-
--newPresetStopLossPrice "61000"
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
---
|
|
171
|
-
|
|
172
|
-
## Official Docs
|
|
173
|
-
- Modify Order: https://www.bitget.com/api-doc/contract/trade/Modify-Order
|