okx-api 1.1.3 → 1.1.4

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,14 +1,14 @@
1
- import { InstrumentType } from '../shared';
1
+ import { InstrumentType, MarginMode, PositionSide } from '../shared';
2
2
  export interface SetLeverageRequest {
3
3
  instId?: string;
4
4
  ccy?: string;
5
5
  lever: string;
6
- mgnMode: 'isolated' | 'cross';
6
+ mgnMode: MarginMode;
7
7
  posSide?: 'long' | 'short';
8
8
  }
9
9
  export interface ChangePositionMarginRequest {
10
10
  instId: string;
11
- posSide: 'long' | 'short' | 'net';
11
+ posSide: PositionSide;
12
12
  type: 'add' | 'reduce';
13
13
  amt: string;
14
14
  ccy?: string;
@@ -2,7 +2,7 @@ import { TradeMode, OrderSide, PositionSide, AlgoOrderType, numberInString, Pric
2
2
  export interface AlgoRecentHistoryRequest {
3
3
  ordType: AlgoOrderType;
4
4
  algoId?: string;
5
- instType?: string;
5
+ instType?: InstrumentType;
6
6
  instId?: string;
7
7
  after?: string;
8
8
  before?: string;
@@ -12,7 +12,7 @@ export interface AlgoLongHistoryRequest {
12
12
  ordType: AlgoOrderType;
13
13
  state?: AlgoState;
14
14
  algoId?: string;
15
- instType?: string;
15
+ instType?: InstrumentType;
16
16
  instId?: string;
17
17
  after?: string;
18
18
  before?: string;
@@ -23,7 +23,7 @@ export interface AlgoOrderRequest {
23
23
  tdMode: TradeMode;
24
24
  ccy?: string;
25
25
  side: OrderSide;
26
- posSide?: PositionSide;
26
+ posSide?: Omit<PositionSide, 'net'>;
27
27
  ordType: AlgoOrderType;
28
28
  sz: numberInString;
29
29
  tag?: string;
@@ -1,3 +1,4 @@
1
+ import { MarginMode, PositionSide } from "../shared";
1
2
  export interface AccountBalance {
2
3
  adjEq: string;
3
4
  details: AccountBalanceDetail[];
@@ -57,7 +58,7 @@ export interface AccountPosition {
57
58
  liqPx: string;
58
59
  markPx: string;
59
60
  margin: string;
60
- mgnMode: string;
61
+ mgnMode: MarginMode;
61
62
  mgnRatio: string;
62
63
  mmr: string;
63
64
  notionalUsd: string;
@@ -66,7 +67,7 @@ export interface AccountPosition {
66
67
  pos: string;
67
68
  posCcy: string;
68
69
  posId: string;
69
- posSide: string;
70
+ posSide: PositionSide;
70
71
  thetaBS: string;
71
72
  thetaPA: string;
72
73
  tradeId: string;
@@ -84,13 +85,13 @@ export interface HistoricAccountPosition {
84
85
  instId: string;
85
86
  instType: string;
86
87
  lever: string;
87
- mgnMode: string;
88
+ mgnMode: MarginMode;
88
89
  openAvgPx: string;
89
90
  openMaxPos: string;
90
91
  pnl: string;
91
92
  pnlRatio: string;
92
93
  posId: string;
93
- posSide: string;
94
+ posSide: PositionSide;
94
95
  triggerPx: string;
95
96
  type: string;
96
97
  uTime: string;
@@ -106,13 +107,13 @@ export interface AccountPositionRiskData {
106
107
  ccy: string;
107
108
  instId: string;
108
109
  instType: string;
109
- mgnMode: string;
110
+ mgnMode: MarginMode;
110
111
  notionalCcy: string;
111
112
  notionalUsd: string;
112
113
  pos: string;
113
114
  posCcy: string;
114
115
  posId: string;
115
- posSide: string;
116
+ posSide: PositionSide;
116
117
  quoteBal: string;
117
118
  }
118
119
  export interface AccountPositionRisk {
@@ -131,7 +132,7 @@ export interface AccountBill {
131
132
  from: string;
132
133
  instId: string;
133
134
  instType: string;
134
- mgnMode: string;
135
+ mgnMode: MarginMode;
135
136
  notes: string;
136
137
  ordId: string;
137
138
  pnl: string;
@@ -152,16 +153,27 @@ export interface AccountConfiguration {
152
153
  levelTmp: string;
153
154
  mgnIsoMode: string;
154
155
  posMode: string;
156
+ spotOffsetType: string;
155
157
  uid: string;
158
+ label: string;
159
+ roleType: string;
160
+ traderInsts: any[];
161
+ spotRoleType: string;
162
+ spotTraderInsts: any[];
163
+ opAuth: string;
164
+ kycLv: string;
165
+ ip: string;
166
+ perm: string;
167
+ mainUid: string;
156
168
  }
157
169
  export interface AccountPositionModeResult {
158
170
  posMode: string;
159
171
  }
160
172
  export interface AccountLeverageResult {
161
173
  lever: string;
162
- mgnMode: string;
174
+ mgnMode: MarginMode;
163
175
  instId: string;
164
- posSide: string;
176
+ posSide: PositionSide;
165
177
  }
166
178
  export interface AccountMaxOrderAmount {
167
179
  ccy: string;
@@ -179,18 +191,18 @@ export interface AccountChangeMarginResult {
179
191
  ccy: string;
180
192
  instId: string;
181
193
  leverage: string;
182
- posSide: string;
194
+ posSide: PositionSide;
183
195
  type: string;
184
196
  }
185
197
  export interface AccountLeverage {
186
198
  instId: string;
187
- mgnMode: string;
188
- posSide: string;
199
+ mgnMode: MarginMode;
200
+ posSide: PositionSide;
189
201
  lever: string;
190
202
  }
191
203
  export interface AccountMaxLoan {
192
204
  instId: string;
193
- mgnMode: string;
205
+ mgnMode: MarginMode;
194
206
  mgnCcy: string;
195
207
  maxLoan: string;
196
208
  ccy: string;
@@ -1,4 +1,4 @@
1
- import { numberInString } from '../shared';
1
+ import { PositionSide, numberInString } from '../shared';
2
2
  export interface OrderResult {
3
3
  clOrdId: string;
4
4
  ordId: string;
@@ -21,7 +21,7 @@ export interface AmendedOrder {
21
21
  }
22
22
  export interface ClosedPositions {
23
23
  instId: string;
24
- posSide: string;
24
+ posSide: PositionSide;
25
25
  }
26
26
  export interface OrderDetails {
27
27
  instType: string;
@@ -35,7 +35,7 @@ export interface OrderDetails {
35
35
  pnl: string;
36
36
  ordType: string;
37
37
  side: string;
38
- posSide: string;
38
+ posSide: PositionSide;
39
39
  tdMode: string;
40
40
  accFillSz: string;
41
41
  fillPx: string;
@@ -78,7 +78,7 @@ export interface OrderListItem {
78
78
  ordId: string;
79
79
  ordType: string;
80
80
  pnl: string;
81
- posSide: string;
81
+ posSide: PositionSide;
82
82
  px: string;
83
83
  rebate: string;
84
84
  rebateCcy: string;
@@ -109,7 +109,7 @@ export interface HistoricOrder {
109
109
  sz: string;
110
110
  ordType: string;
111
111
  side: string;
112
- posSide: string;
112
+ posSide: PositionSide;
113
113
  tdMode: string;
114
114
  accFillSz: string;
115
115
  fillPx: string;
@@ -147,7 +147,7 @@ export interface OrderFill {
147
147
  fillPx: string;
148
148
  fillSz: string;
149
149
  side: string;
150
- posSide: string;
150
+ posSide: PositionSide;
151
151
  execType: string;
152
152
  feeCcy: string;
153
153
  fee: string;
@@ -167,7 +167,7 @@ export interface AlgoOrderListItem {
167
167
  sz: string;
168
168
  ordType: string;
169
169
  side: string;
170
- posSide: string;
170
+ posSide: PositionSide;
171
171
  tdMode: string;
172
172
  tgtCcy: string;
173
173
  state: string;
@@ -205,7 +205,7 @@ export interface HistoricAlgoOrder {
205
205
  sz: string;
206
206
  ordType: string;
207
207
  side: string;
208
- posSide: string;
208
+ posSide: PositionSide;
209
209
  tdMode: string;
210
210
  tgtCcy: string;
211
211
  state: string;
@@ -6,14 +6,14 @@ export interface WsEvent {
6
6
  arg?: any;
7
7
  data?: any;
8
8
  }
9
- export interface WsDataEvent {
9
+ export interface WsDataEvent<T = any> {
10
10
  arg: {
11
11
  channel: WsChannel;
12
12
  uid?: string;
13
13
  instId?: string;
14
14
  instFamily?: string;
15
15
  };
16
- data: any;
16
+ data: T;
17
17
  }
18
18
  export interface WsLoginEvent extends WsEvent {
19
19
  event: 'login';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "okx-api",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Complete & robust Node.js SDK for OKX's REST APIs and WebSockets, with TypeScript & end-to-end tests",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",