ccxt 4.0.111 → 4.0.112

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.
@@ -74681,16 +74681,16 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
74681
74681
  triggerPrice = isStopLossTriggerOrder ? stopLossTriggerPrice : takeProfitTriggerPrice;
74682
74682
  }
74683
74683
  if (triggerPrice !== undefined) {
74684
- request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
74684
+ request['triggerPrice'] = triggerPrice;
74685
74685
  }
74686
74686
  if (isStopLoss || isTakeProfit) {
74687
74687
  if (isStopLoss) {
74688
74688
  const slTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
74689
- request['stopLoss'] = this.priceToPrecision(symbol, slTriggerPrice);
74689
+ request['stopLoss'] = slTriggerPrice;
74690
74690
  }
74691
74691
  if (isTakeProfit) {
74692
74692
  const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
74693
- request['takeProfit'] = this.priceToPrecision(symbol, tpTriggerPrice);
74693
+ request['takeProfit'] = tpTriggerPrice;
74694
74694
  }
74695
74695
  }
74696
74696
  const clientOrderId = this.safeString(params, 'clientOrderId');
@@ -77237,9 +77237,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
77237
77237
  // "time": 1670988271677
77238
77238
  // }
77239
77239
  //
77240
- const data = this.safeValue(response, 'result', {});
77241
- const transfers = this.safeValue(data, 'list', []);
77242
- return this.parseTransfers(transfers, currency, since, limit);
77240
+ const data = this.addPaginationCursorToResult(response);
77241
+ return this.parseTransfers(data, currency, since, limit);
77243
77242
  }
