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.
package/dist/cjs/ccxt.js CHANGED
@@ -179,7 +179,7 @@ var woo$1 = require('./src/pro/woo.js');
179
179
 
180
180
  //-----------------------------------------------------------------------------
181
181
  // this is updated by vss.js when building
182
- const version = '4.0.111';
182
+ const version = '4.0.112';
183
183
  Exchange["default"].ccxtVersion = version;
184
184
  const exchanges = {
185
185
  'ace': ace,
@@ -4063,16 +4063,16 @@ class bybit extends bybit$1 {
4063
4063
  triggerPrice = isStopLossTriggerOrder ? stopLossTriggerPrice : takeProfitTriggerPrice;
4064
4064
  }
4065
4065
  if (triggerPrice !== undefined) {
4066
- request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
4066
+ request['triggerPrice'] = triggerPrice;
4067
4067
  }
4068
4068
  if (isStopLoss || isTakeProfit) {
4069
4069
  if (isStopLoss) {
4070
4070
  const slTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
4071
- request['stopLoss'] = this.priceToPrecision(symbol, slTriggerPrice);
4071
+ request['stopLoss'] = slTriggerPrice;
4072
4072
  }
4073
4073
  if (isTakeProfit) {
4074
4074
  const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
4075
- request['takeProfit'] = this.priceToPrecision(symbol, tpTriggerPrice);
4075
+ request['takeProfit'] = tpTriggerPrice;
4076
4076
  }
4077
4077
  }
4078
4078
  const clientOrderId = this.safeString(params, 'clientOrderId');
@@ -6616,9 +6616,8 @@ class bybit extends bybit$1 {
6616
6616
  // "time": 1670988271677
6617
6617
  // }
6618
6618
  //
6619
- const data = this.safeValue(response, 'result', {});
6620
- const transfers = this.safeValue(data, 'list', []);
6621
- return this.parseTransfers(transfers, currency, since, limit);
6619
+ const data = this.addPaginationCursorToResult(response);
6620
+ return this.parseTransfers(data, currency, since, limit);
6622
6621
  }
6623
6622
  async borrowMargin(code, amount, symbol = undefined, params = {}) {
6624
6623
  /**
@@ -495,6 +495,7 @@ class coinbasepro extends coinbasepro$1 {
495
495
  /**
496
496
  * @method
497
497
  * @name coinbasepro#fetchOrderBook
498
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproductbook
498
499
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
499
500
  * @param {string} symbol unified symbol of the market to fetch the order book for
500
501
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -660,6 +661,7 @@ class coinbasepro extends coinbasepro$1 {
660
661
  /**
661
662
  * @method
662
663
  * @name coinbasepro#fetchTicker
664
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproductticker
663
665
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
664
666
  * @param {string} symbol unified symbol of the market to fetch the ticker for
665
667
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
@@ -773,17 +775,16 @@ class coinbasepro extends coinbasepro$1 {
773
775
  /**
774
776
  * @method
775
777
  * @name coinbasepro#fetchMyTrades
778
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getfills
776
779
  * @description fetch all trades made by the user
777
780
  * @param {string} symbol unified market symbol
778
781
  * @param {int} [since] the earliest time in ms to fetch trades for
779
782
  * @param {int} [limit] the maximum number of trades structures to retrieve
780
783
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
784
+ * @param {int} [params.until] the latest time in ms to fetch trades for
781
785
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
782
786
  */
783
- // as of 2018-08-23
784
- if (symbol === undefined) {
785
- throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
786
- }
787
+ this.checkRequiredSymbol('fetchMyTrades', symbol);
787
788
  await this.loadMarkets();
788
789
  const market = this.market(symbol);
789
790
  const request = {
@@ -792,6 +793,14 @@ class coinbasepro extends coinbasepro$1 {
792
793
  if (limit !== undefined) {
793
794
  request['limit'] = limit;
794
795
  }
796
+ if (since !== undefined) {
797
+ request['start_date'] = this.iso8601(since);
798
+ }
799
+ const until = this.safeValue2(params, 'until', 'end_date');
800
+ if (until !== undefined) {
801
+ params = this.omit(params, ['until']);
802
+ request['end_date'] = this.iso8601(until);
803
+ }
795
804
  const response = await this.privateGetFills(this.extend(request, params));
796
805
  return this.parseTrades(response, market, since, limit);
797
806
  }
@@ -799,6 +808,7 @@ class coinbasepro extends coinbasepro$1 {
799
808
  /**
800
809
  * @method
801
810
  * @name coinbasepro#fetchTrades
811
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproducttrades
802
812
  * @description get the list of most recent trades for a particular symbol
803
813
  * @param {string} symbol unified symbol of the market to fetch trades for
804
814
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
@@ -885,12 +895,14 @@ class coinbasepro extends coinbasepro$1 {
885
895
  /**
886
896
  * @method
887
897
  * @name coinbasepro#fetchOHLCV
898
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproductcandles
888
899
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
889
900
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
890
901
  * @param {string} timeframe the length of time each candle represents
891
902
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
892
903
  * @param {int} [limit] the maximum amount of candles to fetch
893
904
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
905
+ * @param {int} [params.until] the latest time in ms to fetch trades for
894
906
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
895
907
  */
896
908
  await this.loadMarkets();
@@ -905,6 +917,8 @@ class coinbasepro extends coinbasepro$1 {
905
917
  else {
906
918
  request['granularity'] = timeframe;
907
919
  }
920
+ const until = this.safeValue2(params, 'until', 'end');
921
+ params = this.omit(params, ['until']);
908
922
  if (since !== undefined) {
909
923
  request['start'] = this.iso8601(since);
910
924
  if (limit === undefined) {
@@ -914,12 +928,17 @@ class coinbasepro extends coinbasepro$1 {
914
928
  else {
915
929
  limit = Math.min(300, limit);
916
930
  }
917
- const parsedTimeframeMilliseconds = parsedTimeframe * 1000;
918
- if (since % parsedTimeframeMilliseconds === 0) {
919
- request['end'] = this.iso8601(this.sum((limit - 1) * parsedTimeframeMilliseconds, since));
931
+ if (until === undefined) {
932
+ const parsedTimeframeMilliseconds = parsedTimeframe * 1000;
933
+ if (since % parsedTimeframeMilliseconds === 0) {
934
+ request['end'] = this.iso8601(this.sum((limit - 1) * parsedTimeframeMilliseconds, since));
935
+ }
936
+ else {
937
+ request['end'] = this.iso8601(this.sum(limit * parsedTimeframeMilliseconds, since));
938
+ }
920
939
  }
921
940
  else {
922
- request['end'] = this.iso8601(this.sum(limit * parsedTimeframeMilliseconds, since));
941
+ request['end'] = this.iso8601(until);
923
942
  }
924
943
  }
925
944
  const response = await this.publicGetProductsIdCandles(this.extend(request, params));
@@ -1039,6 +1058,7 @@ class coinbasepro extends coinbasepro$1 {
1039
1058
  /**
1040
1059
  * @method
1041
1060
  * @name coinbasepro#fetchOrder
1061
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorder
1042
1062
  * @description fetches information on an order made by the user
1043
1063
  * @param {string} symbol not used by coinbasepro fetchOrder
1044
1064
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
@@ -1087,11 +1107,13 @@ class coinbasepro extends coinbasepro$1 {
1087
1107
  /**
1088
1108
  * @method
1089
1109
  * @name coinbasepro#fetchOrders
1110
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorders
1090
1111
  * @description fetches information on multiple orders made by the user
1091
1112
  * @param {string} symbol unified market symbol of the market orders were made in
1092
1113
  * @param {int} [since] the earliest time in ms to fetch orders for
1093
1114
  * @param {int} [limit] the maximum number of orde structures to retrieve
1094
1115
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
1116
+ * @param {int} [params.until] the latest time in ms to fetch open orders for
1095
1117
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1096
1118
  */
1097
1119
  const request = {
@@ -1103,11 +1125,13 @@ class coinbasepro extends coinbasepro$1 {
1103
1125
  /**
1104
1126
  * @method
1105
1127
  * @name coinbasepro#fetchOpenOrders
1128
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorders
1106
1129
  * @description fetch all unfilled currently open orders
1107
1130
  * @param {string} symbol unified market symbol
1108
1131
  * @param {int} [since] the earliest time in ms to fetch open orders for
1109
1132
  * @param {int} [limit] the maximum number of open orders structures to retrieve
1110
1133
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
1134
+ * @param {int} [params.until] the latest time in ms to fetch open orders for
1111
1135
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1112
1136
  */
1113
1137
  await this.loadMarkets();
@@ -1120,6 +1144,14 @@ class coinbasepro extends coinbasepro$1 {
1120
1144
  if (limit !== undefined) {
1121
1145
  request['limit'] = limit; // default 100
1122
1146
  }
1147
+ if (since !== undefined) {
1148
+ request['start_date'] = this.iso8601(since);
1149
+ }
1150
+ const until = this.safeValue2(params, 'until', 'end_date');
1151
+ if (until !== undefined) {
1152
+ params = this.omit(params, ['until']);
1153
+ request['end_date'] = this.iso8601(until);
1154
+ }
1123
1155
  const response = await this.privateGetOrders(this.extend(request, params));
1124
1156
  return this.parseOrders(response, market, since, limit);
1125
1157
  }
@@ -1127,11 +1159,13 @@ class coinbasepro extends coinbasepro$1 {
1127
1159
  /**
1128
1160
  * @method
1129
1161
  * @name coinbasepro#fetchClosedOrders
1162
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorders
1130
1163
  * @description fetches information on multiple closed orders made by the user
1131
1164
  * @param {string} symbol unified market symbol of the market orders were made in
1132
1165
  * @param {int} [since] the earliest time in ms to fetch orders for
1133
1166
  * @param {int} [limit] the maximum number of orde structures to retrieve
1134
1167
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
1168
+ * @param {int} [params.until] the latest time in ms to fetch open orders for
1135
1169
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1136
1170
  */
1137
1171
  const request = {
@@ -1143,6 +1177,7 @@ class coinbasepro extends coinbasepro$1 {
1143
1177
  /**
1144
1178
  * @method
1145
1179
  * @name coinbasepro#createOrder
1180
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postorders
1146
1181
  * @description create a trade order
1147
1182
  * @param {string} symbol unified symbol of the market to create an order in
1148
1183
  * @param {string} type 'market' or 'limit'
@@ -1238,6 +1273,7 @@ class coinbasepro extends coinbasepro$1 {
1238
1273
  /**
1239
1274
  * @method
1240
1275
  * @name coinbasepro#cancelOrder
1276
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_deleteorder
1241
1277
  * @description cancels an open order
1242
1278
  * @param {string} id order id
1243
1279
  * @param {string} symbol unified symbol of the market the order was made in
@@ -1270,6 +1306,7 @@ class coinbasepro extends coinbasepro$1 {
1270
1306
  /**
1271
1307
  * @method
1272
1308
  * @name coinbasepro#cancelAllOrders
1309
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_deleteorders
1273
1310
  * @description cancel all open orders
1274
1311
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
1275
1312
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
@@ -1456,11 +1493,13 @@ class coinbasepro extends coinbasepro$1 {
1456
1493
  /**
1457
1494
  * @method
1458
1495
  * @name coinbasepro#fetchLedger
1496
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccountledger
1459
1497
  * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
1460
1498
  * @param {string} code unified currency code, default is undefined
1461
1499
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
1462
1500
  * @param {int} [limit] max number of ledger entrys to return, default is undefined
1463
1501
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
1502
+ * @param {int} [params.until] the latest time in ms to fetch trades for
1464
1503
  * @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
1465
1504
  */
1466
1505
  // https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccountledger
@@ -1490,6 +1529,11 @@ class coinbasepro extends coinbasepro$1 {
1490
1529
  if (limit !== undefined) {
1491
1530
  request['limit'] = limit; // default 100
1492
1531
  }
1532
+ const until = this.safeValue2(params, 'until', 'end_date');
1533
+ if (until !== undefined) {
1534
+ params = this.omit(params, ['until']);
1535
+ request['end_date'] = this.iso8601(until);
1536
+ }
1493
1537
  const response = await this.privateGetAccountsIdLedger(this.extend(request, params));
1494
1538
  for (let i = 0; i < response.length; i++) {
1495
1539
  response[i]['currency'] = code;
@@ -29,6 +29,10 @@ class latoken extends latoken$1 {
29
29
  'cancelAllOrders': true,
30
30
  'cancelOrder': true,
31
31
  'createOrder': true,
32
+ 'createPostOnlyOrder': false,
33
+ 'createStopOrder': true,
34
+ 'createStopLimitOrder': true,
35
+ 'createStopMarketOrder': false,
32
36
  'fetchBalance': true,
33
37
  'fetchBorrowRate': false,
34
38
  'fetchBorrowRateHistories': false,
@@ -951,16 +955,16 @@ class latoken extends latoken$1 {
951
955
  //
952
956
  // createOrder
953
957
  //
954
- // {
955
- // "orderId":"1563460093.134037.704945@0370:2",
956
- // "cliOrdId":"",
957
- // "pairId":370,
958
- // "symbol":"ETHBTC",
959
- // "side":"sell",
960
- // "orderType":"limit",
961
- // "price":1.0,
962
- // "amount":1.0
963
- // }
958
+ // {
959
+ // "baseCurrency": "f7dac554-8139-4ff6-841f-0e586a5984a0",
960
+ // "quoteCurrency": "a5a7a7a9-e2a3-43f9-8754-29a02f6b709b",
961
+ // "side": "BID",
962
+ // "clientOrderId": "my-wonderful-order-number-71566",
963
+ // "price": "10103.19",
964
+ // "stopPrice": "10103.19",
965
+ // "quantity": "3.21",
966
+ // "timestamp": 1568185507
967
+ // }
964
968
  //
965
969
  // fetchOrder, fetchOpenOrders, fetchOrders
966
970
  //
@@ -1028,6 +1032,7 @@ class latoken extends latoken$1 {
1028
1032
  }
1029
1033
  const clientOrderId = this.safeString(order, 'clientOrderId');
1030
1034
  const timeInForce = this.parseTimeInForce(this.safeString(order, 'condition'));
1035
+ const triggerPrice = this.safeString(order, 'stopPrice');
1031
1036
  return this.safeOrder({
1032
1037
  'id': id,
1033
1038
  'clientOrderId': clientOrderId,
@@ -1042,8 +1047,8 @@ class latoken extends latoken$1 {
1042
1047
  'postOnly': undefined,
1043
1048
  'side': side,
1044
1049
  'price': price,
1045
- 'stopPrice': undefined,
1046
- 'triggerPrice': undefined,
1050
+ 'stopPrice': triggerPrice,
1051
+ 'triggerPrice': triggerPrice,
1047
1052
  'cost': cost,
1048
1053
  'amount': amount,
1049
1054
  'filled': filled,
@@ -1058,22 +1063,33 @@ class latoken extends latoken$1 {
1058
1063
  * @method
1059
1064
  * @name latoken#fetchOpenOrders
1060
1065
  * @description fetch all unfilled currently open orders
1066
+ * @see https://api.latoken.com/doc/v2/#tag/Order/operation/getMyActiveOrdersByPair
1067
+ * @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getMyActiveStopOrdersByPair // stop
1061
1068
  * @param {string} symbol unified market symbol
1062
1069
  * @param {int} [since] the earliest time in ms to fetch open orders for
1063
1070
  * @param {int} [limit] the maximum number of open orders structures to retrieve
1064
1071
  * @param {object} [params] extra parameters specific to the latoken api endpoint
1072
+ * @param {boolean} [params.trigger] true if fetching trigger orders
1065
1073
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1066
- */
1067
- if (symbol === undefined) {
1068
- throw new errors.ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
1069
- }
1074
+ */
1070
1075
  await this.loadMarkets();
1071
- const market = this.market(symbol);
1076
+ let response = undefined;
1077
+ let market = undefined;
1078
+ const isTrigger = this.safeValue2(params, 'trigger', 'stop');
1079
+ params = this.omit(params, 'stop');
1080
+ this.checkRequiredSymbol('fetchOpenOrders', symbol);
1081
+ // privateGetAuthOrderActive doesn't work even though its listed at https://api.latoken.com/doc/v2/#tag/Order/operation/getMyActiveOrders
1082
+ market = this.market(symbol);
1072
1083
  const request = {
1073
1084
  'currency': market['baseId'],
1074
1085
  'quote': market['quoteId'],
1075
1086
  };
1076
- const response = await this.privateGetAuthOrderPairCurrencyQuoteActive(this.extend(request, params));
1087
+ if (isTrigger) {
1088
+ response = await this.privateGetAuthStopOrderPairCurrencyQuoteActive(this.extend(request, params));
1089
+ }
1090
+ else {
1091
+ response = await this.privateGetAuthOrderPairCurrencyQuoteActive(this.extend(request, params));
1092
+ }
1077
1093
  //
1078
1094
  // [
1079
1095
  // {
@@ -1103,10 +1119,15 @@ class latoken extends latoken$1 {
1103
1119
  * @method
1104
1120
  * @name latoken#fetchOrders
1105
1121
  * @description fetches information on multiple orders made by the user
1122
+ * @see https://api.latoken.com/doc/v2/#tag/Order/operation/getMyOrders
1123
+ * @see https://api.latoken.com/doc/v2/#tag/Order/operation/getMyOrdersByPair
1124
+ * @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getMyStopOrders // stop
1125
+ * @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getMyStopOrdersByPair // stop
1106
1126
  * @param {string} symbol unified market symbol of the market orders were made in
1107
1127
  * @param {int} [since] the earliest time in ms to fetch orders for
1108
1128
  * @param {int} [limit] the maximum number of orde structures to retrieve
1109
1129
  * @param {object} [params] extra parameters specific to the latoken api endpoint
1130
+ * @param {boolean} [params.trigger] true if fetching trigger orders
1110
1131
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1111
1132
  */
1112
1133
  await this.loadMarkets();
@@ -1116,18 +1137,32 @@ class latoken extends latoken$1 {
1116
1137
  // 'from': this.milliseconds (),
1117
1138
  // 'limit': limit, // default '100'
1118
1139
  };
1119
- let method = 'privateGetAuthOrder';
1120
1140
  let market = undefined;
1141
+ const isTrigger = this.safeValue2(params, 'trigger', 'stop');
1142
+ params = this.omit(params, ['stop', 'trigger']);
1143
+ if (limit !== undefined) {
1144
+ request['limit'] = limit; // default 100
1145
+ }
1146
+ let response = undefined;
1121
1147
  if (symbol !== undefined) {
1122
1148
  market = this.market(symbol);
1123
1149
  request['currency'] = market['baseId'];
1124
1150
  request['quote'] = market['quoteId'];
1125
- method = 'privateGetAuthOrderPairCurrencyQuote';
1151
+ if (isTrigger) {
1152
+ response = await this.privateGetAuthStopOrderPairCurrencyQuote(this.extend(request, params));
1153
+ }
1154
+ else {
1155
+ response = await this.privateGetAuthOrderPairCurrencyQuote(this.extend(request, params));
1156
+ }
1126
1157
  }
1127
- if (limit !== undefined) {
1128
- request['limit'] = limit; // default 100
1158
+ else {
1159
+ if (isTrigger) {
1160
+ response = await this.privateGetAuthStopOrder(this.extend(request, params));
1161
+ }
1162
+ else {
1163
+ response = await this.privateGetAuthOrder(this.extend(request, params));
1164
+ }
1129
1165
  }
1130
- const response = await this[method](this.extend(request, params));
1131
1166
  //
1132
1167
  // [
1133
1168
  // {
@@ -1157,15 +1192,26 @@ class latoken extends latoken$1 {
1157
1192
  * @method
1158
1193
  * @name latoken#fetchOrder
1159
1194
  * @description fetches information on an order made by the user
1160
- * @param {string} symbol not used by latoken fetchOrder
1195
+ * @see https://api.latoken.com/doc/v2/#tag/Order/operation/getOrderById
1196
+ * @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getStopOrderById
1197
+ * @param {string} [symbol] not used by latoken fetchOrder
1161
1198
  * @param {object} [params] extra parameters specific to the latoken api endpoint
1199
+ * @param {boolean} [params.trigger] true if fetching a trigger order
1162
1200
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1163
1201
  */
1164
1202
  await this.loadMarkets();
1165
1203
  const request = {
1166
1204
  'id': id,
1167
1205
  };
1168
- const response = await this.privateGetAuthOrderGetOrderId(this.extend(request, params));
1206
+ const isTrigger = this.safeValue2(params, 'trigger', 'stop');
1207
+ params = this.omit(params, ['stop', 'trigger']);
1208
+ let response = undefined;
1209
+ if (isTrigger) {
1210
+ response = await this.privateGetAuthStopOrderGetOrderId(this.extend(request, params));
1211
+ }
1212
+ else {
1213
+ response = await this.privateGetAuthOrderGetOrderId(this.extend(request, params));
1214
+ }
1169
1215
  //
1170
1216
  // {
1171
1217
  // "id":"a76bd262-3560-4bfb-98ac-1cedd394f4fc",
@@ -1193,12 +1239,19 @@ class latoken extends latoken$1 {
1193
1239
  * @method
1194
1240
  * @name latoken#createOrder
1195
1241
  * @description create a trade order
1242
+ * @see https://api.latoken.com/doc/v2/#tag/Order/operation/placeOrder
1243
+ * @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/placeStopOrder // stop
1196
1244
  * @param {string} symbol unified symbol of the market to create an order in
1197
1245
  * @param {string} type 'market' or 'limit'
1198
1246
  * @param {string} side 'buy' or 'sell'
1199
1247
  * @param {float} amount how much of currency you want to trade in units of base currency
1200
1248
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1201
1249
  * @param {object} [params] extra parameters specific to the latoken api endpoint
1250
+ * @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
1251
+ *
1252
+ * EXCHANGE SPECIFIC PARAMETERS
1253
+ * @param {string} [params.condition] "GTC", "IOC", or "FOK"
1254
+ * @param {string} [params.clientOrderId] [ 0 .. 50 ] characters, client's custom order id (free field for your convenience)
1202
1255
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1203
1256
  */
1204
1257
  await this.loadMarkets();
@@ -1210,27 +1263,36 @@ class latoken extends latoken$1 {
1210
1263
  'side': side.toUpperCase(),
1211
1264
  'condition': 'GTC',
1212
1265
  'type': uppercaseType,
1213
- 'clientOrderId': this.uuid(), // 50 characters max
1266
+ 'clientOrderId': this.uuid(),
1214
1267
  // 'price': this.priceToPrecision (symbol, price),
1215
1268
  // 'quantity': this.amountToPrecision (symbol, amount),
1269
+ 'quantity': this.amountToPrecision(symbol, amount),
1270
+ 'timestamp': this.seconds(),
1216
1271
  };
1217
1272
  if (uppercaseType === 'LIMIT') {
1218
1273
  request['price'] = this.priceToPrecision(symbol, price);
1219
1274
  }
1220
- request['quantity'] = this.amountToPrecision(symbol, amount);
1221
- request['timestamp'] = this.seconds();
1222
- const response = await this.privatePostAuthOrderPlace(this.extend(request, params));
1275
+ const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
1276
+ params = this.omit(params, ['triggerPrice', 'stopPrice']);
1277
+ let response = undefined;
1278
+ if (triggerPrice !== undefined) {
1279
+ request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
1280
+ response = await this.privatePostAuthStopOrderPlace(this.extend(request, params));
1281
+ }
1282
+ else {
1283
+ response = await this.privatePostAuthOrderPlace(this.extend(request, params));
1284
+ }
1223
1285
  //
1224
- // {
1225
- // "orderId":"1563460093.134037.704945@0370:2",
1226
- // "cliOrdId":"",
1227
- // "pairId":370,
1228
- // "symbol":"ETHBTC",
1229
- // "side":"sell",
1230
- // "orderType":"limit",
1231
- // "price":1.0,
1232
- // "amount":1.0
1233
- // }
1286
+ // {
1287
+ // "baseCurrency": "f7dac554-8139-4ff6-841f-0e586a5984a0",
1288
+ // "quoteCurrency": "a5a7a7a9-e2a3-43f9-8754-29a02f6b709b",
1289
+ // "side": "BID",
1290
+ // "clientOrderId": "my-wonderful-order-number-71566",
1291
+ // "price": "10103.19",
1292
+ // "stopPrice": "10103.19",
1293
+ // "quantity": "3.21",
1294
+ // "timestamp": 1568185507
1295
+ // }
1234
1296
  //
1235
1297
  return this.parseOrder(response, market);
1236
1298
  }
@@ -1239,16 +1301,27 @@ class latoken extends latoken$1 {
1239
1301
  * @method
1240
1302
  * @name latoken#cancelOrder
1241
1303
  * @description cancels an open order
1304
+ * @see https://api.latoken.com/doc/v2/#tag/Order/operation/cancelOrder
1305
+ * @see https://api.latoken.com/doc/v2/#tag/StopOrder/operation/cancelStopOrder // stop
1242
1306
  * @param {string} id order id
1243
1307
  * @param {string} symbol not used by latoken cancelOrder ()
1244
1308
  * @param {object} [params] extra parameters specific to the latoken api endpoint
1309
+ * @param {boolean} [params.trigger] true if cancelling a trigger order
1245
1310
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1246
1311
  */
1247
1312
  await this.loadMarkets();
1248
1313
  const request = {
1249
1314
  'id': id,
1250
1315
  };
1251
- const response = await this.privatePostAuthOrderCancel(this.extend(request, params));
1316
+ const isTrigger = this.safeValue2(params, 'trigger', 'stop');
1317
+ params = this.omit(params, ['stop', 'trigger']);
1318
+ let response = undefined;
1319
+ if (isTrigger) {
1320
+ response = await this.privatePostAuthStopOrderCancel(this.extend(request, params));
1321
+ }
1322
+ else {
1323
+ response = await this.privatePostAuthOrderCancel(this.extend(request, params));
1324
+ }
1252
1325
  //
1253
1326
  // {
1254
1327
  // "id": "12345678-1234-1244-1244-123456789012",
@@ -1265,8 +1338,11 @@ class latoken extends latoken$1 {
1265
1338
  * @method
1266
1339
  * @name latoken#cancelAllOrders
1267
1340
  * @description cancel all open orders in a market
1341
+ * @see https://api.latoken.com/doc/v2/#tag/Order/operation/cancelAllOrders
1342
+ * @see https://api.latoken.com/doc/v2/#tag/Order/operation/cancelAllOrdersByPair
1268
1343
  * @param {string} symbol unified market symbol of the market to cancel orders in
1269
1344
  * @param {object} [params] extra parameters specific to the latoken api endpoint
1345
+ * @param {boolean} [params.trigger] true if cancelling trigger orders
1270
1346
  * @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1271
1347
  */
1272
1348
  await this.loadMarkets();
@@ -1274,15 +1350,29 @@ class latoken extends latoken$1 {
1274
1350
  // 'currency': market['baseId'],
1275
1351
  // 'quote': market['quoteId'],
1276
1352
  };
1277
- let method = 'privatePostAuthOrderCancelAll';
1278
1353
  let market = undefined;
1354
+ const isTrigger = this.safeValue2(params, 'trigger', 'stop');
1355
+ params = this.omit(params, ['stop', 'trigger']);
1356
+ let response = undefined;
1279
1357
  if (symbol !== undefined) {
1280
1358
  market = this.market(symbol);
1281
1359
  request['currency'] = market['baseId'];
1282
1360
  request['quote'] = market['quoteId'];
1283
- method = 'privatePostAuthOrderCancelAllCurrencyQuote';
1361
+ if (isTrigger) {
1362
+ response = await this.privatePostAuthStopOrderCancelAllCurrencyQuote(this.extend(request, params));
1363
+ }
1364
+ else {
1365
+ response = await this.privatePostAuthOrderCancelAllCurrencyQuote(this.extend(request, params));
1366
+ }
1367
+ }
1368
+ else {
1369
+ if (isTrigger) {
1370
+ response = await this.privatePostAuthStopOrderCancelAll(this.extend(request, params));
1371
+ }
1372
+ else {
1373
+ response = await this.privatePostAuthOrderCancelAll(this.extend(request, params));
1374
+ }
1284
1375
  }
1285
- const response = await this[method](this.extend(request, params));
1286
1376
  //
1287
1377
  // {
1288
1378
  // "message":"cancellation request successfully submitted",
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.0.110";
7
+ declare const version = "4.0.111";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.0.111';
41
+ const version = '4.0.112';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
package/js/src/bybit.js CHANGED
@@ -4066,16 +4066,16 @@ export default class bybit extends Exchange {
4066
4066
  triggerPrice = isStopLossTriggerOrder ? stopLossTriggerPrice : takeProfitTriggerPrice;
4067
4067
  }
4068
4068
  if (triggerPrice !== undefined) {
4069
- request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
4069
+ request['triggerPrice'] = triggerPrice;
4070
4070
  }
4071
4071
  if (isStopLoss || isTakeProfit) {
4072
4072
  if (isStopLoss) {
4073
4073
  const slTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
4074
- request['stopLoss'] = this.priceToPrecision(symbol, slTriggerPrice);
4074
+ request['stopLoss'] = slTriggerPrice;
4075
4075
  }
4076
4076
  if (isTakeProfit) {
4077
4077
  const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
4078
- request['takeProfit'] = this.priceToPrecision(symbol, tpTriggerPrice);
4078
+ request['takeProfit'] = tpTriggerPrice;
4079
4079
  }
4080
4080
  }
4081
4081
  const clientOrderId = this.safeString(params, 'clientOrderId');
@@ -6622,9 +6622,8 @@ export default class bybit extends Exchange {
6622
6622
  // "time": 1670988271677
6623
6623
  // }
6624
6624
  //
6625
- const data = this.safeValue(response, 'result', {});
6626
- const transfers = this.safeValue(data, 'list', []);
6627
- return this.parseTransfers(transfers, currency, since, limit);
6625
+ const data = this.addPaginationCursorToResult(response);
6626
+ return this.parseTransfers(data, currency, since, limit);
6628
6627
  }
6629
6628
  async borrowMargin(code, amount, symbol = undefined, params = {}) {
6630
6629
  /**