bybit-api 2.4.0-beta.2 → 3.0.1
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/README.md +62 -43
- package/lib/inverse-client.d.ts +18 -126
- package/lib/inverse-client.js.map +1 -1
- package/lib/linear-client.d.ts +20 -142
- package/lib/linear-client.js.map +1 -1
- package/lib/spot-client-v3.d.ts +2 -6
- package/lib/spot-client-v3.js.map +1 -1
- package/lib/spot-client.js +1 -1
- package/lib/spot-client.js.map +1 -1
- package/lib/types/request/index.d.ts +2 -1
- package/lib/types/request/index.js +2 -1
- package/lib/types/request/index.js.map +1 -1
- package/lib/types/request/inverse.d.ts +120 -0
- package/lib/types/request/{usdt-perp.js → inverse.js} +1 -1
- package/lib/types/request/inverse.js.map +1 -0
- package/lib/types/request/linear.d.ts +160 -0
- package/lib/types/request/linear.js +3 -0
- package/lib/types/request/linear.js.map +1 -0
- package/lib/types/request/spot.d.ts +5 -0
- package/lib/types/shared.d.ts +2 -1
- package/lib/types/websockets.d.ts +1 -1
- package/lib/util/BaseRestClient.d.ts +4 -8
- package/lib/util/BaseRestClient.js +16 -23
- package/lib/util/BaseRestClient.js.map +1 -1
- package/lib/util/WsStore.d.ts +1 -1
- package/lib/util/requestUtils.d.ts +8 -4
- package/lib/util/requestUtils.js +9 -6
- package/lib/util/requestUtils.js.map +1 -1
- package/lib/util/websocket-util.d.ts +5 -1
- package/lib/util/websocket-util.js +65 -0
- package/lib/util/websocket-util.js.map +1 -1
- package/lib/websocket-client.d.ts +12 -5
- package/lib/websocket-client.js +76 -34
- package/lib/websocket-client.js.map +1 -1
- package/package.json +2 -2
- package/lib/types/request/usdt-perp.d.ts +0 -20
- package/lib/types/request/usdt-perp.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Node.js & Typescript Bybit API SDK
|
|
2
2
|
[](https://circleci.com/gh/tiagosiebler/bybit-api)
|
|
3
3
|
[][1] [][1] [][1]
|
|
4
4
|
[][1]
|
|
@@ -39,13 +39,13 @@ Most methods accept JS objects. These can be populated using parameters specifie
|
|
|
39
39
|
- [Bybit API Docs (choose API category from the tabs at the top)](https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-introduction).
|
|
40
40
|
|
|
41
41
|
## Structure
|
|
42
|
-
|
|
42
|
+
This connector is fully compatible with both TypeScript and pure JavaScript projects, while the connector is written in TypeScript. A pure JavaScript version can be built using `npm run build`, which is also the version published to [npm](https://www.npmjs.com/package/bybit-api).
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
The version on npm is the output from the `build` command and can be used in projects without TypeScript (although TypeScript is definitely recommended).
|
|
45
45
|
|
|
46
46
|
- [src](./src) - the whole connector written in TypeScript
|
|
47
47
|
- [lib](./lib) - the JavaScript version of the project (built from TypeScript). This should not be edited directly, as it will be overwritten with each release.
|
|
48
|
-
- [dist](./dist) - the
|
|
48
|
+
- [dist](./dist) - the webpack bundle of the project for use in browser environments (see guidance on webpack below).
|
|
49
49
|
- [examples](./examples) - some implementation examples & demonstrations. Contributions are welcome!
|
|
50
50
|
|
|
51
51
|
---
|
|
@@ -57,8 +57,8 @@ Each REST API group has a dedicated REST client. To avoid confusion, here are th
|
|
|
57
57
|
| [LinearClient](src/linear-client.ts) | [USDT Perpetual Futures (v2) APIs](https://bybit-exchange.github.io/docs/futuresV2/linear/#t-introduction) |
|
|
58
58
|
| [InverseFuturesClient](src/inverse-futures-client.ts) | [Inverse Futures (v2) APIs](https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-introduction) |
|
|
59
59
|
| [USDCPerpetualClient](src/usdc-perpetual-client.ts) | [USDC Perpetual APIs](https://bybit-exchange.github.io/docs/usdc/option/?console#t-querydeliverylog) |
|
|
60
|
-
| [UnifiedMarginClient](src/unified-margin-client.ts) | [Derivatives (v3) unified margin APIs](https://bybit-exchange.github.io/docs/derivativesV3/unified_margin/#t-introduction) |
|
|
61
60
|
| [USDCOptionClient](src/usdc-option-client.ts) | [USDC Option APIs](https://bybit-exchange.github.io/docs/usdc/option/#t-introduction) |
|
|
61
|
+
| [UnifiedMarginClient](src/unified-margin-client.ts) | [Derivatives (v3) unified margin APIs](https://bybit-exchange.github.io/docs/derivativesV3/unified_margin/#t-introduction) |
|
|
62
62
|
| [SpotClientV3](src/spot-client-v3.ts) | [Spot Market (v3) APIs](https://bybit-exchange.github.io/docs/spot/v3/#t-introduction) |
|
|
63
63
|
| [~SpotClient~](src/spot-client.ts) (deprecated, v3 client recommended)| [Spot Market (v1) APIs](https://bybit-exchange.github.io/docs/spot/v1/#t-introduction) |
|
|
64
64
|
| [AccountAssetClient](src/account-asset-client.ts) | [Account Asset APIs](https://bybit-exchange.github.io/docs/account_asset/#t-introduction) |
|
|
@@ -80,55 +80,67 @@ All REST clients have can be used in a similar way. However, method names, param
|
|
|
80
80
|
|
|
81
81
|
Not sure which function to call or which parameters to use? Click the class name in the table above to look at all the function names (they are in the same order as the official API docs), and check the API docs for a list of endpoints/paramters/responses.
|
|
82
82
|
|
|
83
|
-
```
|
|
83
|
+
```typescript
|
|
84
84
|
const {
|
|
85
85
|
InverseClient,
|
|
86
86
|
LinearClient,
|
|
87
87
|
InverseFuturesClient,
|
|
88
88
|
SpotClient,
|
|
89
|
-
|
|
89
|
+
SpotClientV3,
|
|
90
|
+
UnifiedMarginClient,
|
|
90
91
|
USDCOptionClient,
|
|
91
92
|
USDCPerpetualClient,
|
|
92
|
-
CopyTradingClient,
|
|
93
93
|
AccountAssetClient,
|
|
94
|
+
CopyTradingClient,
|
|
94
95
|
} = require('bybit-api');
|
|
95
96
|
|
|
96
97
|
const restClientOptions = {
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
/** Your API key. Optional, if you plan on making private api calls */
|
|
99
|
+
key?: string;
|
|
100
|
+
|
|
101
|
+
/** Your API secret. Optional, if you plan on making private api calls */
|
|
102
|
+
secret?: string;
|
|
103
|
+
|
|
104
|
+
/** Set to `true` to connect to testnet. Uses the live environment by default. */
|
|
105
|
+
testnet?: boolean;
|
|
99
106
|
|
|
100
|
-
|
|
101
|
-
|
|
107
|
+
/** Override the max size of the request window (in ms) */
|
|
108
|
+
recv_window?: number;
|
|
102
109
|
|
|
103
|
-
|
|
110
|
+
/** Disabled by default. This can help on machines with consistent latency problems. */
|
|
104
111
|
enable_time_sync?: boolean;
|
|
105
112
|
|
|
106
|
-
|
|
113
|
+
/** How often to sync time drift with bybit servers */
|
|
114
|
+
sync_interval_ms?: number | string;
|
|
115
|
+
|
|
116
|
+
/** Default: false. If true, we'll throw errors if any params are undefined */
|
|
107
117
|
strict_param_validation?: boolean;
|
|
108
118
|
|
|
109
|
-
|
|
110
|
-
|
|
119
|
+
/**
|
|
120
|
+
* Optionally override API protocol + domain
|
|
121
|
+
* e.g baseUrl: 'https://api.bytick.com'
|
|
122
|
+
**/
|
|
111
123
|
baseUrl?: string;
|
|
112
124
|
|
|
113
|
-
|
|
125
|
+
/** Default: true. whether to try and post-process request exceptions. */
|
|
114
126
|
parse_exceptions?: boolean;
|
|
115
127
|
};
|
|
116
128
|
|
|
117
129
|
const API_KEY = 'xxx';
|
|
118
|
-
const
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
const client = new InverseClient(
|
|
122
|
-
API_KEY,
|
|
123
|
-
PRIVATE_KEY,
|
|
130
|
+
const API_SECRET = 'yyy';
|
|
131
|
+
const useTestnet = false;
|
|
124
132
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
133
|
+
const client = new InverseClient({
|
|
134
|
+
key: API_KEY,
|
|
135
|
+
secret: API_SECRET,
|
|
136
|
+
testnet: useTestnet
|
|
137
|
+
},
|
|
129
138
|
// requestLibraryOptions
|
|
130
139
|
);
|
|
131
140
|
|
|
141
|
+
// For public-only API calls, simply don't provide a key & secret or set them to undefined
|
|
142
|
+
// const client = new InverseClient({});
|
|
143
|
+
|
|
132
144
|
client.getApiKeyInfo()
|
|
133
145
|
.then(result => {
|
|
134
146
|
console.log("getApiKeyInfo result: ", result);
|
|
@@ -147,20 +159,21 @@ client.getOrderBook({ symbol: 'BTCUSD' })
|
|
|
147
159
|
```
|
|
148
160
|
|
|
149
161
|
## WebSockets
|
|
150
|
-
All API groups can be used via a shared `WebsocketClient`. However,
|
|
162
|
+
All API groups can be used via a shared `WebsocketClient`. However, to listen to multiple API groups at once, you will need to make one WebsocketClient instance per API group.
|
|
151
163
|
|
|
152
164
|
The WebsocketClient can be configured to a specific API group using the market parameter. These are the currently available API groups:
|
|
153
165
|
| API Category | Market | Description |
|
|
154
166
|
|:----------------------------: |:-------------------: |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
155
|
-
| Unified Margin
|
|
167
|
+
| Unified Margin - Options | `market: 'unifiedOption'`| The [derivatives v3](https://bybit-exchange.github.io/docs/derivativesV3/unified_margin/#t-websocket) category for unified margin. Note: public topics only support options topics. If you need USDC/USDT perps, use `unifiedPerp` instead. |
|
|
168
|
+
| Unified Margin - Perps | `market: 'unifiedPerp'` | The [derivatives v3](https://bybit-exchange.github.io/docs/derivativesV3/unified_margin/#t-websocket) category for unified margin. Note: public topics only support USDT/USDC perpetual topics - use `unifiedOption` if you need public options topics. |
|
|
156
169
|
| Futures v2 - Inverse Perps | `market: 'inverse'` | The [inverse v2 perps](https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-websocket) category. |
|
|
157
170
|
| Futures v2 - USDT Perps | `market: 'linear'` | The [USDT/linear v2 perps](https://bybit-exchange.github.io/docs/futuresV2/linear/#t-websocket) category. |
|
|
158
171
|
| Futures v2 - Inverse Futures | `market: 'inverse'` | The [inverse futures v2](https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-websocket) category uses the same market as inverse perps. |
|
|
159
172
|
| Spot v3 | `market: 'spotv3'` | The [spot v3](https://bybit-exchange.github.io/docs/spot/v3/#t-websocket) category. |
|
|
160
173
|
| Spot v1 | `market: 'spot'` | The older [spot v1](https://bybit-exchange.github.io/docs/spot/v1/#t-websocket) category. Use the `spotv3` market if possible, as the v1 category does not have automatic re-subscribe if reconnected. |
|
|
161
|
-
| Copy Trading | `market: 'linear'` | The [copy trading](https://bybit-exchange.github.io/docs/copy_trading/#t-websocket) category. Use the linear market to listen to all copy trading topics.
|
|
162
|
-
| USDC Perps |
|
|
163
|
-
| USDC Options |
|
|
174
|
+
| Copy Trading | `market: 'linear'` | The [copy trading](https://bybit-exchange.github.io/docs/copy_trading/#t-websocket) category. Use the linear market to listen to all copy trading topics. |
|
|
175
|
+
| USDC Perps | `market: 'usdcPerp` | The [USDC perps](https://bybit-exchange.github.io/docs/usdc/perpetual/#t-websocket) category. |
|
|
176
|
+
| USDC Options | `market: 'usdcOption'`| The [USDC options](https://bybit-exchange.github.io/docs/usdc/option/#t-websocket) category. |
|
|
164
177
|
|
|
165
178
|
```javascript
|
|
166
179
|
const { WebsocketClient } = require('bybit-api');
|
|
@@ -176,15 +189,19 @@ const wsConfig = {
|
|
|
176
189
|
The following parameters are optional:
|
|
177
190
|
*/
|
|
178
191
|
|
|
179
|
-
// defaults to
|
|
180
|
-
//
|
|
192
|
+
// defaults to true == livenet
|
|
193
|
+
// testnet: false
|
|
181
194
|
|
|
182
195
|
// NOTE: to listen to multiple markets (spot vs inverse vs linear vs linearfutures) at once, make one WebsocketClient instance per market
|
|
183
196
|
|
|
184
|
-
|
|
185
|
-
// market: 'inverse'
|
|
186
|
-
// market: '
|
|
187
|
-
// market: '
|
|
197
|
+
market: 'linear',
|
|
198
|
+
// market: 'inverse',
|
|
199
|
+
// market: 'spot',
|
|
200
|
+
// market: 'spotv3',
|
|
201
|
+
// market: 'usdcOption',
|
|
202
|
+
// market: 'usdcPerp',
|
|
203
|
+
// market: 'unifiedPerp',
|
|
204
|
+
// market: 'unifiedOption',
|
|
188
205
|
|
|
189
206
|
// how long to wait (in ms) before deciding the connection should be terminated & reconnected
|
|
190
207
|
// pongTimeout: 1000,
|
|
@@ -233,10 +250,9 @@ ws.on('close', () => {
|
|
|
233
250
|
console.log('connection closed');
|
|
234
251
|
});
|
|
235
252
|
|
|
236
|
-
// Optional: Listen to raw error events.
|
|
237
|
-
// Note: responses to invalid topics are currently only sent in the "response" event.
|
|
253
|
+
// Optional: Listen to raw error events. Recommended.
|
|
238
254
|
ws.on('error', err => {
|
|
239
|
-
console.error('
|
|
255
|
+
console.error('error', err);
|
|
240
256
|
});
|
|
241
257
|
```
|
|
242
258
|
|
|
@@ -251,11 +267,14 @@ Pass a custom logger which supports the log methods `silly`, `debug`, `notice`,
|
|
|
251
267
|
const { WebsocketClient, DefaultLogger } = require('bybit-api');
|
|
252
268
|
|
|
253
269
|
// Disable all logging on the silly level
|
|
254
|
-
|
|
270
|
+
const customLogger = {
|
|
271
|
+
...DefaultLogger,
|
|
272
|
+
silly: () => {},
|
|
273
|
+
};
|
|
255
274
|
|
|
256
275
|
const ws = new WebsocketClient(
|
|
257
276
|
{ key: 'xxx', secret: 'yyy' },
|
|
258
|
-
|
|
277
|
+
customLogger
|
|
259
278
|
);
|
|
260
279
|
```
|
|
261
280
|
|
package/lib/inverse-client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APIResponseWithTime, AssetExchangeRecordsReq, CoinParam, SymbolInfo, SymbolIntervalFromLimitParam, SymbolLimitParam, SymbolParam, SymbolPeriodLimitParam, WalletFundRecordsReq, WithdrawRecordsReq } from './types';
|
|
1
|
+
import { APIResponseWithTime, AssetExchangeRecordsReq, CoinParam, InverseActiveConditionalOrderRequest, InverseActiveOrdersRequest, InverseCancelConditionalOrderRequest, InverseCancelOrderRequest, InverseChangePositionMarginRequest, InverseConditionalOrderRequest, InverseGetClosedPnlRequest, InverseGetOrderRequest, InverseGetTradeRecordsRequest, InverseOrderRequest, InverseReplaceConditionalOrderRequest, InverseReplaceOrderRequest, InverseSetLeverageRequest, InverseSetMarginTypeRequest, InverseSetSlTpPositionModeRequest, InverseSetTradingStopRequest, SymbolInfo, SymbolIntervalFromLimitParam, SymbolLimitParam, SymbolParam, SymbolPeriodLimitParam, WalletFundRecordsReq, WithdrawRecordsReq } from './types';
|
|
2
2
|
import BaseRestClient from './util/BaseRestClient';
|
|
3
3
|
/**
|
|
4
4
|
* REST API client for Inverse Perpetual Futures APIs (v2)
|
|
@@ -60,141 +60,33 @@ export declare class InverseClient extends BaseRestClient {
|
|
|
60
60
|
/**
|
|
61
61
|
* Active orders
|
|
62
62
|
*/
|
|
63
|
-
placeActiveOrder(orderRequest:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
order_type: string;
|
|
67
|
-
qty: number;
|
|
68
|
-
price?: number;
|
|
69
|
-
time_in_force: string;
|
|
70
|
-
take_profit?: number;
|
|
71
|
-
stop_loss?: number;
|
|
72
|
-
reduce_only?: boolean;
|
|
73
|
-
tp_trigger_by?: 'LastPrice' | 'MarkPrice' | 'IndexPrice';
|
|
74
|
-
sl_trigger_by?: 'LastPrice' | 'MarkPrice' | 'IndexPrice';
|
|
75
|
-
close_on_trigger?: boolean;
|
|
76
|
-
order_link_id?: string;
|
|
77
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
78
|
-
getActiveOrderList(params: {
|
|
79
|
-
symbol: string;
|
|
80
|
-
order_status?: string;
|
|
81
|
-
direction?: string;
|
|
82
|
-
limit?: number;
|
|
83
|
-
cursor?: string;
|
|
84
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
85
|
-
cancelActiveOrder(params: {
|
|
86
|
-
symbol: string;
|
|
87
|
-
order_id?: string;
|
|
88
|
-
order_link_id?: string;
|
|
89
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
63
|
+
placeActiveOrder(orderRequest: InverseOrderRequest): Promise<APIResponseWithTime<any>>;
|
|
64
|
+
getActiveOrderList(params: InverseActiveOrdersRequest): Promise<APIResponseWithTime<any>>;
|
|
65
|
+
cancelActiveOrder(params: InverseCancelOrderRequest): Promise<APIResponseWithTime<any>>;
|
|
90
66
|
cancelAllActiveOrders(params: SymbolParam): Promise<APIResponseWithTime<any>>;
|
|
91
|
-
replaceActiveOrder(params:
|
|
92
|
-
|
|
93
|
-
order_link_id?: string;
|
|
94
|
-
symbol: string;
|
|
95
|
-
p_r_qty?: number;
|
|
96
|
-
p_r_price?: string;
|
|
97
|
-
take_profit?: number;
|
|
98
|
-
stop_loss?: number;
|
|
99
|
-
tp_trigger_by?: string;
|
|
100
|
-
sl_trigger_by?: string;
|
|
101
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
102
|
-
queryActiveOrder(params: {
|
|
103
|
-
order_id?: string;
|
|
104
|
-
order_link_id?: string;
|
|
105
|
-
symbol: string;
|
|
106
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
67
|
+
replaceActiveOrder(params: InverseReplaceOrderRequest): Promise<APIResponseWithTime<any>>;
|
|
68
|
+
queryActiveOrder(params: InverseGetOrderRequest): Promise<APIResponseWithTime<any>>;
|
|
107
69
|
/**
|
|
108
70
|
* Conditional orders
|
|
109
71
|
*/
|
|
110
|
-
placeConditionalOrder(params:
|
|
111
|
-
side: string;
|
|
112
|
-
symbol: string;
|
|
113
|
-
order_type: string;
|
|
114
|
-
qty: string;
|
|
115
|
-
price?: string;
|
|
116
|
-
base_price: string;
|
|
117
|
-
stop_px: string;
|
|
118
|
-
time_in_force: string;
|
|
119
|
-
trigger_by?: string;
|
|
120
|
-
close_on_trigger?: boolean;
|
|
121
|
-
order_link_id?: string;
|
|
122
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
72
|
+
placeConditionalOrder(params: InverseConditionalOrderRequest): Promise<APIResponseWithTime<any>>;
|
|
123
73
|
/** get conditional order list. This may see delays, use queryConditionalOrder() for real-time queries */
|
|
124
|
-
getConditionalOrder(params:
|
|
125
|
-
|
|
126
|
-
stop_order_status?: string;
|
|
127
|
-
direction?: string;
|
|
128
|
-
limit?: number;
|
|
129
|
-
cursor?: string;
|
|
130
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
131
|
-
cancelConditionalOrder(params: {
|
|
132
|
-
symbol: string;
|
|
133
|
-
stop_order_id?: string;
|
|
134
|
-
order_link_id?: string;
|
|
135
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
74
|
+
getConditionalOrder(params: InverseActiveConditionalOrderRequest): Promise<APIResponseWithTime<any>>;
|
|
75
|
+
cancelConditionalOrder(params: InverseCancelConditionalOrderRequest): Promise<APIResponseWithTime<any>>;
|
|
136
76
|
cancelAllConditionalOrders(params: SymbolParam): Promise<APIResponseWithTime<any>>;
|
|
137
|
-
replaceConditionalOrder(params:
|
|
138
|
-
|
|
139
|
-
order_link_id?: string;
|
|
140
|
-
symbol: string;
|
|
141
|
-
p_r_qty?: number;
|
|
142
|
-
p_r_price?: string;
|
|
143
|
-
p_r_trigger_price?: string;
|
|
144
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
145
|
-
queryConditionalOrder(params: {
|
|
146
|
-
symbol: string;
|
|
147
|
-
stop_order_id?: string;
|
|
148
|
-
order_link_id?: string;
|
|
149
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
77
|
+
replaceConditionalOrder(params: InverseReplaceConditionalOrderRequest): Promise<APIResponseWithTime<any>>;
|
|
78
|
+
queryConditionalOrder(params: InverseGetOrderRequest): Promise<APIResponseWithTime<any>>;
|
|
150
79
|
/**
|
|
151
80
|
* Position
|
|
152
81
|
*/
|
|
153
82
|
getPosition(params?: Partial<SymbolParam>): Promise<APIResponseWithTime<any>>;
|
|
154
|
-
changePositionMargin(params:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
stop_loss?: number;
|
|
162
|
-
trailing_stop?: number;
|
|
163
|
-
tp_trigger_by?: string;
|
|
164
|
-
sl_trigger_by?: string;
|
|
165
|
-
new_trailing_active?: number;
|
|
166
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
167
|
-
setUserLeverage(params: {
|
|
168
|
-
symbol: string;
|
|
169
|
-
leverage: number;
|
|
170
|
-
leverage_only?: boolean;
|
|
171
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
172
|
-
getTradeRecords(params: {
|
|
173
|
-
order_id?: string;
|
|
174
|
-
symbol: string;
|
|
175
|
-
start_time?: number;
|
|
176
|
-
page?: number;
|
|
177
|
-
limit?: number;
|
|
178
|
-
order?: string;
|
|
179
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
180
|
-
getClosedPnl(params: {
|
|
181
|
-
symbol: string;
|
|
182
|
-
start_time?: number;
|
|
183
|
-
end_time?: number;
|
|
184
|
-
exec_type?: string;
|
|
185
|
-
page?: number;
|
|
186
|
-
limit?: number;
|
|
187
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
188
|
-
setSlTpPositionMode(params: {
|
|
189
|
-
symbol: string;
|
|
190
|
-
tp_sl_mode: 'Full' | 'Partial';
|
|
191
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
192
|
-
setMarginType(params: {
|
|
193
|
-
symbol: string;
|
|
194
|
-
is_isolated: boolean;
|
|
195
|
-
buy_leverage: number;
|
|
196
|
-
sell_leverage: number;
|
|
197
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
83
|
+
changePositionMargin(params: InverseChangePositionMarginRequest): Promise<APIResponseWithTime<any>>;
|
|
84
|
+
setTradingStop(params: InverseSetTradingStopRequest): Promise<APIResponseWithTime<any>>;
|
|
85
|
+
setUserLeverage(params: InverseSetLeverageRequest): Promise<APIResponseWithTime<any>>;
|
|
86
|
+
getTradeRecords(params: InverseGetTradeRecordsRequest): Promise<APIResponseWithTime<any>>;
|
|
87
|
+
getClosedPnl(params: InverseGetClosedPnlRequest): Promise<APIResponseWithTime<any>>;
|
|
88
|
+
setSlTpPositionMode(params: InverseSetSlTpPositionModeRequest): Promise<APIResponseWithTime<any>>;
|
|
89
|
+
setMarginType(params: InverseSetMarginTypeRequest): Promise<APIResponseWithTime<any>>;
|
|
198
90
|
/**
|
|
199
91
|
* Funding
|
|
200
92
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inverse-client.js","sourceRoot":"","sources":["../src/inverse-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iCAA+C;
|
|
1
|
+
{"version":3,"file":"inverse-client.js","sourceRoot":"","sources":["../src/inverse-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iCAA+C;AA6B/C,2EAAmD;AAEnD;;GAEG;AACH,MAAa,aAAc,SAAQ,wBAAc;IAC/C,aAAa;QACX,OAAO,4BAAqB,CAAC,OAAO,CAAC;IACvC,CAAC;IAEK,eAAe;;YACnB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;YACvC,OAAO,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9B,CAAC;KAAA;IAED;;;;OAIG;IAEH,YAAY,CAAC,MAAmB;QAC9B,OAAO,IAAI,CAAC,GAAG,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC;IAED,QAAQ,CACN,MAAoC;QAEpC,OAAO,IAAI,CAAC,GAAG,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,UAAU,CACR,MAA6B;QAE7B,OAAO,IAAI,CAAC,GAAG,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IAED,SAAS,CAAC,MAAwB;QAChC,OAAO,IAAI,CAAC,GAAG,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAED,iBAAiB,CACf,MAAoC;QAEpC,OAAO,IAAI,CAAC,GAAG,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC;IAED,kBAAkB,CAChB,MAAoC;QAEpC,OAAO,IAAI,CAAC,GAAG,CAAC,6BAA6B,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;IAED,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ACzE,CAAC;IAED;;OAEG;IAEH,UAAU,CAAC,MAAmB;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;CACF;AA7SD,sCA6SC"}
|
package/lib/linear-client.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { APIResponse, APIResponseWithTime, AssetExchangeRecordsReq, CoinParam, LinearOrder, NewLinearOrder, PerpPosition, PerpPositionRoot, SymbolInfo, SymbolIntervalFromLimitParam, SymbolLimitParam, SymbolParam, SymbolPeriodLimitParam, WalletBalances, WalletFundRecordsReq, WithdrawRecordsReq } from './types';
|
|
2
|
-
import { linearPositionModeEnum, positionTpSlModeEnum } from './constants/enum';
|
|
1
|
+
import { APIResponse, APIResponseWithTime, AssetExchangeRecordsReq, CoinParam, LinearCancelConditionalOrderRequest, LinearCancelOrderRequest, LinearConditionalOrderRequest, LinearGetClosedPnlRequest, LinearGetConditionalOrderRequest, LinearGetOrderRequest, LinearGetOrdersRequest, LinearGetTradeRecordsRequest, LinearOrder, LinearQueryConditionalOrderRequest, LinearReplaceConditionalOrderRequest, LinearReplaceOrderRequest, LinearSetAddReduceMarginRequest, LinearSetAutoAddMarginRequest, LinearSetMarginSwitchRequest, LinearSetPositionModeRequest, LinearSetPositionTpSlModeRequest, LinearSetRiskLimitRequest, LinearSetTradingStopRequest, LinearSetUserLeverageRequest, NewLinearOrder, PerpPosition, PerpPositionRoot, SymbolInfo, SymbolIntervalFromLimitParam, SymbolLimitParam, SymbolParam, SymbolPeriodLimitParam, WalletBalances, WalletFundRecordsReq, WithdrawRecordsReq } from './types';
|
|
3
2
|
import BaseRestClient from './util/BaseRestClient';
|
|
4
3
|
/**
|
|
5
4
|
* REST API client for linear/USD perpetual futures APIs (v2)
|
|
@@ -60,167 +59,46 @@ export declare class LinearClient extends BaseRestClient {
|
|
|
60
59
|
*
|
|
61
60
|
*/
|
|
62
61
|
placeActiveOrder(params: NewLinearOrder): Promise<APIResponseWithTime<LinearOrder | null>>;
|
|
63
|
-
getActiveOrderList(params:
|
|
64
|
-
|
|
65
|
-
order_link_id?: string;
|
|
66
|
-
symbol: string;
|
|
67
|
-
order?: string;
|
|
68
|
-
page?: number;
|
|
69
|
-
limit?: number;
|
|
70
|
-
order_status?: string;
|
|
71
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
72
|
-
cancelActiveOrder(params: {
|
|
73
|
-
symbol: string;
|
|
74
|
-
order_id?: string;
|
|
75
|
-
order_link_id?: string;
|
|
76
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
62
|
+
getActiveOrderList(params: LinearGetOrdersRequest): Promise<APIResponseWithTime<any>>;
|
|
63
|
+
cancelActiveOrder(params: LinearCancelOrderRequest): Promise<APIResponseWithTime<any>>;
|
|
77
64
|
cancelAllActiveOrders(params: SymbolParam): Promise<APIResponseWithTime<any>>;
|
|
78
|
-
replaceActiveOrder(params:
|
|
79
|
-
|
|
80
|
-
order_link_id?: string;
|
|
81
|
-
symbol: string;
|
|
82
|
-
p_r_qty?: number;
|
|
83
|
-
p_r_price?: number;
|
|
84
|
-
take_profit?: number;
|
|
85
|
-
stop_loss?: number;
|
|
86
|
-
tp_trigger_by?: string;
|
|
87
|
-
sl_trigger_by?: string;
|
|
88
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
89
|
-
queryActiveOrder(params: {
|
|
90
|
-
order_id?: string;
|
|
91
|
-
order_link_id?: string;
|
|
92
|
-
symbol: string;
|
|
93
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
65
|
+
replaceActiveOrder(params: LinearReplaceOrderRequest): Promise<APIResponseWithTime<any>>;
|
|
66
|
+
queryActiveOrder(params: LinearGetOrderRequest): Promise<APIResponseWithTime<any>>;
|
|
94
67
|
/**
|
|
95
68
|
* Conditional orders
|
|
96
69
|
*/
|
|
97
|
-
placeConditionalOrder(params:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
order_type: string;
|
|
101
|
-
qty: number;
|
|
102
|
-
price?: number;
|
|
103
|
-
base_price: number;
|
|
104
|
-
stop_px: number;
|
|
105
|
-
time_in_force: string;
|
|
106
|
-
trigger_by?: string;
|
|
107
|
-
close_on_trigger?: boolean;
|
|
108
|
-
order_link_id?: string;
|
|
109
|
-
reduce_only: boolean;
|
|
110
|
-
take_profit?: number;
|
|
111
|
-
stop_loss?: number;
|
|
112
|
-
tp_trigger_by?: string;
|
|
113
|
-
sl_trigger_by?: string;
|
|
114
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
115
|
-
getConditionalOrder(params: {
|
|
116
|
-
stop_order_id?: string;
|
|
117
|
-
order_link_id?: string;
|
|
118
|
-
symbol: string;
|
|
119
|
-
stop_order_status?: string;
|
|
120
|
-
order?: string;
|
|
121
|
-
page?: number;
|
|
122
|
-
limit?: number;
|
|
123
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
124
|
-
cancelConditionalOrder(params: {
|
|
125
|
-
symbol: string;
|
|
126
|
-
stop_order_id?: string;
|
|
127
|
-
order_link_id?: string;
|
|
128
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
70
|
+
placeConditionalOrder(params: LinearConditionalOrderRequest): Promise<APIResponseWithTime<any>>;
|
|
71
|
+
getConditionalOrder(params: LinearGetConditionalOrderRequest): Promise<APIResponseWithTime<any>>;
|
|
72
|
+
cancelConditionalOrder(params: LinearCancelConditionalOrderRequest): Promise<APIResponseWithTime<any>>;
|
|
129
73
|
cancelAllConditionalOrders(params: SymbolParam): Promise<APIResponseWithTime<any>>;
|
|
130
|
-
replaceConditionalOrder(params:
|
|
131
|
-
|
|
132
|
-
order_link_id?: string;
|
|
133
|
-
symbol: string;
|
|
134
|
-
p_r_qty?: number;
|
|
135
|
-
p_r_price?: number;
|
|
136
|
-
p_r_trigger_price?: number;
|
|
137
|
-
take_profit?: number;
|
|
138
|
-
stop_loss?: number;
|
|
139
|
-
tp_trigger_by?: string;
|
|
140
|
-
sl_trigger_by?: string;
|
|
141
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
142
|
-
queryConditionalOrder(params: {
|
|
143
|
-
symbol: string;
|
|
144
|
-
stop_order_id?: string;
|
|
145
|
-
order_link_id?: string;
|
|
146
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
74
|
+
replaceConditionalOrder(params: LinearReplaceConditionalOrderRequest): Promise<APIResponseWithTime<any>>;
|
|
75
|
+
queryConditionalOrder(params: LinearQueryConditionalOrderRequest): Promise<APIResponseWithTime<any>>;
|
|
147
76
|
/**
|
|
148
77
|
* Position
|
|
149
78
|
*/
|
|
150
79
|
getPosition(): Promise<APIResponseWithTime<PerpPositionRoot[]>>;
|
|
151
80
|
getPosition(params: Partial<SymbolParam>): Promise<APIResponseWithTime<PerpPosition[]>>;
|
|
152
|
-
setAutoAddMargin(params?:
|
|
153
|
-
|
|
154
|
-
side: string;
|
|
155
|
-
auto_add_margin: boolean;
|
|
156
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
157
|
-
setMarginSwitch(params?: {
|
|
158
|
-
symbol: string;
|
|
159
|
-
is_isolated: boolean;
|
|
160
|
-
buy_leverage: number;
|
|
161
|
-
sell_leverage: number;
|
|
162
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
81
|
+
setAutoAddMargin(params?: LinearSetAutoAddMarginRequest): Promise<APIResponseWithTime<any>>;
|
|
82
|
+
setMarginSwitch(params?: LinearSetMarginSwitchRequest): Promise<APIResponseWithTime<any>>;
|
|
163
83
|
/**
|
|
164
84
|
* Switch between one-way vs hedge mode. Use `linearPositionModeEnum` for the mode parameter.
|
|
165
85
|
*/
|
|
166
|
-
setPositionMode(params:
|
|
167
|
-
symbol: string;
|
|
168
|
-
mode: typeof linearPositionModeEnum[keyof typeof linearPositionModeEnum];
|
|
169
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
86
|
+
setPositionMode(params: LinearSetPositionModeRequest): Promise<APIResponseWithTime<any>>;
|
|
170
87
|
/**
|
|
171
88
|
* Switch TP/SL mode between full or partial. When set to Partial, TP/SL orders may have a quantity less than the position size.
|
|
172
89
|
* This is set with the setTradingStop() method. Use `positionTpSlModeEnum` for the tp_sl_mode parameter.
|
|
173
90
|
*/
|
|
174
|
-
setPositionTpSlMode(params:
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
side: string;
|
|
181
|
-
margin: number;
|
|
182
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
183
|
-
setUserLeverage(params: {
|
|
184
|
-
symbol: string;
|
|
185
|
-
buy_leverage: number;
|
|
186
|
-
sell_leverage: number;
|
|
187
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
188
|
-
setTradingStop(params: {
|
|
189
|
-
symbol: string;
|
|
190
|
-
side: string;
|
|
191
|
-
take_profit?: number;
|
|
192
|
-
stop_loss?: number;
|
|
193
|
-
trailing_stop?: number;
|
|
194
|
-
tp_trigger_by?: string;
|
|
195
|
-
sl_trigger_by?: string;
|
|
196
|
-
sl_size?: number;
|
|
197
|
-
tp_size?: number;
|
|
198
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
199
|
-
getTradeRecords(params: {
|
|
200
|
-
symbol: string;
|
|
201
|
-
start_time?: number;
|
|
202
|
-
end_time?: number;
|
|
203
|
-
exec_type?: string;
|
|
204
|
-
page?: number;
|
|
205
|
-
limit?: number;
|
|
206
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
207
|
-
getClosedPnl(params: {
|
|
208
|
-
symbol: string;
|
|
209
|
-
start_time?: number;
|
|
210
|
-
end_time?: number;
|
|
211
|
-
exec_type?: string;
|
|
212
|
-
page?: number;
|
|
213
|
-
limit?: number;
|
|
214
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
91
|
+
setPositionTpSlMode(params: LinearSetPositionTpSlModeRequest): Promise<APIResponseWithTime<any>>;
|
|
92
|
+
setAddReduceMargin(params?: LinearSetAddReduceMarginRequest): Promise<APIResponseWithTime<any>>;
|
|
93
|
+
setUserLeverage(params: LinearSetUserLeverageRequest): Promise<APIResponseWithTime<any>>;
|
|
94
|
+
setTradingStop(params: LinearSetTradingStopRequest): Promise<APIResponseWithTime<any>>;
|
|
95
|
+
getTradeRecords(params: LinearGetTradeRecordsRequest): Promise<APIResponseWithTime<any>>;
|
|
96
|
+
getClosedPnl(params: LinearGetClosedPnlRequest): Promise<APIResponseWithTime<any>>;
|
|
215
97
|
/**
|
|
216
98
|
* Risk Limit
|
|
217
99
|
*/
|
|
218
100
|
getRiskLimitList(params: SymbolParam): Promise<APIResponseWithTime<any>>;
|
|
219
|
-
setRiskLimit(params:
|
|
220
|
-
symbol: string;
|
|
221
|
-
side: string;
|
|
222
|
-
risk_id: number;
|
|
223
|
-
}): Promise<APIResponseWithTime<any>>;
|
|
101
|
+
setRiskLimit(params: LinearSetRiskLimitRequest): Promise<APIResponseWithTime<any>>;
|
|
224
102
|
/**
|
|
225
103
|
* Funding
|
|
226
104
|
*/
|
package/lib/linear-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linear-client.js","sourceRoot":"","sources":["../src/linear-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sDAA4D;
|
|
1
|
+
{"version":3,"file":"linear-client.js","sourceRoot":"","sources":["../src/linear-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sDAA4D;AAuC5D,2EAAmD;AAEnD;;GAEG;AACH,MAAa,YAAa,SAAQ,wBAAc;IAC9C,aAAa;QACX,OAAO,oCAAqB,CAAC,MAAM,CAAC;IACtC,CAAC;IAEK,eAAe;;YACnB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;YAC3C,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;KAAA;IAED;;;;OAIG;IAEH,YAAY,CAAC,MAAmB;QAC9B,OAAO,IAAI,CAAC,GAAG,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC;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rderQueryById, SpotBalances, KlineInterval, NewSpotOrderV3, SpotMyTradesRequest, SpotLeveragedTokenPRHistoryRequest, SpotCrossMarginBorrowingInfoRequest, SpotCrossMarginRepaymentHistoryRequest, SpotCancelOrderBatchRequest } from './types';
|
|
2
2
|
import BaseRestClient from './util/BaseRestClient';
|
|
3
3
|
/**
|
|
4
4
|
* REST API client for newer Spot V3 APIs.
|
|
@@ -40,11 +40,7 @@ export declare class SpotClientV3 extends BaseRestClient {
|
|
|
40
40
|
/** Cancel order */
|
|
41
41
|
cancelOrder(params: SpotOrderQueryById): Promise<APIResponseV3<any>>;
|
|
42
42
|
/** Batch cancel orders */
|
|
43
|
-
cancelOrderBatch(params:
|
|
44
|
-
symbol: string;
|
|
45
|
-
side?: OrderSide;
|
|
46
|
-
orderTypes: OrderTypeSpot[];
|
|
47
|
-
}): Promise<APIResponseV3<any>>;
|
|
43
|
+
cancelOrderBatch(params: SpotCancelOrderBatchRequest): Promise<APIResponseV3<any>>;
|
|
48
44
|
/** Batch cancel up to 100 orders by ID */
|
|
49
45
|
cancelOrderBatchIDs(orderIds: string[]): Promise<APIResponseV3<any>>;
|
|
50
46
|
/** Get open orders */
|