77244
77243
  async borrowMargin(code, amount, symbol = undefined, params = {}) {
77245
77244
  /**
@@ -83187,6 +83186,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
83187
83186
  /**
83188
83187
  * @method
83189
83188
  * @name coinbasepro#fetchOrderBook
83189
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproductbook
83190
83190
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
83191
83191
  * @param {string} symbol unified symbol of the market to fetch the order book for
83192
83192
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -83352,6 +83352,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
83352
83352
  /**
83353
83353
  * @method
83354
83354
  * @name coinbasepro#fetchTicker
83355
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproductticker
83355
83356
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
83356
83357
  * @param {string} symbol unified symbol of the market to fetch the ticker for
83357
83358
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
@@ -83465,17 +83466,16 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
83465
83466
  /**
83466
83467
  * @method
83467
83468
  * @name coinbasepro#fetchMyTrades
83469
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getfills
83468
83470
  * @description fetch all trades made by the user
83469
83471
  * @param {string} symbol unified market symbol
83470
83472
  * @param {int} [since] the earliest time in ms to fetch trades for
83471
83473
  * @param {int} [limit] the maximum number of trades structures to retrieve
83472
83474
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
83475
+ * @param {int} [params.until] the latest time in ms to fetch trades for
83473
83476
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
83474
83477
  */
83475
- // as of 2018-08-23
83476
- if (symbol === undefined) {
83477
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
83478
- }
83478
+ this.checkRequiredSymbol('fetchMyTrades', symbol);
83479
83479
  await this.loadMarkets();
83480
83480
  const market = this.market(symbol);
83481
83481
  const request = {
@@ -83484,6 +83484,14 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
83484
83484
  if (limit !== undefined) {
83485
83485
  request['limit'] = limit;
83486
83486
  }
83487
+ if (since !== undefined) {
83488
+ request['start_date'] = this.iso8601(since);
83489
+ }
83490
+ const until = this.safeValue2(params, 'until', 'end_date');
83491
+ if (until !== undefined) {
83492
+ params = this.omit(params, ['until']);
83493
+ request['end_date'] = this.iso8601(until);
83494
+ }
83487
83495
  const response = await this.privateGetFills(this.extend(request, params));
83488
83496
  return this.parseTrades(response, market, since, limit);
83489
83497
  }
@@ -83491,6 +83499,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
83491
83499
  /**
83492
83500
  * @method
83493
83501
  * @name coinbasepro#fetchTrades
83502
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproducttrades
83494
83503
  * @description get the list of most recent trades for a particular symbol
83495
83504
  * @param {string} symbol unified symbol of the market to fetch trades for
83496
83505
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
@@ -83577,12 +83586,14 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
83577
83586
  /**
83578
83587
  * @method
83579
83588
  * @name coinbasepro#fetchOHLCV
83589
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproductcandles
83580
83590
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
83581
83591
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
83582
83592
  * @param {string} timeframe the length of time each candle represents
83583
83593
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
83584
83594
  * @param {int} [limit] the maximum amount of candles to fetch
83585
83595
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
83596
+ * @param {int} [params.until] the latest time in ms to fetch trades for
83586
83597
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
83587
83598
  */
83588
83599
  await this.loadMarkets();
@@ -83597,6 +83608,8 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
83597
83608
  else {
83598
83609
  request['granularity'] = timeframe;
83599
83610
  }
83611
+ const until = this.safeValue2(params, 'until', 'end');
83612
+ params = this.omit(params, ['until']);
83600
83613
  if (since !== undefined) {
83601
83614
  request['start'] = this.iso8601(since);
83602
83615
  if (limit === undefined) {
@@ -83606,12 +83619,17 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
83606
83619
  else {
83607
83620
  limit = Math.min(300, limit);
83608
83621
  }
83609
- const parsedTimeframeMilliseconds = parsedTimeframe * 1000;
83610
- if (since % parsedTimeframeMilliseconds === 0) {
83611
- request['end'] = this.iso8601(this.sum((limit - 1) * parsedTimeframeMilliseconds, since));
83622
+ if (until === undefined) {
83623
+ const parsedTimeframeMilliseconds = parsedTimeframe * 1000;
83624
+ if (since % parsedTimeframeMilliseconds === 0) {
83625
+ request['end'] = this.iso8601(this.sum((limit - 1) * parsedTimeframeMilliseconds, since));
83626
+ }
83627
+ else {
83628
+ request['end'] = this.iso8601(this.sum(limit * parsedTimeframeMilliseconds, since));
83629
+ }
83612
83630
  }
83613
83631
  else {
83614
- request['end'] = this.iso8601(this.sum(limit * parsedTimeframeMilliseconds, since));
83632
+ request['end'] = this.iso8601(until);
83615
83633
  }
83616
83634
  }
83617
83635
  const response = await this.publicGetProductsIdCandles(this.extend(request, params));
@@ -83731,6 +83749,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
83731
83749
  /**
83732
83750
  * @method
83733
83751
  * @name coinbasepro#fetchOrder
83752
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorder
83734
83753
  * @description fetches information on an order made by the user
83735
83754
  * @param {string} symbol not used by coinbasepro fetchOrder
83736
83755
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
@@ -83779,11 +83798,13 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
83779
83798
  /**
83780
83799
  * @method
83781
83800
  * @name coinbasepro#fetchOrders
83801
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorders
83782
83802
  * @description fetches information on multiple orders made by the user
83783
83803
  * @param {string} symbol unified market symbol of the market orders were made in
83784
83804
  * @param {int} [since] the earliest time in ms to fetch orders for
83785
83805
  * @param {int} [limit] the maximum number of orde structures to retrieve
83786
83806
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
83807
+ * @param {int} [params.until] the latest time in ms to fetch open orders for
83787
83808
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
83788
83809
  */
83789
83810
  const request = {
@@ -83795,11 +83816,13 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
83795
83816
  /**
83796
83817
  * @method
83797
83818
  * @name coinbasepro#fetchOpenOrders
83819
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorders
83798
83820
  * @description fetch all unfilled currently open orders
83799
83821
  * @param {string} symbol unified market symbol
83800
83822
  * @param {int} [since] the earliest time in ms to fetch open orders for
83801
83823
  * @param {int} [limit] the maximum number of open orders structures to retrieve
83802
83824
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
83825
+ * @param {int} [params.until] the latest time in ms to fetch open orders for
83803
83826
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
83804
83827
  */
83805
83828
  await this.loadMarkets();
@@ -83812,6 +83835,14 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
83812
83835
  if (limit !== undefined) {
83813
83836
  request['limit'] = limit; // default 100
83814
83837
  }
83838
+ if (since !== undefined) {
83839
+ request['start_date'] = this.iso8601(since);
83840
+ }
83841
+ const until = this.safeValue2(params, 'until', 'end_date');
83842
+ if (until !== undefined) {
83843
+ params = this.omit(params, ['until']);
83844
+ request['end_date'] = this.iso8601(until);
83845
+ }
83815
83846
  const response = await this.privateGetOrders(this.extend(request, params));
83816
83847
  return this.parseOrders(response, market, since, limit);
83817
83848
  }
@@ -83819,11 +83850,13 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
83819
83850
  /**
83820
83851
  * @method
83821
83852
  * @name coinbasepro#fetchClosedOrders
83853
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorders
83822
83854
  * @description fetches information on multiple closed orders made by the user
83823
83855
  * @param {string} symbol unified market symbol of the market orders were made in
83824
83856
  * @param {int} [since] the earliest time in ms to fetch orders for
83825
83857
  * @param {int} [limit] the maximum number of orde structures to retrieve
83826
83858
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
83859
+ * @param {int} [params.until] the latest time in ms to fetch open orders for
83827
83860
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
83828
83861
  */
83829
83862
  const request = {
@@ -83835,6 +83868,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
83835
83868
  /**
83836
83869
  * @method
83837
83870
  * @name coinbasepro#createOrder
83871
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postorders
83838
83872
  * @description create a trade order
83839
83873
  * @param {string} symbol unified symbol of the market to create an order in
83840
83874
  * @param {string} type 'market' or 'limit'
@@ -83930,6 +83964,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
83930
83964
  /**
83931
83965
  * @method
83932
83966
  * @name coinbasepro#cancelOrder
83967
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_deleteorder
83933
83968
  * @description cancels an open order
83934
83969
  * @param {string} id order id
83935
83970
  * @param {string} symbol unified symbol of the market the order was made in
@@ -83962,6 +83997,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
83962
83997
  /**
83963
83998
  * @method
83964
83999
  * @name coinbasepro#cancelAllOrders
84000
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_deleteorders
83965
84001
  * @description cancel all open orders
83966
84002
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
83967
84003
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
@@ -84148,11 +84184,13 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
84148
84184
  /**
84149
84185
  * @method
84150
84186
  * @name coinbasepro#fetchLedger
84187
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccountledger
84151
84188
  * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
84152
84189
  * @param {string} code unified currency code, default is undefined
84153
84190
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
84154
84191
  * @param {int} [limit] max number of ledger entrys to return, default is undefined
84155
84192
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
84193
+ * @param {int} [params.until] the latest time in ms to fetch trades for
84156
84194
  * @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
84157
84195
  */
84158
84196
  // https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccountledger
@@ -84182,6 +84220,11 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
84182
84220
  if (limit !== undefined) {
84183
84221
  request['limit'] = limit; // default 100
84184
84222
  }
84223
+ const until = this.safeValue2(params, 'until', 'end_date');
84224
+ if (until !== undefined) {
84225
+ params = this.omit(params, ['until']);
84226
+ request['end_date'] = this.iso8601(until);
84227
+ }
84185
84228
  const response = await this.privateGetAccountsIdLedger(this.extend(request, params));
84186
84229
  for (let i = 0; i < response.length; i++) {
84187
84230
  response[i]['currency'] = code;
@@ -152432,6 +152475,10 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
152432
152475
  'cancelAllOrders': true,
152433
152476
  'cancelOrder': true,
152434
152477
  'createOrder': true,
152478
+ 'createPostOnlyOrder': false,
152479
+ 'createStopOrder': true,
152480
+ 'createStopLimitOrder': true,
152481
+ 'createStopMarketOrder': false,
152435
152482
  'fetchBalance': true,
152436
152483
  'fetchBorrowRate': false,
152437
152484
  'fetchBorrowRateHistories': false,
@@ -153354,16 +153401,16 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
153354
153401
  //
153355
153402
  // createOrder
153356
153403
  //
153357
- // {
153358
- // "orderId":"1563460093.134037.704945@0370:2",
153359
- // "cliOrdId":"",
153360
- // "pairId":370,
153361
- // "symbol":"ETHBTC",
153362
- // "side":"sell",
153363
- // "orderType":"limit",
153364
- // "price":1.0,
153365
- // "amount":1.0
153366
- // }
153404
+ // {
153405
+ // "baseCurrency": "f7dac554-8139-4ff6-841f-0e586a5984a0",
153406
+ // "quoteCurrency": "a5a7a7a9-e2a3-43f9-8754-29a02f6b709b",
153407
+ // "side": "BID",
153408
+ // "clientOrderId": "my-wonderful-order-number-71566",
153409
+ // "price": "10103.19",
153410
+ // "stopPrice": "10103.19",
153411
+ // "quantity": "3.21",
153412
+ // "timestamp": 1568185507
153413
+ // }
153367
153414
  //
153368
153415
  // fetchOrder, fetchOpenOrders, fetchOrders
153369
153416
  //
@@ -153431,6 +153478,7 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
153431
153478
  }
153432
153479
  const clientOrderId = this.safeString(order, 'clientOrderId');
153433
153480
  const timeInForce = this.parseTimeInForce(this.safeString(order, 'condition'));
153481
+ const triggerPrice = this.safeString(order, 'stopPrice');
153434
153482
  return this.safeOrder({
153435
153483
  'id': id,
153436
153484
  'clientOrderId': clientOrderId,
@@ -153445,8 +153493,8 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
153445
153493
  'postOnly': undefined,
153446
153494
  'side': side,
153447
153495
  'price': price,
153448
- 'stopPrice': undefined,
153449
- 'triggerPrice': undefined,
153496
+ 'stopPrice': triggerPrice,
153497
+ 'triggerPrice': triggerPrice,
153450
153498
  'cost': cost,
153451
153499
  'amount': amount,
153452
153500
  'filled': filled,
@@ -153461,22 +153509,33 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
153461
153509
  * @method
153462
153510
  * @name latoken#fetchOpenOrders
153463
153511
  * @description fetch all unfilled currently open orders
153512
+ * @see https://api.latoken.com/doc/v2/#tag/Order/operation/getMyActiveOrdersByPair
153513
+ * @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getMyActiveStopOrdersByPair // stop
153464
153514
  * @param {string} symbol unified market symbol
153465
153515
  * @param {int} [since] the earliest time in ms to fetch open orders for
153466
153516
  * @param {int} [limit] the maximum number of open orders structures to retrieve
153467
153517
  * @param {object} [params] extra parameters specific to the latoken api endpoint
153518
+ * @param {boolean} [params.trigger] true if fetching trigger orders
153468
153519
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
153469
- */
153470
- if (symbol === undefined) {
153471
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
153472
- }
153520
+ */
153473
153521
  await this.loadMarkets();
153474
- const market = this.market(symbol);
153522
+ let response = undefined;
153523
+ let market = undefined;
153524
+ const isTrigger = this.safeValue2(params, 'trigger', 'stop');
153525
+ params = this.omit(params, 'stop');
153526
+ this.checkRequiredSymbol('fetchOpenOrders', symbol);
153527
+ // privateGetAuthOrderActive doesn't work even though its listed at https://api.latoken.com/doc/v2/#tag/Order/operation/getMyActiveOrders
153528
+ market = this.market(symbol);
153475
153529
  const request = {
153476
153530
  'currency': market['baseId'],
153477
153531
  'quote': market['quoteId'],
153478
153532
  };
153479
- const response = await this.privateGetAuthOrderPairCurrencyQuoteActive(this.extend(request, params));
153533
+ if (isTrigger) {
153534
+ response = await this.privateGetAuthStopOrderPairCurrencyQuoteActive(this.extend(request, params));
153535
+ }
153536
+ else {
153537
+ response = await this.privateGetAuthOrderPairCurrencyQuoteActive(this.extend(request, params));
153538
+ }
153480
153539
  //
153481
153540
  // [
153482
153541
  // {
@@ -153506,10 +153565,15 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
153506
153565
  * @method
153507
153566
  * @name latoken#fetchOrders
153508
153567
  * @description fetches information on multiple orders made by the user
153568
+ * @see https://api.latoken.com/doc/v2/#tag/Order/operation/getMyOrders
153569
+ * @see https://api.latoken.com/doc/v2/#tag/Order/operation/getMyOrdersByPair
153570
+ * @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getMyStopOrders // stop
153571
+ * @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getMyStopOrdersByPair // stop
153509
153572
  * @param {string} symbol unified market symbol of the market orders were made in
153510
153573
  * @param {int} [since] the earliest time in ms to fetch orders for
153511
153574
  * @param {int} [limit] the maximum number of orde structures to retrieve
153512
153575
  * @param {object} [params] extra parameters specific to the latoken api endpoint
153576
+ * @param {boolean} [params.trigger] true if fetching trigger orders
153513
153577
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
153514
153578
  */
153515
153579
  await this.loadMarkets();
@@ -153519,18 +153583,32 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
153519
153583
  // 'from': this.milliseconds (),
153520
153584
  // 'limit': limit, // default '100'
153521
153585
  };
153522
- let method = 'privateGetAuthOrder';
153523
153586
  let market = undefined;
153587
+ const isTrigger = this.safeValue2(params, 'trigger', 'stop');
153588
+ params = this.omit(params, ['stop', 'trigger']);
153589
+ if (limit !== undefined) {
153590
+ request['limit'] = limit; // default 100
153591
+ }
153592
+ let response = undefined;
153524
153593
  if (symbol !== undefined) {
153525
153594
  market = this.market(symbol);
153526
153595
  request['currency'] = market['baseId'];
153527
153596
  request['quote'] = market['quoteId'];
153528
- method = 'privateGetAuthOrderPairCurrencyQuote';
153597
+ if (isTrigger) {
153598
+ response = await this.privateGetAuthStopOrderPairCurrencyQuote(this.extend(request, params));
153599
+ }
153600
+ else {
153601
+ response = await this.privateGetAuthOrderPairCurrencyQuote(this.extend(request, params));
153602
+ }
153529
153603
  }
153530
- if (limit !== undefined) {
153531
- request['limit'] = limit; // default 100
153604
+ else {
153605
+ if (isTrigger) {
153606
+ response = await this.privateGetAuthStopOrder(this.extend(request, params));
153607
+ }
153608
+ else {
153609
+ response = await this.privateGetAuthOrder(this.extend(request, params));
153610
+ }
153532
153611
  }
153533
- const response = await this[method](this.extend(request, params));
153534
153612
  //
153535
153613
  // [
153536
153614
  // {
@@ -153560,15 +153638,26 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
153560
153638
  * @method
153561
153639
  * @name latoken#fetchOrder
153562
153640
  * @description fetches information on an order made by the user
153563
- * @param {string} symbol not used by latoken fetchOrder
153641
+ * @see https://api.latoken.com/doc/v2/#tag/Order/operation/getOrderById
153642
+ * @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getStopOrderById
153643
+ * @param {string} [symbol] not used by latoken fetchOrder
153564
153644
  * @param {object} [params] extra parameters specific to the latoken api endpoint
153645
+ * @param {boolean} [params.trigger] true if fetching a trigger order
153565
153646
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
153566
153647
  */
153567
153648
  await this.loadMarkets();
153568
153649
  const request = {
153569
153650
  'id': id,
153570
153651
  };
153571
- const response = await this.privateGetAuthOrderGetOrderId(this.extend(request, params));
153652
+ const isTrigger = this.safeValue2(params, 'trigger', 'stop');
153653
+ params = this.omit(params, ['stop', 'trigger']);
153654
+ let response = undefined;
153655
+ if (isTrigger) {
153656
+ response = await this.privateGetAuthStopOrderGetOrderId(this.extend(request, params));
153657
+ }
153658
+ else {
153659
+ response = await this.privateGetAuthOrderGetOrderId(this.extend(request, params));
153660
+ }
153572
153661
  //
153573
153662
  // {
153574
153663
  // "id":"a76bd262-3560-4bfb-98ac-1cedd394f4fc",
@@ -153596,12 +153685,19 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
153596
153685
  * @method
153597
153686
  * @name latoken#createOrder
153598
153687
  * @description create a trade order
153688
+ * @see https://api.latoken.com/doc/v2/#tag/Order/operation/placeOrder
153689
+ * @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/placeStopOrder // stop
153599
153690
  * @param {string} symbol unified symbol of the market to create an order in
153600
153691
  * @param {string} type 'market' or 'limit'
153601
153692
  * @param {string} side 'buy' or 'sell'
153602
153693
  * @param {float} amount how much of currency you want to trade in units of base currency
153603
153694
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
153604
153695
  * @param {object} [params] extra parameters specific to the latoken api endpoint
153696
+ * @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
153697
+ *
153698
+ * EXCHANGE SPECIFIC PARAMETERS
153699
+ * @param {string} [params.condition] "GTC", "IOC", or "FOK"
153700
+ * @param {string} [params.clientOrderId] [ 0 .. 50 ] characters, client's custom order id (free field for your convenience)
153605
153701
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
153606
153702
  */
153607
153703
  await this.loadMarkets();
@@ -153613,27 +153709,36 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
153613
153709
  'side': side.toUpperCase(),
153614
153710
  'condition': 'GTC',
153615
153711
  'type': uppercaseType,
153616
- 'clientOrderId': this.uuid(), // 50 characters max
153712
+ 'clientOrderId': this.uuid(),
153617
153713
  // 'price': this.priceToPrecision (symbol, price),
153618
153714
  // 'quantity': this.amountToPrecision (symbol, amount),
153715
+ 'quantity': this.amountToPrecision(symbol, amount),
153716
+ 'timestamp': this.seconds(),
153619
153717
  };
153620
153718
  if (uppercaseType === 'LIMIT') {
153621
153719
  request['price'] = this.priceToPrecision(symbol, price);
153622
153720
  }
153623
- request['quantity'] = this.amountToPrecision(symbol, amount);
153624
- request['timestamp'] = this.seconds();
153625
- const response = await this.privatePostAuthOrderPlace(this.extend(request, params));
153721
+ const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
153722
+ params = this.omit(params, ['triggerPrice', 'stopPrice']);
153723
+ let response = undefined;
153724
+ if (triggerPrice !== undefined) {
153725
+ request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
153726
+ response = await this.privatePostAuthStopOrderPlace(this.extend(request, params));
153727
+ }
153728
+ else {
153729
+ response = await this.privatePostAuthOrderPlace(this.extend(request, params));
153730
+ }
153626
153731
  //
153627
- // {
153628
- // "orderId":"1563460093.134037.704945@0370:2",
153629
- // "cliOrdId":"",
153630
- // "pairId":370,
153631
- // "symbol":"ETHBTC",
153632
- // "side":"sell",
153633
- // "orderType":"limit",
153634
- // "price":1.0,
153635
- // "amount":1.0
153636
- // }
153732
+ // {
153733
+ // "baseCurrency": "f7dac554-8139-4ff6-841f-0e586a5984a0",
153734
+ // "quoteCurrency": "a5a7a7a9-e2a3-43f9-8754-29a02f6b709b",
153735
+ // "side": "BID",
153736
+ // "clientOrderId": "my-wonderful-order-number-71566",
153737
+ // "price": "10103.19",
153738
+ // "stopPrice": "10103.19",
153739
+ // "quantity": "3.21",
153740
+ // "timestamp": 1568185507
153741
+ // }
153637
153742
  //
153638
153743
  return this.parseOrder(response, market);
153639
153744
  }
@@ -153642,16 +153747,27 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
153642
153747
  * @method
153643
153748
  * @name latoken#cancelOrder
153644
153749
  * @description cancels an open order
153750
+ * @see https://api.latoken.com/doc/v2/#tag/Order/operation/cancelOrder
153751
+ * @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/cancelStopOrder // stop
153645
153752
  * @param {string} id order id
153646
153753
  * @param {string} symbol not used by latoken cancelOrder ()
153647
153754
  * @param {object} [params] extra parameters specific to the latoken api endpoint
153755
+ * @param {boolean} [params.trigger] true if cancelling a trigger order
153648
153756
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
153649
153757
  */
153650
153758
  await this.loadMarkets();
153651
153759
  const request = {
153652
153760
  'id': id,
153653
153761
  };
153654
- const response = await this.privatePostAuthOrderCancel(this.extend(request, params));
153762
+ const isTrigger = this.safeValue2(params, 'trigger', 'stop');
153763
+ params = this.omit(params, ['stop', 'trigger']);
153764
+ let response = undefined;
153765
+ if (isTrigger) {
153766
+ response = await this.privatePostAuthStopOrderCancel(this.extend(request, params));
153767
+ }
153768
+ else {
153769
+ response = await this.privatePostAuthOrderCancel(this.extend(request, params));
153770
+ }
153655
153771
  //
153656
153772
  // {
153657
153773
  // "id": "12345678-1234-1244-1244-123456789012",
@@ -153668,8 +153784,11 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
153668
153784
  * @method
153669
153785
  * @name latoken#cancelAllOrders
153670
153786
  * @description cancel all open orders in a market
153787
+ * @see https://api.latoken.com/doc/v2/#tag/Order/operation/cancelAllOrders
153788
+ * @see https://api.latoken.com/doc/v2/#tag/Order/operation/cancelAllOrdersByPair
153671
153789
  * @param {string} symbol unified market symbol of the market to cancel orders in
153672
153790
  * @param {object} [params] extra parameters specific to the latoken api endpoint
153791
+ * @param {boolean} [params.trigger] true if cancelling trigger orders
153673
153792
  * @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
153674
153793
  */
153675
153794
  await this.loadMarkets();
@@ -153677,15 +153796,29 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
153677
153796
  // 'currency': market['baseId'],
153678
153797
  // 'quote': market['quoteId'],
153679
153798
  };
153680
- let method = 'privatePostAuthOrderCancelAll';
153681
153799
  let market = undefined;
153800
+ const isTrigger = this.safeValue2(params, 'trigger', 'stop');
153801
+ params = this.omit(params, ['stop', 'trigger']);
153802
+ let response = undefined;
153682
153803
  if (symbol !== undefined) {
153683
153804
  market = this.market(symbol);
153684
153805
  request['currency'] = market['baseId'];
153685
153806
  request['quote'] = market['quoteId'];
153686
- method = 'privatePostAuthOrderCancelAllCurrencyQuote';
153807
+ if (isTrigger) {
153808
+ response = await this.privatePostAuthStopOrderCancelAllCurrencyQuote(this.extend(request, params));
153809
+ }
153810
+ else {
153811
+ response = await this.privatePostAuthOrderCancelAllCurrencyQuote(this.extend(request, params));
153812
+ }
153813
+ }
153814
+ else {
153815
+ if (isTrigger) {
153816
+ response = await this.privatePostAuthStopOrderCancelAll(this.extend(request, params));
153817
+ }
153818
+ else {
153819
+ response = await this.privatePostAuthOrderCancelAll(this.extend(request, params));
153820
+ }
153687
153821
  }
153688
- const response = await this[method](this.extend(request, params));
153689
153822
  //
153690
153823
  // {
153691
153824
  // "message":"cancellation request successfully submitted",
@@ -273444,7 +273577,7 @@ SOFTWARE.
273444
273577
 
273445
273578
  //-----------------------------------------------------------------------------
273446
273579
  // this is updated by vss.js when building
273447
- const version = '4.0.111';
273580
+ const version = '4.0.112';
273448
273581
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
273449
273582
  //-----------------------------------------------------------------------------
273450
273583