ccxt 4.1.87 → 4.1.89
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/CHANGELOG.md +8309 -5710
- package/README.md +10 -9
- package/changelog.js +101 -0
- package/dist/ccxt.browser.js +8628 -4849
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +6 -1
- package/dist/cjs/src/base/Exchange.js +95 -27
- package/dist/cjs/src/base/ws/Client.js +3 -3
- package/dist/cjs/src/base/ws/Future.js +9 -2
- package/dist/cjs/src/base/ws/WsClient.js +1 -1
- package/dist/cjs/src/bigone.js +8 -1
- package/dist/cjs/src/binance.js +4 -105
- package/dist/cjs/src/bit2c.js +8 -2
- package/dist/cjs/src/bitget.js +3455 -2480
- package/dist/cjs/src/bitmart.js +35 -9
- package/dist/cjs/src/coinbase.js +2 -0
- package/dist/cjs/src/coinbasepro.js +0 -43
- package/dist/cjs/src/coinex.js +14 -1
- package/dist/cjs/src/coinsph.js +0 -29
- package/dist/cjs/src/cryptocom.js +22 -10
- package/dist/cjs/src/gate.js +37 -39
- package/dist/cjs/src/gemini.js +1 -0
- package/dist/cjs/src/novadax.js +28 -16
- package/dist/cjs/src/okcoin.js +80 -21
- package/dist/cjs/src/phemex.js +105 -29
- package/dist/cjs/src/pro/binance.js +18 -215
- package/dist/cjs/src/pro/bitget.js +780 -736
- package/dist/cjs/src/pro/bitmart.js +8 -10
- package/dist/cjs/src/pro/bitmex.js +9 -34
- package/dist/cjs/src/pro/bitpanda.js +4 -4
- package/dist/cjs/src/pro/bybit.js +21 -97
- package/dist/cjs/src/pro/coinbasepro.js +36 -40
- package/dist/cjs/src/pro/cryptocom.js +10 -26
- package/dist/cjs/src/pro/gate.js +20 -17
- package/dist/cjs/src/pro/kucoin.js +39 -39
- package/dist/cjs/src/pro/kucoinfutures.js +40 -36
- package/dist/cjs/src/pro/okx.js +16 -29
- package/dist/cjs/src/tokocrypto.js +28 -14
- package/dist/cjs/src/woo.js +41 -14
- package/js/ccxt.d.ts +8 -2
- package/js/ccxt.js +6 -2
- package/js/src/abstract/bitget.d.ts +1 -1
- package/js/src/abstract/coinbasepro.d.ts +69 -0
- package/js/src/abstract/coinbasepro.js +11 -0
- package/js/src/abstract/phemex.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +2 -3
- package/js/src/base/Exchange.js +96 -28
- package/js/src/base/ws/Client.d.ts +2 -2
- package/js/src/base/ws/Client.js +4 -4
- package/js/src/base/ws/Future.d.ts +5 -2
- package/js/src/base/ws/Future.js +8 -2
- package/js/src/base/ws/WsClient.d.ts +1 -1
- package/js/src/base/ws/WsClient.js +2 -2
- package/js/src/bigone.js +9 -2
- package/js/src/binance.d.ts +0 -9
- package/js/src/binance.js +4 -105
- package/js/src/bit2c.js +8 -2
- package/js/src/bitget.d.ts +13 -11
- package/js/src/bitget.js +3455 -2480
- package/js/src/bitmart.js +35 -9
- package/js/src/coinbase.js +2 -0
- package/js/src/coinbasepro.d.ts +0 -4
- package/js/src/coinbasepro.js +1 -44
- package/js/src/coinex.js +14 -1
- package/js/src/coinsph.d.ts +0 -1
- package/js/src/coinsph.js +0 -29
- package/js/src/cryptocom.js +22 -10
- package/js/src/gate.js +37 -39
- package/js/src/gemini.js +1 -0
- package/js/src/novadax.js +28 -16
- package/js/src/okcoin.d.ts +1 -0
- package/js/src/okcoin.js +81 -22
- package/js/src/phemex.d.ts +2 -108
- package/js/src/phemex.js +105 -29
- package/js/src/pro/binance.d.ts +0 -2
- package/js/src/pro/binance.js +19 -216
- package/js/src/pro/bitget.d.ts +3 -5
- package/js/src/pro/bitget.js +780 -736
- package/js/src/pro/bitmart.js +8 -10
- package/js/src/pro/bitmex.js +9 -34
- package/js/src/pro/bitpanda.d.ts +1 -1
- package/js/src/pro/bitpanda.js +4 -4
- package/js/src/pro/bybit.d.ts +1 -2
- package/js/src/pro/bybit.js +21 -97
- package/js/src/pro/coinbasepro.d.ts +2 -2
- package/js/src/pro/coinbasepro.js +36 -40
- package/js/src/pro/cryptocom.d.ts +1 -1
- package/js/src/pro/cryptocom.js +10 -26
- package/js/src/pro/gate.d.ts +1 -0
- package/js/src/pro/gate.js +20 -17
- package/js/src/pro/kucoin.d.ts +1 -0
- package/js/src/pro/kucoin.js +39 -39
- package/js/src/pro/kucoinfutures.d.ts +2 -1
- package/js/src/pro/kucoinfutures.js +40 -36
- package/js/src/pro/okx.d.ts +1 -1
- package/js/src/pro/okx.js +16 -29
- package/js/src/tokocrypto.js +28 -14
- package/js/src/woo.d.ts +1 -0
- package/js/src/woo.js +42 -15
- package/package.json +2 -2
- package/skip-tests.json +3 -14
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -2076,7 +2076,7 @@ class bitmart extends bitmart$1 {
|
|
|
2076
2076
|
// "updateTime" : 1681701559408
|
|
2077
2077
|
// }
|
|
2078
2078
|
//
|
|
2079
|
-
// swap: fetchOrder, fetchOpenOrders
|
|
2079
|
+
// swap: fetchOrder, fetchOpenOrders, fetchClosedOrders
|
|
2080
2080
|
//
|
|
2081
2081
|
// {
|
|
2082
2082
|
// "order_id": "230935812485489",
|
|
@@ -2092,7 +2092,10 @@ class bitmart extends bitmart$1 {
|
|
|
2092
2092
|
// "deal_avg_price": "0",
|
|
2093
2093
|
// "deal_size": "0",
|
|
2094
2094
|
// "create_time": 1695702258629,
|
|
2095
|
-
// "update_time": 1695702258642
|
|
2095
|
+
// "update_time": 1695702258642,
|
|
2096
|
+
// "activation_price_type": 0,
|
|
2097
|
+
// "activation_price": "",
|
|
2098
|
+
// "callback_rate": ""
|
|
2096
2099
|
// }
|
|
2097
2100
|
//
|
|
2098
2101
|
let id = undefined;
|
|
@@ -2122,6 +2125,7 @@ class bitmart extends bitmart$1 {
|
|
|
2122
2125
|
if (priceString === 'market price') {
|
|
2123
2126
|
priceString = undefined;
|
|
2124
2127
|
}
|
|
2128
|
+
const trailingStopActivationPrice = this.safeNumber(order, 'activation_price');
|
|
2125
2129
|
return this.safeOrder({
|
|
2126
2130
|
'id': id,
|
|
2127
2131
|
'clientOrderId': this.safeString(order, 'client_order_id'),
|
|
@@ -2135,8 +2139,8 @@ class bitmart extends bitmart$1 {
|
|
|
2135
2139
|
'postOnly': postOnly,
|
|
2136
2140
|
'side': this.parseOrderSide(this.safeString(order, 'side')),
|
|
2137
2141
|
'price': this.omitZero(priceString),
|
|
2138
|
-
'stopPrice':
|
|
2139
|
-
'triggerPrice':
|
|
2142
|
+
'stopPrice': trailingStopActivationPrice,
|
|
2143
|
+
'triggerPrice': trailingStopActivationPrice,
|
|
2140
2144
|
'amount': this.omitZero(this.safeString(order, 'size')),
|
|
2141
2145
|
'cost': this.safeString2(order, 'filled_notional', 'filledNotional'),
|
|
2142
2146
|
'average': this.safeStringN(order, ['price_avg', 'priceAvg', 'deal_avg_price']),
|
|
@@ -2209,7 +2213,7 @@ class bitmart extends bitmart$1 {
|
|
|
2209
2213
|
* @see https://developer-pro.bitmart.com/en/spot/#place-margin-order
|
|
2210
2214
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
|
2211
2215
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2212
|
-
* @param {string} type 'market' or '
|
|
2216
|
+
* @param {string} type 'market', 'limit' or 'trailing' for swap markets only
|
|
2213
2217
|
* @param {string} side 'buy' or 'sell'
|
|
2214
2218
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
2215
2219
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
@@ -2266,10 +2270,11 @@ class bitmart extends bitmart$1 {
|
|
|
2266
2270
|
/**
|
|
2267
2271
|
* @method
|
|
2268
2272
|
* @name bitmart#createSwapOrderRequest
|
|
2273
|
+
* @ignore
|
|
2269
2274
|
* @description create a trade order
|
|
2270
2275
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
|
2271
2276
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2272
|
-
* @param {string} type 'market' or '
|
|
2277
|
+
* @param {string} type 'market', 'limit' or 'trailing'
|
|
2273
2278
|
* @param {string} side 'buy' or 'sell'
|
|
2274
2279
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
2275
2280
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
@@ -2277,7 +2282,9 @@ class bitmart extends bitmart$1 {
|
|
|
2277
2282
|
* @param {int} [params.leverage] leverage level
|
|
2278
2283
|
* @param {boolean} [params.reduceOnly] *swap only* reduce only
|
|
2279
2284
|
* @param {string} [params.marginMode] 'cross' or 'isolated', default is 'cross'
|
|
2280
|
-
*
|
|
2285
|
+
* @param {string} [params.clientOrderId] client order id of the order
|
|
2286
|
+
* @param {int} [params.activation_price_type] *swap trailing order only* 1: last price, 2: fair price, default is 1
|
|
2287
|
+
* @param {string} [params.callback_rate] *swap trailing order only* min 0.1, max 5 where 1 is 1%, default is "1"
|
|
2281
2288
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2282
2289
|
*/
|
|
2283
2290
|
const market = this.market(symbol);
|
|
@@ -2290,7 +2297,7 @@ class bitmart extends bitmart$1 {
|
|
|
2290
2297
|
const mode = this.safeInteger(params, 'mode'); // only for swap
|
|
2291
2298
|
const isMarketOrder = type === 'market';
|
|
2292
2299
|
let postOnly = undefined;
|
|
2293
|
-
|
|
2300
|
+
let reduceOnly = this.safeValue(params, 'reduceOnly');
|
|
2294
2301
|
const isExchangeSpecificPo = (mode === 4);
|
|
2295
2302
|
[postOnly, params] = this.handlePostOnly(isMarketOrder, isExchangeSpecificPo, params);
|
|
2296
2303
|
params = this.omit(params, ['timeInForce', 'postOnly', 'reduceOnly']);
|
|
@@ -2311,9 +2318,15 @@ class bitmart extends bitmart$1 {
|
|
|
2311
2318
|
if (isLimitOrder) {
|
|
2312
2319
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
2313
2320
|
}
|
|
2321
|
+
else if (type === 'trailing') {
|
|
2322
|
+
reduceOnly = true;
|
|
2323
|
+
request['activation_price'] = this.priceToPrecision(symbol, price);
|
|
2324
|
+
request['activation_price_type'] = this.safeInteger(params, 'activation_price_type', 1);
|
|
2325
|
+
request['callback_rate'] = this.safeString(params, 'callback_rate', '1');
|
|
2326
|
+
}
|
|
2314
2327
|
if (side === 'buy') {
|
|
2315
2328
|
if (reduceOnly) {
|
|
2316
|
-
request['side'] = 2; //
|
|
2329
|
+
request['side'] = 2; // buy close short
|
|
2317
2330
|
}
|
|
2318
2331
|
else {
|
|
2319
2332
|
request['side'] = 1; // buy open long
|
|
@@ -2344,6 +2357,7 @@ class bitmart extends bitmart$1 {
|
|
|
2344
2357
|
/**
|
|
2345
2358
|
* @method
|
|
2346
2359
|
* @name bitmart#createSpotOrderRequest
|
|
2360
|
+
* @ignore
|
|
2347
2361
|
* @description create a spot order request
|
|
2348
2362
|
* @see https://developer-pro.bitmart.com/en/spot/#place-spot-order
|
|
2349
2363
|
* @see https://developer-pro.bitmart.com/en/spot/#place-margin-order
|
|
@@ -2629,6 +2643,7 @@ class bitmart extends bitmart$1 {
|
|
|
2629
2643
|
* @param {int} [params.until] *spot* the latest time in ms to fetch orders for
|
|
2630
2644
|
* @param {string} [params.type] *swap* order type, 'limit' or 'market'
|
|
2631
2645
|
* @param {string} [params.order_state] *swap* the order state, 'all' or 'partially_filled', default is 'all'
|
|
2646
|
+
* @param {string} [params.orderType] *swap only* 'limit', 'market', or 'trailing'
|
|
2632
2647
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2633
2648
|
*/
|
|
2634
2649
|
await this.loadMarkets();
|
|
@@ -2661,6 +2676,11 @@ class bitmart extends bitmart$1 {
|
|
|
2661
2676
|
response = await this.privatePostSpotV4QueryOpenOrders(this.extend(request, params));
|
|
2662
2677
|
}
|
|
2663
2678
|
else if (type === 'swap') {
|
|
2679
|
+
const orderType = this.safeString(params, 'orderType');
|
|
2680
|
+
params = this.omit(params, 'orderType');
|
|
2681
|
+
if (orderType !== undefined) {
|
|
2682
|
+
request['type'] = orderType;
|
|
2683
|
+
}
|
|
2664
2684
|
response = await this.privateGetContractPrivateGetOpenOrders(this.extend(request, params));
|
|
2665
2685
|
}
|
|
2666
2686
|
else {
|
|
@@ -2802,6 +2822,7 @@ class bitmart extends bitmart$1 {
|
|
|
2802
2822
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
2803
2823
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2804
2824
|
* @param {string} [params.clientOrderId] *spot* fetch the order by client order id instead of order id
|
|
2825
|
+
* @param {string} [params.orderType] *swap only* 'limit', 'market', 'liquidate', 'bankruptcy', 'adl' or 'trailing'
|
|
2805
2826
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2806
2827
|
*/
|
|
2807
2828
|
await this.loadMarkets();
|
|
@@ -2829,6 +2850,11 @@ class bitmart extends bitmart$1 {
|
|
|
2829
2850
|
if (symbol === undefined) {
|
|
2830
2851
|
throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
2831
2852
|
}
|
|
2853
|
+
const orderType = this.safeString(params, 'orderType');
|
|
2854
|
+
params = this.omit(params, 'orderType');
|
|
2855
|
+
if (orderType !== undefined) {
|
|
2856
|
+
request['type'] = orderType;
|
|
2857
|
+
}
|
|
2832
2858
|
request['symbol'] = market['id'];
|
|
2833
2859
|
request['order_id'] = id;
|
|
2834
2860
|
response = await this.privateGetContractPrivateOrder(this.extend(request, params));
|
package/dist/cjs/src/coinbase.js
CHANGED
|
@@ -616,6 +616,7 @@ class coinbase extends coinbase$1 {
|
|
|
616
616
|
/**
|
|
617
617
|
* @method
|
|
618
618
|
* @name coinbase#fetchMySells
|
|
619
|
+
* @ignore
|
|
619
620
|
* @description fetch sells
|
|
620
621
|
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-sells#list-sells
|
|
621
622
|
* @param {string} symbol not used by coinbase fetchMySells ()
|
|
@@ -635,6 +636,7 @@ class coinbase extends coinbase$1 {
|
|
|
635
636
|
/**
|
|
636
637
|
* @method
|
|
637
638
|
* @name coinbase#fetchMyBuys
|
|
639
|
+
* @ignore
|
|
638
640
|
* @description fetch buys
|
|
639
641
|
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-buys#list-buys
|
|
640
642
|
* @param {string} symbol not used by coinbase fetchMyBuys ()
|
|
@@ -1352,49 +1352,6 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
1352
1352
|
async fetchPaymentMethods(params = {}) {
|
|
1353
1353
|
return await this.privateGetPaymentMethods(params);
|
|
1354
1354
|
}
|
|
1355
|
-
async deposit(code, amount, address, params = {}) {
|
|
1356
|
-
/**
|
|
1357
|
-
* @method
|
|
1358
|
-
* @name coinbasepro#deposit
|
|
1359
|
-
* @description Creates a new deposit address, as required by coinbasepro
|
|
1360
|
-
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postdepositpaymentmethod
|
|
1361
|
-
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postdepositcoinbaseaccount
|
|
1362
|
-
* @param {string} code Unified CCXT currency code (e.g. `"USDT"`)
|
|
1363
|
-
* @param {float} amount The amount of currency to send in the deposit (e.g. `20`)
|
|
1364
|
-
* @param {string} address Not used by coinbasepro
|
|
1365
|
-
* @param {object} [params] Parameters specific to the exchange API endpoint (e.g. `{"network": "TRX"}`)
|
|
1366
|
-
* @returns a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1367
|
-
*/
|
|
1368
|
-
await this.loadMarkets();
|
|
1369
|
-
const currency = this.currency(code);
|
|
1370
|
-
const request = {
|
|
1371
|
-
'currency': currency['id'],
|
|
1372
|
-
'amount': amount,
|
|
1373
|
-
};
|
|
1374
|
-
let method = 'privatePostDeposits';
|
|
1375
|
-
if ('payment_method_id' in params) {
|
|
1376
|
-
// deposit from a payment_method, like a bank account
|
|
1377
|
-
method += 'PaymentMethod';
|
|
1378
|
-
}
|
|
1379
|
-
else if ('coinbase_account_id' in params) {
|
|
1380
|
-
// deposit into Coinbase Pro account from a Coinbase account
|
|
1381
|
-
method += 'CoinbaseAccount';
|
|
1382
|
-
}
|
|
1383
|
-
else {
|
|
1384
|
-
// deposit methodotherwise we did not receive a supported deposit location
|
|
1385
|
-
// relevant docs link for the Googlers
|
|
1386
|
-
// https://docs.pro.coinbase.com/#deposits
|
|
1387
|
-
throw new errors.NotSupported(this.id + ' deposit() requires one of `coinbase_account_id` or `payment_method_id` extra params');
|
|
1388
|
-
}
|
|
1389
|
-
const response = await this[method](this.extend(request, params));
|
|
1390
|
-
if (!response) {
|
|
1391
|
-
throw new errors.ExchangeError(this.id + ' deposit() error: ' + this.json(response));
|
|
1392
|
-
}
|
|
1393
|
-
return {
|
|
1394
|
-
'info': response,
|
|
1395
|
-
'id': response['id'],
|
|
1396
|
-
};
|
|
1397
|
-
}
|
|
1398
1355
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
1399
1356
|
/**
|
|
1400
1357
|
* @method
|
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -46,6 +46,8 @@ class coinex extends coinex$1 {
|
|
|
46
46
|
'cancelOrders': true,
|
|
47
47
|
'createDepositAddress': true,
|
|
48
48
|
'createMarketBuyOrderWithCost': true,
|
|
49
|
+
'createMarketOrderWithCost': false,
|
|
50
|
+
'createMarketSellOrderWithCost': false,
|
|
49
51
|
'createOrder': true,
|
|
50
52
|
'createOrders': true,
|
|
51
53
|
'createReduceOnlyOrder': true,
|
|
@@ -1926,13 +1928,19 @@ class coinex extends coinex$1 {
|
|
|
1926
1928
|
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
1927
1929
|
/**
|
|
1928
1930
|
* @method
|
|
1929
|
-
* @name coinex#
|
|
1931
|
+
* @name coinex#createMarketBuyOrderWithCost
|
|
1930
1932
|
* @description create a market buy order by providing the symbol and cost
|
|
1933
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade003_market_order
|
|
1931
1934
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1932
1935
|
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1933
1936
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1934
1937
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1935
1938
|
*/
|
|
1939
|
+
await this.loadMarkets();
|
|
1940
|
+
const market = this.market(symbol);
|
|
1941
|
+
if (!market['spot']) {
|
|
1942
|
+
throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
1943
|
+
}
|
|
1936
1944
|
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
1937
1945
|
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
1938
1946
|
}
|
|
@@ -2098,6 +2106,11 @@ class coinex extends coinex$1 {
|
|
|
2098
2106
|
* @method
|
|
2099
2107
|
* @name coinex#createOrder
|
|
2100
2108
|
* @description create a trade order
|
|
2109
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade001_limit_order
|
|
2110
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade003_market_order
|
|
2111
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade004_IOC_order
|
|
2112
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade005_stop_limit_order
|
|
2113
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade006_stop_market_order
|
|
2101
2114
|
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http017_put_limit
|
|
2102
2115
|
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http018_put_market
|
|
2103
2116
|
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http019_put_limit_stop
|
package/dist/cjs/src/coinsph.js
CHANGED
|
@@ -1564,35 +1564,6 @@ class coinsph extends coinsph$1 {
|
|
|
1564
1564
|
const response = await this.privatePostOpenapiWalletV1WithdrawApply(this.extend(request, params));
|
|
1565
1565
|
return this.parseTransaction(response, currency);
|
|
1566
1566
|
}
|
|
1567
|
-
async deposit(code, amount, address, tag = undefined, params = {}) {
|
|
1568
|
-
/**
|
|
1569
|
-
* @method
|
|
1570
|
-
* @name coinsph#deposit
|
|
1571
|
-
* @description make a deposit from coins_ph account to exchange account
|
|
1572
|
-
* @param {string} code unified currency code
|
|
1573
|
-
* @param {float} amount the amount to deposit
|
|
1574
|
-
* @param {string} address not used by coinsph deposit ()
|
|
1575
|
-
* @param {string} tag
|
|
1576
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1577
|
-
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1578
|
-
*/
|
|
1579
|
-
const options = this.safeValue(this.options, 'deposit');
|
|
1580
|
-
const warning = this.safeValue(options, 'warning', true);
|
|
1581
|
-
if (warning) {
|
|
1582
|
-
throw new errors.InvalidAddress(this.id + " deposit() makes a deposits only from your coins_ph account, add .options['deposit']['warning'] = false to make a deposit to your exchange account");
|
|
1583
|
-
}
|
|
1584
|
-
await this.loadMarkets();
|
|
1585
|
-
const currency = this.currency(code);
|
|
1586
|
-
const request = {
|
|
1587
|
-
'coin': currency['id'],
|
|
1588
|
-
'amount': this.numberToString(amount),
|
|
1589
|
-
};
|
|
1590
|
-
if (tag !== undefined) {
|
|
1591
|
-
request['depositOrderId'] = tag;
|
|
1592
|
-
}
|
|
1593
|
-
const response = await this.privatePostOpenapiV1CapitalDepositApply(this.extend(request, params));
|
|
1594
|
-
return this.parseTransaction(response, currency);
|
|
1595
|
-
}
|
|
1596
1567
|
async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1597
1568
|
/**
|
|
1598
1569
|
* @method
|
|
@@ -34,6 +34,9 @@ class cryptocom extends cryptocom$1 {
|
|
|
34
34
|
'cancelOrders': true,
|
|
35
35
|
'closeAllPositions': false,
|
|
36
36
|
'closePosition': true,
|
|
37
|
+
'createMarketBuyOrderWithCost': false,
|
|
38
|
+
'createMarketOrderWithCost': false,
|
|
39
|
+
'createMarketSellOrderWithCost': false,
|
|
37
40
|
'createOrder': true,
|
|
38
41
|
'createOrders': true,
|
|
39
42
|
'fetchAccounts': true,
|
|
@@ -126,7 +129,10 @@ class cryptocom extends cryptocom$1 {
|
|
|
126
129
|
'derivatives': 'https://deriv-api.crypto.com/v1',
|
|
127
130
|
},
|
|
128
131
|
'www': 'https://crypto.com/',
|
|
129
|
-
'referral':
|
|
132
|
+
'referral': {
|
|
133
|
+
'url': 'https://crypto.com/exch/kdacthrnxt',
|
|
134
|
+
'discount': 0.15,
|
|
135
|
+
},
|
|
130
136
|
'doc': [
|
|
131
137
|
'https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html',
|
|
132
138
|
'https://exchange-docs.crypto.com/spot/index.html',
|
|
@@ -1337,23 +1343,29 @@ class cryptocom extends cryptocom$1 {
|
|
|
1337
1343
|
}
|
|
1338
1344
|
if ((side === 'buy') && ((uppercaseType === 'MARKET') || (uppercaseType === 'STOP_LOSS') || (uppercaseType === 'TAKE_PROFIT'))) {
|
|
1339
1345
|
// use createmarketBuy logic here
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1346
|
+
let quoteAmount = undefined;
|
|
1347
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
1348
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
1349
|
+
const cost = this.safeNumber2(params, 'cost', 'notional');
|
|
1350
|
+
params = this.omit(params, 'cost');
|
|
1351
|
+
if (cost !== undefined) {
|
|
1352
|
+
quoteAmount = this.costToPrecision(symbol, cost);
|
|
1353
|
+
}
|
|
1354
|
+
else if (createMarketBuyOrderRequiresPrice) {
|
|
1355
|
+
if (price === undefined) {
|
|
1356
|
+
throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend (quote quantity) in the amount argument');
|
|
1345
1357
|
}
|
|
1346
1358
|
else {
|
|
1347
1359
|
const amountString = this.numberToString(amount);
|
|
1348
1360
|
const priceString = this.numberToString(price);
|
|
1349
|
-
const
|
|
1350
|
-
|
|
1351
|
-
request['notional'] = this.costToPrecision(symbol, amount);
|
|
1361
|
+
const costRequest = Precise["default"].stringMul(amountString, priceString);
|
|
1362
|
+
quoteAmount = this.costToPrecision(symbol, costRequest);
|
|
1352
1363
|
}
|
|
1353
1364
|
}
|
|
1354
1365
|
else {
|
|
1355
|
-
|
|
1366
|
+
quoteAmount = this.costToPrecision(symbol, amount);
|
|
1356
1367
|
}
|
|
1368
|
+
request['notional'] = quoteAmount;
|
|
1357
1369
|
}
|
|
1358
1370
|
else {
|
|
1359
1371
|
request['quantity'] = this.amountToPrecision(symbol, amount);
|
package/dist/cjs/src/gate.js
CHANGED
|
@@ -587,12 +587,8 @@ class gate extends gate$1 {
|
|
|
587
587
|
'expiration': 86400, // for conditional orders
|
|
588
588
|
},
|
|
589
589
|
'networks': {
|
|
590
|
-
'
|
|
591
|
-
'ARBITRUM_NOVA': 'ARBNOVA',
|
|
592
|
-
'ARBITRUM_ONE': 'ARBEVM',
|
|
593
|
-
'AVALANCHE_C': 'AVAX_C',
|
|
590
|
+
'AVAXC': 'AVAX_C',
|
|
594
591
|
'BEP20': 'BSC',
|
|
595
|
-
'CHILIZ': 'CHZ',
|
|
596
592
|
'EOS': 'EOS',
|
|
597
593
|
'ERC20': 'ETH',
|
|
598
594
|
'GATECHAIN': 'GTEVM',
|
|
@@ -602,30 +598,8 @@ class gate extends gate$1 {
|
|
|
602
598
|
'OKC': 'OKT',
|
|
603
599
|
'OPTIMISM': 'OPETH',
|
|
604
600
|
'POLKADOT': 'DOTSM',
|
|
605
|
-
'POLYGON': 'MATIC',
|
|
606
|
-
'SOLANA': 'SOL',
|
|
607
601
|
'TRC20': 'TRX',
|
|
608
602
|
},
|
|
609
|
-
'networksById': {
|
|
610
|
-
'ALGO': 'ALGORAND',
|
|
611
|
-
'ARBEVM': 'ARBITRUM_ONE',
|
|
612
|
-
'ARBNOVA': 'ARBITRUM_NOVA',
|
|
613
|
-
'AVAX_C': 'AVALANCHE_C',
|
|
614
|
-
'BSC': 'BEP20',
|
|
615
|
-
'CHZ': 'CHILIZ',
|
|
616
|
-
'DOTSM': 'POLKADOT',
|
|
617
|
-
'EOS': 'EOS',
|
|
618
|
-
'ETH': 'ERC20',
|
|
619
|
-
'GTEVM': 'GATECHAIN',
|
|
620
|
-
'HT': 'HRC20',
|
|
621
|
-
'KSMSM': 'KUSAMA',
|
|
622
|
-
'MATIC': 'POLYGON',
|
|
623
|
-
'NEAR': 'NEAR',
|
|
624
|
-
'OKT': 'OKC',
|
|
625
|
-
'OPETH': 'OPTIMISM',
|
|
626
|
-
'SOL': 'SOLANA',
|
|
627
|
-
'TRX': 'TRC20',
|
|
628
|
-
},
|
|
629
603
|
'timeInForce': {
|
|
630
604
|
'GTC': 'gtc',
|
|
631
605
|
'IOC': 'ioc',
|
|
@@ -1924,10 +1898,13 @@ class gate extends gate$1 {
|
|
|
1924
1898
|
* @see https://www.gate.io/docs/developers/apiv4/en/#generate-currency-deposit-address
|
|
1925
1899
|
* @param {string} code unified currency code
|
|
1926
1900
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1901
|
+
* @param {string} [params.network] unified network code (not used directly by gate.io but used by ccxt to filter the response)
|
|
1927
1902
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
1928
1903
|
*/
|
|
1929
1904
|
await this.loadMarkets();
|
|
1930
1905
|
const currency = this.currency(code);
|
|
1906
|
+
const rawNetwork = this.safeStringUpper(params, 'network');
|
|
1907
|
+
params = this.omit(params, 'network');
|
|
1931
1908
|
const request = {
|
|
1932
1909
|
'currency': currency['id'],
|
|
1933
1910
|
};
|
|
@@ -1949,20 +1926,41 @@ class gate extends gate$1 {
|
|
|
1949
1926
|
//
|
|
1950
1927
|
const currencyId = this.safeString(response, 'currency');
|
|
1951
1928
|
code = this.safeCurrencyCode(currencyId);
|
|
1952
|
-
const
|
|
1929
|
+
const networkId = this.networkCodeToId(rawNetwork, code);
|
|
1930
|
+
let network = undefined;
|
|
1953
1931
|
let tag = undefined;
|
|
1954
1932
|
let address = undefined;
|
|
1955
|
-
if (
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1933
|
+
if (networkId !== undefined) {
|
|
1934
|
+
const addresses = this.safeValue(response, 'multichain_addresses');
|
|
1935
|
+
for (let i = 0; i < addresses.length; i++) {
|
|
1936
|
+
const entry = addresses[i];
|
|
1937
|
+
const entryNetwork = this.safeString(entry, 'chain');
|
|
1938
|
+
if (networkId === entryNetwork) {
|
|
1939
|
+
const obtainFailed = this.safeInteger(entry, 'obtain_failed');
|
|
1940
|
+
if (obtainFailed) {
|
|
1941
|
+
break;
|
|
1942
|
+
}
|
|
1943
|
+
address = this.safeString(entry, 'address');
|
|
1944
|
+
tag = this.safeString(entry, 'payment_id');
|
|
1945
|
+
network = this.networkIdToCode(networkId, code);
|
|
1946
|
+
break;
|
|
1947
|
+
}
|
|
1963
1948
|
}
|
|
1964
|
-
|
|
1965
|
-
|
|
1949
|
+
}
|
|
1950
|
+
else {
|
|
1951
|
+
const addressField = this.safeString(response, 'address');
|
|
1952
|
+
if (addressField !== undefined) {
|
|
1953
|
+
if (addressField.indexOf('New address is being generated for you, please wait') >= 0) {
|
|
1954
|
+
throw new errors.BadResponse(this.id + ' ' + 'New address is being generated for you, please wait a few seconds and try again to get the address.');
|
|
1955
|
+
}
|
|
1956
|
+
if (addressField.indexOf(' ') >= 0) {
|
|
1957
|
+
const splitted = addressField.split(' ');
|
|
1958
|
+
address = splitted[0];
|
|
1959
|
+
tag = splitted[1];
|
|
1960
|
+
}
|
|
1961
|
+
else {
|
|
1962
|
+
address = addressField;
|
|
1963
|
+
}
|
|
1966
1964
|
}
|
|
1967
1965
|
}
|
|
1968
1966
|
this.checkAddress(address);
|
|
@@ -1972,7 +1970,7 @@ class gate extends gate$1 {
|
|
|
1972
1970
|
'currency': code,
|
|
1973
1971
|
'address': address,
|
|
1974
1972
|
'tag': tag,
|
|
1975
|
-
'network':
|
|
1973
|
+
'network': network,
|
|
1976
1974
|
};
|
|
1977
1975
|
}
|
|
1978
1976
|
async fetchTradingFee(symbol, params = {}) {
|
package/dist/cjs/src/gemini.js
CHANGED
|
@@ -301,6 +301,7 @@ class gemini extends gemini$1 {
|
|
|
301
301
|
/**
|
|
302
302
|
* @method
|
|
303
303
|
* @name gemini#fetchCurrenciesFromWeb
|
|
304
|
+
* @ignore
|
|
304
305
|
* @description fetches all available currencies on an exchange
|
|
305
306
|
* @param {object} [params] extra parameters specific to the endpoint
|
|
306
307
|
* @returns {object} an associative dictionary of currencies
|
package/dist/cjs/src/novadax.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var novadax$1 = require('./abstract/novadax.js');
|
|
4
4
|
var errors = require('./base/errors.js');
|
|
5
|
+
var Precise = require('./base/Precise.js');
|
|
5
6
|
var number = require('./base/functions/number.js');
|
|
6
7
|
var sha256 = require('./static_dependencies/noble-hashes/sha256.js');
|
|
7
8
|
var md5 = require('./static_dependencies/noble-hashes/md5.js');
|
|
@@ -34,6 +35,9 @@ class novadax extends novadax$1 {
|
|
|
34
35
|
'cancelOrder': true,
|
|
35
36
|
'closeAllPositions': false,
|
|
36
37
|
'closePosition': false,
|
|
38
|
+
'createMarketBuyOrderWithCost': true,
|
|
39
|
+
'createMarketOrderWithCost': false,
|
|
40
|
+
'createMarketSellOrderWithCost': false,
|
|
37
41
|
'createOrder': true,
|
|
38
42
|
'createReduceOnlyOrder': false,
|
|
39
43
|
'createStopLimitOrder': true,
|
|
@@ -725,9 +729,10 @@ class novadax extends novadax$1 {
|
|
|
725
729
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
726
730
|
* @param {string} type 'market' or 'limit'
|
|
727
731
|
* @param {string} side 'buy' or 'sell'
|
|
728
|
-
* @param {float} amount how much
|
|
732
|
+
* @param {float} amount how much you want to trade in units of the base currency
|
|
729
733
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
730
734
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
735
|
+
* @param {float} [params.cost] for spot market buy orders, the quote quantity that can be used as an alternative for the amount
|
|
731
736
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
732
737
|
*/
|
|
733
738
|
await this.loadMarkets();
|
|
@@ -737,11 +742,11 @@ class novadax extends novadax$1 {
|
|
|
737
742
|
const request = {
|
|
738
743
|
'symbol': market['id'],
|
|
739
744
|
'side': uppercaseSide, // or SELL
|
|
740
|
-
//
|
|
745
|
+
// "amount": this.amountToPrecision (symbol, amount),
|
|
741
746
|
// "price": "1234.5678", // required for LIMIT and STOP orders
|
|
742
|
-
//
|
|
743
|
-
//
|
|
744
|
-
//
|
|
747
|
+
// "operator": "" // for stop orders, can be found in order introduction
|
|
748
|
+
// "stopPrice": this.priceToPrecision (symbol, stopPrice),
|
|
749
|
+
// "accountId": "...", // subaccount id, optional
|
|
745
750
|
};
|
|
746
751
|
const stopPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
|
|
747
752
|
if (stopPrice === undefined) {
|
|
@@ -770,22 +775,29 @@ class novadax extends novadax$1 {
|
|
|
770
775
|
request['amount'] = this.amountToPrecision(symbol, amount);
|
|
771
776
|
}
|
|
772
777
|
else if (uppercaseSide === 'BUY') {
|
|
773
|
-
let
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
778
|
+
let quoteAmount = undefined;
|
|
779
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
780
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
781
|
+
const cost = this.safeNumber2(params, 'cost', 'value');
|
|
782
|
+
params = this.omit(params, 'cost');
|
|
783
|
+
if (cost !== undefined) {
|
|
784
|
+
quoteAmount = this.costToPrecision(symbol, cost);
|
|
785
|
+
}
|
|
786
|
+
else if (createMarketBuyOrderRequiresPrice) {
|
|
787
|
+
if (price === undefined) {
|
|
788
|
+
throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend (quote quantity) in the amount argument');
|
|
780
789
|
}
|
|
781
|
-
else
|
|
782
|
-
|
|
790
|
+
else {
|
|
791
|
+
const amountString = this.numberToString(amount);
|
|
792
|
+
const priceString = this.numberToString(price);
|
|
793
|
+
const costRequest = Precise["default"].stringMul(amountString, priceString);
|
|
794
|
+
quoteAmount = this.costToPrecision(symbol, costRequest);
|
|
783
795
|
}
|
|
784
796
|
}
|
|
785
797
|
else {
|
|
786
|
-
|
|
798
|
+
quoteAmount = this.costToPrecision(symbol, amount);
|
|
787
799
|
}
|
|
788
|
-
request['value'] =
|
|
800
|
+
request['value'] = quoteAmount;
|
|
789
801
|
}
|
|
790
802
|
}
|
|
791
803
|
request['type'] = uppercaseType;
|