ccxt 4.0.96 → 4.0.98

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.
@@ -1317,7 +1317,7 @@ class deribit extends deribit$1 {
1317
1317
  request['start_timestamp'] = since;
1318
1318
  }
1319
1319
  if (limit !== undefined) {
1320
- request['count'] = limit; // default 10
1320
+ request['count'] = Math.min(limit, 1000); // default 10
1321
1321
  }
1322
1322
  const response = await this[method](this.extend(request, params));
1323
1323
  //
@@ -4167,7 +4167,7 @@ class gate extends gate$1 {
4167
4167
  type = isMarketOrder ? 'market' : 'limit';
4168
4168
  side = Precise["default"].stringGt(amount, '0') ? 'buy' : 'sell';
4169
4169
  }
4170
- const rawStatus = this.safeStringN(order, ['status', 'finish_as', 'open']);
4170
+ const rawStatus = this.safeStringN(order, ['finish_as', 'status', 'open']);
4171
4171
  let timestamp = this.safeInteger(order, 'create_time_ms');
4172
4172
  if (timestamp === undefined) {
4173
4173
  timestamp = this.safeTimestamp2(order, 'create_time', 'ctime');
@@ -4141,7 +4141,7 @@ class kucoin extends kucoin$1 {
4141
4141
  this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);
4142
4142
  this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
4143
4143
  this.throwBroadlyMatchedException(this.exceptions['broad'], body, feedback);
4144
- if (errorCode !== '200000') {
4144
+ if (errorCode !== '200000' && errorCode !== '200') {
4145
4145
  throw new errors.ExchangeError(feedback);
4146
4146
  }
4147
4147
  return undefined;
@@ -201,6 +201,7 @@ class latoken extends latoken$1 {
201
201
  'defaultType': 'spot',
202
202
  'types': {
203
203
  'wallet': 'ACCOUNT_TYPE_WALLET',
204
+ 'funding': 'ACCOUNT_TYPE_WALLET',
204
205
  'spot': 'ACCOUNT_TYPE_SPOT',
205
206
  },
206
207
  'accounts': {
@@ -658,8 +658,8 @@ class poloniex extends poloniex$1 {
658
658
  previousOrder['status'] = state;
659
659
  // update the newUpdates count
660
660
  orders.append(previousOrder);
661
- marketIds.push(marketId);
662
661
  }
662
+ marketIds.push(marketId);
663
663
  }
664
664
  }
665
665
  for (let i = 0; i < marketIds.length; i++) {
@@ -667,7 +667,7 @@ class poloniex extends poloniex$1 {
667
667
  const market = this.market(marketId);
668
668
  const symbol = market['symbol'];
669
669
  const messageHash = 'orders::' + symbol;
670
- client.resolve(orders[symbol], messageHash);
670
+ client.resolve(orders, messageHash);
671
671
  }
672
672
  client.resolve(orders, 'orders');
673
673
  return message;
@@ -419,8 +419,8 @@ class probit extends probit$1 {
419
419
  const networkList = {};
420
420
  for (let j = 0; j < platformsByPriority.length; j++) {
421
421
  const network = platformsByPriority[j];
422
- const id = this.safeString(network, 'id');
423
- const networkCode = this.networkIdToCode(id);
422
+ const networkId = this.safeString(network, 'id');
423
+ const networkCode = this.networkIdToCode(networkId);
424
424
  const currentDepositSuspended = this.safeValue(network, 'deposit_suspended');
425
425
  const currentWithdrawalSuspended = this.safeValue(network, 'withdrawal_suspended');
426
426
  const currentDeposit = !currentDepositSuspended;
@@ -433,7 +433,7 @@ class probit extends probit$1 {
433
433
  const withdrawFee = this.safeValue(network, 'withdrawal_fee', []);
434
434
  const fee = this.safeValue(withdrawFee, 0, {});
435
435
  networkList[networkCode] = {
436
- 'id': id,
436
+ 'id': networkId,
437
437
  'network': networkCode,
438
438
  'active': currentActive,
439
439
  'deposit': currentDeposit,
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 } from './src/base/errors.js';
7
- declare const version = "4.0.95";
7
+ declare const version = "4.0.97";
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 } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.0.96';
41
+ const version = '4.0.98';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -1,15 +1,14 @@
1
1
  import { implicitReturnType } from '../base/types.js';
2
2
  import { Exchange as _Exchange } from '../base/Exchange.js';
3
3
  interface Exchange {
4
- publicGetTickerCurrency(params?: {}): Promise<implicitReturnType>;
5
- publicGetTickerAll(params?: {}): Promise<implicitReturnType>;
6
- publicGetTickerALLBTC(params?: {}): Promise<implicitReturnType>;
7
- publicGetTickerALLKRW(params?: {}): Promise<implicitReturnType>;
8
- publicGetOrderbookCurrency(params?: {}): Promise<implicitReturnType>;
9
- publicGetOrderbookAll(params?: {}): Promise<implicitReturnType>;
10
- publicGetTransactionHistoryCurrency(params?: {}): Promise<implicitReturnType>;
11
- publicGetTransactionHistoryAll(params?: {}): Promise<implicitReturnType>;
12
- publicGetCandlestickCurrencyInterval(params?: {}): Promise<implicitReturnType>;
4
+ publicGetTickerALLQuoteId(params?: {}): Promise<implicitReturnType>;
5
+ publicGetTickerBaseIdQuoteId(params?: {}): Promise<implicitReturnType>;
6
+ publicGetOrderbookALLQuoteId(params?: {}): Promise<implicitReturnType>;
7
+ publicGetOrderbookBaseIdQuoteId(params?: {}): Promise<implicitReturnType>;
8
+ publicGetTransactionHistoryBaseIdQuoteId(params?: {}): Promise<implicitReturnType>;
9
+ publicGetAssetsstatusALL(params?: {}): Promise<implicitReturnType>;
10
+ publicGetAssetsstatusBaseId(params?: {}): Promise<implicitReturnType>;
11
+ publicGetCandlestickBaseIdQuoteIdInterval(params?: {}): Promise<implicitReturnType>;
13
12
  privatePostInfoAccount(params?: {}): Promise<implicitReturnType>;
14
13
  privatePostInfoBalance(params?: {}): Promise<implicitReturnType>;
15
14
  privatePostInfoWalletAddress(params?: {}): Promise<implicitReturnType>;
@@ -24,6 +23,7 @@ interface Exchange {
24
23
  privatePostTradeKrwWithdrawal(params?: {}): Promise<implicitReturnType>;
25
24
  privatePostTradeMarketBuy(params?: {}): Promise<implicitReturnType>;
26
25
  privatePostTradeMarketSell(params?: {}): Promise<implicitReturnType>;
26
+ privatePostTradeStopLimit(params?: {}): Promise<implicitReturnType>;
27
27
  }
28
28
  declare abstract class Exchange extends _Exchange {
29
29
  }
@@ -30,6 +30,9 @@ interface Exchange {
30
30
  privateGetAccountSubAccountV1TransferHistory(params?: {}): Promise<implicitReturnType>;
31
31
  privateGetAccountSubAccountMainV1Wallet(params?: {}): Promise<implicitReturnType>;
32
32
  privateGetAccountSubAccountMainV1SubaccountList(params?: {}): Promise<implicitReturnType>;
33
+ privateGetAccountContractSubAccountMainV1Wallet(params?: {}): Promise<implicitReturnType>;
34
+ privateGetAccountContractSubAccountMainV1TransferList(params?: {}): Promise<implicitReturnType>;
35
+ privateGetAccountContractSubAccountV1TransferHistory(params?: {}): Promise<implicitReturnType>;
33
36
  privateGetAccountV1Wallet(params?: {}): Promise<implicitReturnType>;
34
37
  privateGetAccountV1Currencies(params?: {}): Promise<implicitReturnType>;
35
38
  privateGetSpotV1Wallet(params?: {}): Promise<implicitReturnType>;
@@ -53,11 +56,16 @@ interface Exchange {
53
56
  privateGetContractPrivateOrder(params?: {}): Promise<implicitReturnType>;
54
57
  privateGetContractPrivateOrderHistory(params?: {}): Promise<implicitReturnType>;
55
58
  privateGetContractPrivatePosition(params?: {}): Promise<implicitReturnType>;
59
+ privateGetContractPrivateGetOpenOrders(params?: {}): Promise<implicitReturnType>;
60
+ privateGetContractPrivateTrades(params?: {}): Promise<implicitReturnType>;
56
61
  privatePostAccountSubAccountMainV1SubToMain(params?: {}): Promise<implicitReturnType>;
57
62
  privatePostAccountSubAccountSubV1SubToMain(params?: {}): Promise<implicitReturnType>;
58
63
  privatePostAccountSubAccountMainV1MainToSub(params?: {}): Promise<implicitReturnType>;
59
64
  privatePostAccountSubAccountSubV1SubToSub(params?: {}): Promise<implicitReturnType>;
60
65
  privatePostAccountSubAccountMainV1SubToSub(params?: {}): Promise<implicitReturnType>;
66
+ privatePostAccountContractSubAccountMainV1SubToMain(params?: {}): Promise<implicitReturnType>;
67
+ privatePostAccountContractSubAccountMainV1MainToSub(params?: {}): Promise<implicitReturnType>;
68
+ privatePostAccountContractSubAccountSubV1SubToMain(params?: {}): Promise<implicitReturnType>;
61
69
  privatePostAccountV1WithdrawApply(params?: {}): Promise<implicitReturnType>;
62
70
  privatePostSpotV1SubmitOrder(params?: {}): Promise<implicitReturnType>;
63
71
  privatePostSpotV1BatchOrders(params?: {}): Promise<implicitReturnType>;
@@ -76,7 +84,14 @@ interface Exchange {
76
84
  privatePostSpotV1MarginIsolatedBorrow(params?: {}): Promise<implicitReturnType>;
77
85
  privatePostSpotV1MarginIsolatedRepay(params?: {}): Promise<implicitReturnType>;
78
86
  privatePostSpotV1MarginIsolatedTransfer(params?: {}): Promise<implicitReturnType>;
79
- privatePostContractPrivateTrades(params?: {}): Promise<implicitReturnType>;
87
+ privatePostAccountV1TransferContractList(params?: {}): Promise<implicitReturnType>;
88
+ privatePostAccountV1TransferContract(params?: {}): Promise<implicitReturnType>;
89
+ privatePostContractPrivateSubmitOrder(params?: {}): Promise<implicitReturnType>;
90
+ privatePostContractPrivateCancelOrder(params?: {}): Promise<implicitReturnType>;
91
+ privatePostContractPrivateCancelOrders(params?: {}): Promise<implicitReturnType>;
92
+ privatePostContractPrivateSubmitPlanOrder(params?: {}): Promise<implicitReturnType>;
93
+ privatePostContractPrivateCancelPlanOrder(params?: {}): Promise<implicitReturnType>;
94
+ privatePostContractPrivateSubmitLeverage(params?: {}): Promise<implicitReturnType>;
80
95
  }
81
96
  declare abstract class Exchange extends _Exchange {
82
97
  }
@@ -20,6 +20,7 @@ export default class bigone extends Exchange {
20
20
  fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").OHLCV[]>;
21
21
  parseBalance(response: any): import("./base/types.js").Balances;
22
22
  fetchBalance(params?: {}): Promise<import("./base/types.js").Balances>;
23
+ parseType(type: string): string;
23
24
  parseOrder(order: any, market?: any): import("./base/types.js").Order;
24
25
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<import("./base/types.js").Order>;
25
26
  cancelOrder(id: string, symbol?: string, params?: {}): Promise<import("./base/types.js").Order>;
package/js/src/bigone.js CHANGED
@@ -34,6 +34,7 @@ export default class bigone extends Exchange {
34
34
  'cancelAllOrders': true,
35
35
  'cancelOrder': true,
36
36
  'createOrder': true,
37
+ 'createPostOnlyOrder': true,
37
38
  'createStopLimitOrder': true,
38
39
  'createStopMarketOrder': true,
39
40
  'createStopOrder': true,
@@ -135,6 +136,7 @@ export default class bigone extends Exchange {
135
136
  },
136
137
  },
137
138
  'options': {
139
+ 'createMarketBuyOrderRequiresPrice': true,
138
140
  'accountsByType': {
139
141
  'spot': 'SPOT',
140
142
  'fund': 'FUND',
@@ -1091,30 +1093,39 @@ export default class bigone extends Exchange {
1091
1093
  //
1092
1094
  return this.parseBalance(response);
1093
1095
  }
1096
+ parseType(type) {
1097
+ const types = {
1098
+ 'STOP_LIMIT': 'limit',
1099
+ 'STOP_MARKET': 'market',
1100
+ 'LIMIT': 'limit',
1101
+ 'MARKET': 'market',
1102
+ };
1103
+ return this.safeString(types, type, type);
1104
+ }
1094
1105
  parseOrder(order, market = undefined) {
1095
1106
  //
1096
1107
  // {
1097
- // "id": 10,
1098
- // "asset_pair_name": "EOS-BTC",
1099
- // "price": "10.00",
1100
- // "amount": "10.00",
1101
- // "filled_amount": "9.0",
1102
- // "avg_deal_price": "12.0",
1103
- // "side": "ASK",
1104
- // "state": "FILLED",
1105
- // "created_at":"2019-01-29T06:05:56Z",
1106
- // "updated_at":"2019-01-29T06:05:56Z",
1108
+ // "id": '42154072251',
1109
+ // "asset_pair_name": 'SOL-USDT',
1110
+ // "price": '20',
1111
+ // "amount": '0.5',
1112
+ // "filled_amount": '0',
1113
+ // "avg_deal_price": '0',
1114
+ // "side": 'ASK',
1115
+ // "state": 'PENDING',
1116
+ // "created_at": '2023-09-13T03:42:00Z',
1117
+ // "updated_at": '2023-09-13T03:42:00Z',
1118
+ // "type": 'LIMIT',
1119
+ // "stop_price": '0',
1120
+ // "immediate_or_cancel": false,
1121
+ // "post_only": false,
1122
+ // "client_order_id": ''
1107
1123
  // }
1108
1124
  //
1109
1125
  const id = this.safeString(order, 'id');
1110
1126
  const marketId = this.safeString(order, 'asset_pair_name');
1111
1127
  const symbol = this.safeSymbol(marketId, market, '-');
1112
1128
  const timestamp = this.parse8601(this.safeString(order, 'created_at'));
1113
- const price = this.safeString(order, 'price');
1114
- const amount = this.safeString(order, 'amount');
1115
- const average = this.safeString(order, 'avg_deal_price');
1116
- const filled = this.safeString(order, 'filled_amount');
1117
- const status = this.parseOrderStatus(this.safeString(order, 'state'));
1118
1129
  let side = this.safeString(order, 'side');
1119
1130
  if (side === 'BID') {
1120
1131
  side = 'buy';
@@ -1122,28 +1133,48 @@ export default class bigone extends Exchange {
1122
1133
  else {
1123
1134
  side = 'sell';
1124
1135
  }
1125
- const lastTradeTimestamp = this.parse8601(this.safeString(order, 'updated_at'));
1136
+ let triggerPrice = this.safeString(order, 'stop_price');
1137
+ if (Precise.stringEq(triggerPrice, '0')) {
1138
+ triggerPrice = undefined;
1139
+ }
1140
+ const immediateOrCancel = this.safeValue(order, 'immediate_or_cancel');
1141
+ let timeInForce = undefined;
1142
+ if (immediateOrCancel) {
1143
+ timeInForce = 'IOC';
1144
+ }
1145
+ const type = this.parseType(this.safeString(order, 'type'));
1146
+ const price = this.safeString(order, 'price');
1147
+ let amount = undefined;
1148
+ let filled = undefined;
1149
+ let cost = undefined;
1150
+ if (type === 'market' && side === 'buy') {
1151
+ cost = this.safeString(order, 'filled_amount');
1152
+ }
1153
+ else {
1154
+ amount = this.safeString(order, 'amount');
1155
+ filled = this.safeString(order, 'filled_amount');
1156
+ }
1126
1157
  return this.safeOrder({
1127
1158
  'info': order,
1128
1159
  'id': id,
1129
- 'clientOrderId': undefined,
1160
+ 'clientOrderId': this.safeString(order, 'client_order_id'),
1130
1161
  'timestamp': timestamp,
1131
1162
  'datetime': this.iso8601(timestamp),
1132
- 'lastTradeTimestamp': lastTradeTimestamp,
1163
+ 'lastTradeTimestamp': this.parse8601(this.safeString(order, 'updated_at')),
1133
1164
  'symbol': symbol,
1134
- 'type': undefined,
1135
- 'timeInForce': undefined,
1136
- 'postOnly': undefined,
1165
+ 'type': type,
1166
+ 'timeInForce': timeInForce,
1167
+ 'postOnly': this.safeValue(order, 'post_only'),
1137
1168
  'side': side,
1138
1169
  'price': price,
1139
- 'stopPrice': undefined,
1140
- 'triggerPrice': undefined,
1170
+ 'stopPrice': triggerPrice,
1171
+ 'triggerPrice': triggerPrice,
1141
1172
  'amount': amount,
1142
- 'cost': undefined,
1143
- 'average': average,
1173
+ 'cost': cost,
1174
+ 'average': this.safeString(order, 'avg_deal_price'),
1144
1175
  'filled': filled,
1145
1176
  'remaining': undefined,
1146
- 'status': status,
1177
+ 'status': this.parseOrderStatus(this.safeString(order, 'state')),
1147
1178
  'fee': undefined,
1148
1179
  'trades': undefined,
1149
1180
  }, market);
@@ -1153,46 +1184,79 @@ export default class bigone extends Exchange {
1153
1184
  * @method
1154
1185
  * @name bigone#createOrder
1155
1186
  * @description create a trade order
1187
+ * @see https://open.big.one/docs/spot_orders.html#create-order
1156
1188
  * @param {string} symbol unified symbol of the market to create an order in
1157
1189
  * @param {string} type 'market' or 'limit'
1158
1190
  * @param {string} side 'buy' or 'sell'
1159
1191
  * @param {float} amount how much of currency you want to trade in units of base currency
1160
1192
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1161
1193
  * @param {object} [params] extra parameters specific to the bigone api endpoint
1194
+ * @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
1195
+ * @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately
1196
+ * @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
1197
+ *
1198
+ * EXCHANGE SPECIFIC PARAMETERS
1199
+ * @param {string} operator *stop order only* GTE or LTE (default)
1200
+ * @param {string} client_order_id must match ^[a-zA-Z0-9-_]{1,36}$ this regex. client_order_id is unique in 24 hours, If created 24 hours later and the order closed, it will be released and can be reused
1162
1201
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1163
1202
  */
1164
1203
  await this.loadMarkets();
1165
1204
  const market = this.market(symbol);
1166
- const requestSide = (side === 'buy') ? 'BID' : 'ASK';
1167
- const uppercaseType = type.toUpperCase();
1205
+ const isBuy = (side === 'buy');
1206
+ const requestSide = isBuy ? 'BID' : 'ASK';
1207
+ let uppercaseType = type.toUpperCase();
1208
+ const isLimit = uppercaseType === 'LIMIT';
1209
+ const exchangeSpecificParam = this.safeValue(params, 'post_only');
1210
+ let postOnly = undefined;
1211
+ [postOnly, params] = this.handlePostOnly((uppercaseType === 'MARKET'), exchangeSpecificParam, params);
1212
+ const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
1168
1213
  const request = {
1169
1214
  'asset_pair_name': market['id'],
1170
1215
  'side': requestSide,
1171
- 'amount': this.amountToPrecision(symbol, amount),
1216
+ 'amount': this.amountToPrecision(symbol, amount), // order amount, string, required
1172
1217
  // 'price': this.priceToPrecision (symbol, price), // order price, string, required
1173
- 'type': uppercaseType,
1174
1218
  // 'operator': 'GTE', // stop orders only, GTE greater than and equal, LTE less than and equal
1175
1219
  // 'immediate_or_cancel': false, // limit orders only, must be false when post_only is true
1176
1220
  // 'post_only': false, // limit orders only, must be false when immediate_or_cancel is true
1177
1221
  };
1178
- if (uppercaseType === 'LIMIT') {
1222
+ if (isLimit || (uppercaseType === 'STOP_LIMIT')) {
1179
1223
  request['price'] = this.priceToPrecision(symbol, price);
1224
+ if (isLimit) {
1225
+ const timeInForce = this.safeString(params, 'timeInForce');
1226
+ if (timeInForce === 'IOC') {
1227
+ request['immediate_or_cancel'] = true;
1228
+ }
1229
+ if (postOnly) {
1230
+ request['post_only'] = true;
1231
+ }
1232
+ }
1180
1233
  }
1181
1234
  else {
1182
- const isStopLimit = (uppercaseType === 'STOP_LIMIT');
1183
- const isStopMarket = (uppercaseType === 'STOP_MARKET');
1184
- if (isStopLimit || isStopMarket) {
1185
- const stopPrice = this.safeNumber2(params, 'stop_price', 'stopPrice');
1186
- if (stopPrice === undefined) {
1187
- throw new ArgumentsRequired(this.id + ' createOrder() requires a stop_price parameter');
1235
+ const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice');
1236
+ if (createMarketBuyOrderRequiresPrice && (side === 'buy')) {
1237
+ if (price === undefined) {
1238
+ throw new InvalidOrder(this.id + ' createOrder() requires price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option to false and pass in the cost to spend into the amount parameter');
1188
1239
  }
1189
- request['stop_price'] = this.priceToPrecision(symbol, stopPrice);
1190
- params = this.omit(params, ['stop_price', 'stopPrice']);
1240
+ else {
1241
+ const amountString = this.numberToString(amount);
1242
+ const priceString = this.numberToString(price);
1243
+ amount = this.parseNumber(Precise.stringMul(amountString, priceString));
1244
+ }
1245
+ }
1246
+ }
1247
+ request['amount'] = this.amountToPrecision(symbol, amount);
1248
+ if (triggerPrice !== undefined) {
1249
+ request['stop_price'] = this.priceToPrecision(symbol, triggerPrice);
1250
+ request['operator'] = isBuy ? 'GTE' : 'LTE';
1251
+ if (isLimit) {
1252
+ uppercaseType = 'STOP_LIMIT';
1191
1253
  }
1192
- if (isStopLimit) {
1193
- request['price'] = this.priceToPrecision(symbol, price);
1254
+ else if (uppercaseType === 'MARKET') {
1255
+ uppercaseType = 'STOP_MARKET';
1194
1256
  }
1195
1257
  }
1258
+ request['type'] = uppercaseType;
1259
+ params = this.omit(params, ['stop_price', 'stopPrice', 'triggerPrice', 'timeInForce']);
1196
1260
  const response = await this.privatePostOrders(this.extend(request, params));
1197
1261
  //
1198
1262
  // {
@@ -1277,7 +1277,7 @@ export default class bitfinex2 extends Exchange {
1277
1277
  sort = '1';
1278
1278
  }
1279
1279
  if (limit !== undefined) {
1280
- request['limit'] = limit; // default 120, max 5000
1280
+ request['limit'] = Math.min(limit, 10000); // default 120, max 10000
1281
1281
  }
1282
1282
  request['sort'] = sort;
1283
1283
  const response = await this.publicGetTradesSymbolHist(this.extend(request, params));
package/js/src/bithumb.js CHANGED
@@ -83,15 +83,14 @@ export default class bithumb extends Exchange {
83
83
  'api': {
84
84
  'public': {
85
85
  'get': [
86
- 'ticker/{currency}',
87
- 'ticker/all',
88
- 'ticker/ALL_BTC',
89
- 'ticker/ALL_KRW',
90
- 'orderbook/{currency}',
91
- 'orderbook/all',
92
- 'transaction_history/{currency}',
93
- 'transaction_history/all',
94
- 'candlestick/{currency}/{interval}',
86
+ 'ticker/ALL_{quoteId}',
87
+ 'ticker/{baseId}_{quoteId}',
88
+ 'orderbook/ALL_{quoteId}',
89
+ 'orderbook/{baseId}_{quoteId}',
90
+ 'transaction_history/{baseId}_{quoteId}',
91
+ 'assetsstatus/ALL',
92
+ 'assetsstatus/{baseId}',
93
+ 'candlestick/{baseId}_{quoteId}/{interval}',
95
94
  ],
96
95
  },
97
96
  'private': {
@@ -110,6 +109,7 @@ export default class bithumb extends Exchange {
110
109
  'trade/krw_withdrawal',
111
110
  'trade/market_buy',
112
111
  'trade/market_sell',
112
+ 'trade/stop_limit',
113
113
  ],
114
114
  },
115
115
  },
@@ -198,8 +198,10 @@ export default class bithumb extends Exchange {
198
198
  const quote = quotes[i];
199
199
  const quoteId = quote;
200
200
  const extension = this.safeValue(quoteCurrencies, quote, {});
201
- const method = 'publicGetTickerALL' + quote;
202
- const response = await this[method](params);
201
+ const request = {
202
+ 'quoteId': quoteId,
203
+ };
204
+ const response = await this.publicGetTickerALLQuoteId(this.extend(request, params));
203
205
  const data = this.safeValue(response, 'data');
204
206
  const currencyIds = Object.keys(data);
205
207
  for (let j = 0; j < currencyIds.length; j++) {
@@ -310,12 +312,13 @@ export default class bithumb extends Exchange {
310
312
  await this.loadMarkets();
311
313
  const market = this.market(symbol);
312
314
  const request = {
313
- 'currency': market['base'] + '_' + market['quote'],
315
+ 'baseId': market['baseId'],
316
+ 'quoteId': market['quoteId'],
314
317
  };
315
318
  if (limit !== undefined) {
316
319
  request['count'] = limit; // default 30, max 30
317
320
  }
318
- const response = await this.publicGetOrderbookCurrency(this.extend(request, params));
321
+ const response = await this.publicGetOrderbookBaseIdQuoteId(this.extend(request, params));
319
322
  //
320
323
  // {
321
324
  // "status":"0000",
@@ -403,8 +406,11 @@ export default class bithumb extends Exchange {
403
406
  const quotes = Object.keys(quoteCurrencies);
404
407
  for (let i = 0; i < quotes.length; i++) {
405
408
  const quote = quotes[i];
406
- const method = 'publicGetTickerALL' + quote;
407
- const response = await this[method](params);
409
+ const quoteId = quote;
410
+ const request = {
411
+ 'quoteId': quoteId,
412
+ };
413
+ const response = await this.publicGetTickerALLQuoteId(this.extend(request, params));
408
414
  //
409
415
  // {
410
416
  // "status":"0000",
@@ -454,9 +460,10 @@ export default class bithumb extends Exchange {
454
460
  await this.loadMarkets();
455
461
  const market = this.market(symbol);
456
462
  const request = {
457
- 'currency': market['base'],
463
+ 'baseId': market['baseId'],
464
+ 'quoteId': market['quoteId'],
458
465
  };
459
- const response = await this.publicGetTickerCurrency(this.extend(request, params));
466
+ const response = await this.publicGetTickerBaseIdQuoteId(this.extend(request, params));
460
467
  //
461
468
  // {
462
469
  // "status":"0000",
@@ -514,10 +521,11 @@ export default class bithumb extends Exchange {
514
521
  await this.loadMarkets();
515
522
  const market = this.market(symbol);
516
523
  const request = {
517
- 'currency': market['base'],
524
+ 'baseId': market['baseId'],
525
+ 'quoteId': market['quoteId'],
518
526
  'interval': this.safeString(this.timeframes, timeframe, timeframe),
519
527
  };
520
- const response = await this.publicGetCandlestickCurrencyInterval(this.extend(request, params));
528
+ const response = await this.publicGetCandlestickBaseIdQuoteIdInterval(this.extend(request, params));
521
529
  //
522
530
  // {
523
531
  // 'status': '0000',
@@ -636,12 +644,13 @@ export default class bithumb extends Exchange {
636
644
  await this.loadMarkets();
637
645
  const market = this.market(symbol);
638
646
  const request = {
639
- 'currency': market['base'] + '_' + market['quote'],
647
+ 'baseId': market['baseId'],
648
+ 'quoteId': market['quoteId'],
640
649
  };
641
650
  if (limit !== undefined) {
642
651
  request['count'] = limit; // default 20, max 100
643
652
  }
644
- const response = await this.publicGetTransactionHistoryCurrency(this.extend(request, params));
653
+ const response = await this.publicGetTransactionHistoryBaseIdQuoteId(this.extend(request, params));
645
654
  //
646
655
  // {
647
656
  // "status":"0000",
@@ -224,7 +224,7 @@ export default class bitmart extends Exchange {
224
224
  datetime: string;
225
225
  info: any;
226
226
  };
227
- handleMarginModeAndParams(methodName: any, params?: {}, defaultValue?: any): any[];
227
+ setLeverage(leverage: any, symbol?: string, params?: {}): Promise<any>;
228
228
  nonce(): number;
229
229
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
230
230
  url: string;