ccxt 4.3.4 → 4.3.5

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.
@@ -12,7 +12,7 @@ export default class cex extends cexRest {
12
12
  handleTrade(client: Client, message: any): void;
13
13
  watchTicker(symbol: string, params?: {}): Promise<Ticker>;
14
14
  watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
15
- fetchTickerWs(symbol: string, params?: {}): Promise<any>;
15
+ fetchTickerWs(symbol: string, params?: {}): Promise<Ticker>;
16
16
  handleTicker(client: Client, message: any): void;
17
17
  parseWsTicker(ticker: any, market?: any): Ticker;
18
18
  fetchBalanceWs(params?: {}): Promise<Balances>;
@@ -7,7 +7,7 @@ export default class lbank extends lbankRest {
7
7
  fetchOHLCVWs(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
8
8
  watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
9
9
  handleOHLCV(client: any, message: any): void;
10
- fetchTickerWs(symbol: any, params?: {}): Promise<Ticker>;
10
+ fetchTickerWs(symbol: string, params?: {}): Promise<Ticker>;
11
11
  watchTicker(symbol: string, params?: {}): Promise<Ticker>;
12
12
  handleTicker(client: any, message: any): void;
13
13
  parseWsTicker(ticker: any, market?: any): Ticker;
package/js/src/pro/woo.js CHANGED
@@ -75,7 +75,6 @@ export default class woo extends wooRest {
75
75
  return newValue;
76
76
  }
77
77
  async watchPublic(messageHash, message) {
78
- this.checkRequiredUid();
79
78
  const url = this.urls['api']['ws']['public'] + '/' + this.uid;
80
79
  const requestId = this.requestId(url);
81
80
  const subscribe = {
@@ -15,7 +15,7 @@ export declare class BigInteger {
15
15
  protected intValue(): number;
16
16
  protected byteValue(): number;
17
17
  protected shortValue(): number;
18
- protected signum(): 0 | 1 | -1;
18
+ protected signum(): 1 | 0 | -1;
19
19
  toByteArray(): number[];
20
20
  protected equals(a: BigInteger): boolean;
21
21
  protected min(a: BigInteger): BigInteger;
@@ -35,7 +35,9 @@ export default class whitebit extends Exchange {
35
35
  }>;
36
36
  fetchTime(params?: {}): Promise<number>;
37
37
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
38
+ editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
38
39
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
40
+ cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
39
41
  parseBalance(response: any): Balances;
40
42
  fetchBalance(params?: {}): Promise<Balances>;
41
43
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
@@ -31,7 +31,7 @@ export default class whitebit extends Exchange {
31
31
  'swap': false,
32
32
  'future': false,
33
33
  'option': false,
34
- 'cancelAllOrders': false,
34
+ 'cancelAllOrders': true,
35
35
  'cancelOrder': true,
36
36
  'cancelOrders': false,
37
37
  'createOrder': true,
@@ -176,11 +176,13 @@ export default class whitebit extends Exchange {
176
176
  'ping',
177
177
  'markets',
178
178
  'futures',
179
+ 'platform/status',
179
180
  ],
180
181
  },
181
182
  'private': {
182
183
  'post': [
183
184
  'collateral-account/balance',
185
+ 'collateral-account/balance-summary',
184
186
  'collateral-account/positions/history',
185
187
  'collateral-account/leverage',
186
188
  'collateral-account/positions/open',
@@ -197,21 +199,40 @@ export default class whitebit extends Exchange {
197
199
  'main-account/withdraw',
198
200
  'main-account/withdraw-pay',
199
201
  'main-account/transfer',
202
+ 'main-account/smart/plans',
203
+ 'main-account/smart/investment',
204
+ 'main-account/smart/investment/close',
205
+ 'main-account/smart/investments',
206
+ 'main-account/fee',
207
+ 'main-account/smart/interest-payment-history',
200
208
  'trade-account/balance',
201
209
  'trade-account/executed-history',
202
210
  'trade-account/order',
203
211
  'trade-account/order/history',
204
212
  'order/collateral/limit',
205
213
  'order/collateral/market',
206
- 'order/collateral/trigger_market',
214
+ 'order/collateral/stop-limit',
215
+ 'order/collateral/trigger-market',
207
216
  'order/new',
208
217
  'order/market',
209
218
  'order/stock_market',
210
219
  'order/stop_limit',
211
220
  'order/stop_market',
212
221
  'order/cancel',
222
+ 'order/cancel/all',
223
+ 'order/kill-switch',
224
+ 'order/kill-switch/status',
225
+ 'order/bulk',
226
+ 'order/modify',
213
227
  'orders',
228
+ 'oco-orders',
229
+ 'order/collateral/oco',
230
+ 'order/oco-cancel',
231
+ 'order/oto-cancel',
214
232
  'profile/websocket_token',
233
+ 'convert/estimate',
234
+ 'convert/confirm',
235
+ 'convert/history',
215
236
  ],
216
237
  },
217
238
  },
@@ -1260,6 +1281,70 @@ export default class whitebit extends Exchange {
1260
1281
  }
1261
1282
  return this.parseOrder(response);
1262
1283
  }
1284
+ async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
1285
+ /**
1286
+ * @method
1287
+ * @name whitebit#editOrder
1288
+ * @description edit a trade order
1289
+ * @see https://docs.whitebit.com/private/http-trade-v4/#modify-order
1290
+ * @param {string} id cancel order id
1291
+ * @param {string} symbol unified symbol of the market to create an order in
1292
+ * @param {string} type 'market' or 'limit'
1293
+ * @param {string} side 'buy' or 'sell'
1294
+ * @param {float} amount how much of currency you want to trade in units of base currency
1295
+ * @param {float} price the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
1296
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1297
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1298
+ */
1299
+ if (id === undefined) {
1300
+ throw new ArgumentsRequired(this.id + ' editOrder() requires a id argument');
1301
+ }
1302
+ if (symbol === undefined) {
1303
+ throw new ArgumentsRequired(this.id + ' editOrder() requires a symbol argument');
1304
+ }
1305
+ await this.loadMarkets();
1306
+ const market = this.market(symbol);
1307
+ const request = {
1308
+ 'orderId': id,
1309
+ 'market': market['id'],
1310
+ };
1311
+ const clientOrderId = this.safeString2(params, 'clOrdId', 'clientOrderId');
1312
+ if (clientOrderId !== undefined) {
1313
+ // Update clientOrderId of the order
1314
+ request['clientOrderId'] = clientOrderId;
1315
+ }
1316
+ const isLimitOrder = type === 'limit';
1317
+ const stopPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'activation_price']);
1318
+ const isStopOrder = (stopPrice !== undefined);
1319
+ params = this.omit(params, ['clOrdId', 'clientOrderId', 'triggerPrice', 'stopPrice']);
1320
+ if (isStopOrder) {
1321
+ request['activation_price'] = this.priceToPrecision(symbol, stopPrice);
1322
+ if (isLimitOrder) {
1323
+ // stop limit order
1324
+ request['amount'] = this.amountToPrecision(symbol, amount);
1325
+ request['price'] = this.priceToPrecision(symbol, price);
1326
+ }
1327
+ else {
1328
+ // stop market order
1329
+ if (side === 'buy') {
1330
+ // Use total parameter instead of amount for modify buy stop market order
1331
+ request['total'] = this.amountToPrecision(symbol, amount);
1332
+ }
1333
+ else {
1334
+ request['amount'] = this.amountToPrecision(symbol, amount);
1335
+ }
1336
+ }
1337
+ }
1338
+ else {
1339
+ request['amount'] = this.amountToPrecision(symbol, amount);
1340
+ if (isLimitOrder) {
1341
+ // limit order
1342
+ request['price'] = this.priceToPrecision(symbol, price);
1343
+ }
1344
+ }
1345
+ const response = await this.v4PrivatePostOrderModify(this.extend(request, params));
1346
+ return this.parseOrder(response);
1347
+ }
1263
1348
  async cancelOrder(id, symbol = undefined, params = {}) {
1264
1349
  /**
1265
1350
  * @method
@@ -1282,6 +1367,51 @@ export default class whitebit extends Exchange {
1282
1367
  };
1283
1368
  return await this.v4PrivatePostOrderCancel(this.extend(request, params));
1284
1369
  }
1370
+ async cancelAllOrders(symbol = undefined, params = {}) {
1371
+ /**
1372
+ * @method
1373
+ * @name whitebit#cancelAllOrders
1374
+ * @description cancel all open orders
1375
+ * @see https://docs.whitebit.com/private/http-trade-v4/#cancel-all-orders
1376
+ * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
1377
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1378
+ * @param {string} [params.type] market type, ['swap', 'spot']
1379
+ * @param {boolean} [params.isMargin] cancel all margin orders
1380
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1381
+ */
1382
+ await this.loadMarkets();
1383
+ let market = undefined;
1384
+ const request = {};
1385
+ if (symbol !== undefined) {
1386
+ market = this.market(symbol);
1387
+ request['market'] = market['id'];
1388
+ }
1389
+ let type = undefined;
1390
+ [type, params] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
1391
+ const requestType = [];
1392
+ if (type === 'spot') {
1393
+ let isMargin = undefined;
1394
+ [isMargin, params] = this.handleOptionAndParams(params, 'cancelAllOrders', 'isMargin', false);
1395
+ if (isMargin) {
1396
+ requestType.push('margin');
1397
+ }
1398
+ else {
1399
+ requestType.push('spot');
1400
+ }
1401
+ }
1402
+ else if (type === 'swap') {
1403
+ requestType.push('futures');
1404
+ }
1405
+ else {
1406
+ throw new NotSupported(this.id + ' cancelAllOrders() does not support ' + type + ' type');
1407
+ }
1408
+ request['type'] = requestType;
1409
+ const response = await this.v4PrivatePostOrderCancelAll(this.extend(request, params));
1410
+ //
1411
+ // []
1412
+ //
1413
+ return response;
1414
+ }
1285
1415
  parseBalance(response) {
1286
1416
  const balanceKeys = Object.keys(response);
1287
1417
  const result = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.4",
3
+ "version": "4.3.5",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",