ccxt 4.1.88 → 4.1.90
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 +3 -3
- package/changelog.js +101 -0
- package/dist/ccxt.browser.js +963 -387
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +2 -2
- package/dist/cjs/src/bigone.js +8 -1
- package/dist/cjs/src/bitforex.js +2 -0
- package/dist/cjs/src/bitget.js +11 -4
- package/dist/cjs/src/bitmex.js +2 -0
- package/dist/cjs/src/blockchaincom.js +0 -41
- package/dist/cjs/src/bybit.js +29 -14
- package/dist/cjs/src/coinex.js +14 -1
- package/dist/cjs/src/coinlist.js +2 -0
- package/dist/cjs/src/coinsph.js +2 -0
- package/dist/cjs/src/cryptocom.js +2 -0
- package/dist/cjs/src/gate.js +276 -11
- package/dist/cjs/src/htx.js +264 -219
- package/dist/cjs/src/kuna.js +2 -0
- package/dist/cjs/src/mexc.js +2 -0
- package/dist/cjs/src/okcoin.js +61 -17
- package/dist/cjs/src/phemex.js +159 -30
- package/dist/cjs/src/poloniex.js +28 -2
- package/dist/cjs/src/pro/binance.js +6 -6
- package/dist/cjs/src/pro/poloniex.js +15 -10
- package/dist/cjs/src/tokocrypto.js +30 -14
- package/dist/cjs/src/wazirx.js +2 -0
- package/dist/cjs/src/whitebit.js +2 -0
- package/dist/cjs/src/woo.js +41 -14
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/phemex.d.ts +1 -0
- package/js/src/base/Exchange.js +2 -2
- package/js/src/bigone.js +9 -2
- package/js/src/bitforex.js +2 -0
- package/js/src/bitget.js +11 -4
- package/js/src/bitmex.js +2 -0
- package/js/src/blockchaincom.d.ts +0 -2
- package/js/src/blockchaincom.js +0 -41
- package/js/src/bybit.js +29 -14
- package/js/src/coinex.js +14 -1
- package/js/src/coinlist.js +2 -0
- package/js/src/coinsph.js +2 -0
- package/js/src/cryptocom.js +2 -0
- package/js/src/gate.d.ts +47 -0
- package/js/src/gate.js +276 -11
- package/js/src/htx.js +264 -219
- package/js/src/kuna.js +2 -0
- package/js/src/mexc.js +2 -0
- package/js/src/okcoin.d.ts +1 -0
- package/js/src/okcoin.js +62 -18
- package/js/src/phemex.d.ts +3 -108
- package/js/src/phemex.js +159 -30
- package/js/src/poloniex.js +28 -2
- package/js/src/pro/binance.js +6 -6
- package/js/src/pro/poloniex.js +16 -11
- package/js/src/tokocrypto.js +30 -14
- package/js/src/wazirx.js +2 -0
- package/js/src/whitebit.js +2 -0
- package/js/src/woo.d.ts +1 -0
- package/js/src/woo.js +42 -15
- package/package.json +2 -2
|
@@ -194,6 +194,7 @@ class poloniex extends poloniex$1 {
|
|
|
194
194
|
* @param {object} [params] extra parameters specific to the poloniex api endpoint
|
|
195
195
|
* @param {string} [params.timeInForce] GTC (default), IOC, FOK
|
|
196
196
|
* @param {string} [params.clientOrderId] Maximum 64-character length.*
|
|
197
|
+
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
197
198
|
*
|
|
198
199
|
* EXCHANGE SPECIFIC PARAMETERS
|
|
199
200
|
* @param {string} [params.amount] quote units for the order
|
|
@@ -217,25 +218,29 @@ class poloniex extends poloniex$1 {
|
|
|
217
218
|
'type': type.toUpperCase(),
|
|
218
219
|
};
|
|
219
220
|
if ((uppercaseType === 'MARKET') && (uppercaseSide === 'BUY')) {
|
|
220
|
-
let quoteAmount =
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
221
|
+
let quoteAmount = undefined;
|
|
222
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
223
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
224
|
+
const cost = this.safeNumber(params, 'cost');
|
|
225
|
+
params = this.omit(params, 'cost');
|
|
226
|
+
if (cost !== undefined) {
|
|
227
|
+
quoteAmount = this.costToPrecision(symbol, cost);
|
|
228
|
+
}
|
|
229
|
+
else if (createMarketBuyOrderRequiresPrice) {
|
|
230
|
+
if (price === undefined) {
|
|
231
|
+
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');
|
|
226
232
|
}
|
|
227
233
|
else {
|
|
228
234
|
const amountString = this.numberToString(amount);
|
|
229
235
|
const priceString = this.numberToString(price);
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
quoteAmount = this.costToPrecision(symbol, amount);
|
|
236
|
+
const costRequest = Precise["default"].stringMul(amountString, priceString);
|
|
237
|
+
quoteAmount = this.costToPrecision(symbol, costRequest);
|
|
233
238
|
}
|
|
234
239
|
}
|
|
235
240
|
else {
|
|
236
241
|
quoteAmount = this.costToPrecision(symbol, amount);
|
|
237
242
|
}
|
|
238
|
-
request['amount'] =
|
|
243
|
+
request['amount'] = quoteAmount;
|
|
239
244
|
}
|
|
240
245
|
else {
|
|
241
246
|
request['quantity'] = this.amountToPrecision(market['symbol'], amount);
|
|
@@ -35,6 +35,9 @@ class tokocrypto extends tokocrypto$1 {
|
|
|
35
35
|
'cancelOrder': true,
|
|
36
36
|
'cancelOrders': undefined,
|
|
37
37
|
'createDepositAddress': false,
|
|
38
|
+
'createMarketBuyOrderWithCost': true,
|
|
39
|
+
'createMarketOrderWithCost': false,
|
|
40
|
+
'createMarketSellOrderWithCost': false,
|
|
38
41
|
'createOrder': true,
|
|
39
42
|
'createReduceOnlyOrder': undefined,
|
|
40
43
|
'createStopLimitOrder': true,
|
|
@@ -102,6 +105,8 @@ class tokocrypto extends tokocrypto$1 {
|
|
|
102
105
|
'fetchWithdrawals': true,
|
|
103
106
|
'fetchWithdrawalWhitelist': false,
|
|
104
107
|
'reduceMargin': false,
|
|
108
|
+
'repayCrossMargin': false,
|
|
109
|
+
'repayIsolatedMargin': false,
|
|
105
110
|
'setLeverage': false,
|
|
106
111
|
'setMargin': false,
|
|
107
112
|
'setMarginMode': false,
|
|
@@ -1577,6 +1582,7 @@ class tokocrypto extends tokocrypto$1 {
|
|
|
1577
1582
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1578
1583
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1579
1584
|
* @param {float} [params.triggerPrice] the price at which a trigger order would be triggered
|
|
1585
|
+
* @param {float} [params.cost] for spot market buy orders, the quote quantity that can be used as an alternative for the amount
|
|
1580
1586
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1581
1587
|
*/
|
|
1582
1588
|
await this.loadMarkets();
|
|
@@ -1656,20 +1662,30 @@ class tokocrypto extends tokocrypto$1 {
|
|
|
1656
1662
|
// LIMIT_MAKER quantity, price
|
|
1657
1663
|
//
|
|
1658
1664
|
if (uppercaseType === 'MARKET') {
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1665
|
+
if (side === 'buy') {
|
|
1666
|
+
const precision = market['precision']['price'];
|
|
1667
|
+
let quoteAmount = undefined;
|
|
1668
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
1669
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
1670
|
+
const cost = this.safeNumber2(params, 'cost', 'quoteOrderQty');
|
|
1671
|
+
params = this.omit(params, ['cost', 'quoteOrderQty']);
|
|
1672
|
+
if (cost !== undefined) {
|
|
1673
|
+
quoteAmount = cost;
|
|
1674
|
+
}
|
|
1675
|
+
else if (createMarketBuyOrderRequiresPrice) {
|
|
1676
|
+
if (price === undefined) {
|
|
1677
|
+
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');
|
|
1678
|
+
}
|
|
1679
|
+
else {
|
|
1680
|
+
const amountString = this.numberToString(amount);
|
|
1681
|
+
const priceString = this.numberToString(price);
|
|
1682
|
+
quoteAmount = Precise["default"].stringMul(amountString, priceString);
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
else {
|
|
1686
|
+
quoteAmount = amount;
|
|
1687
|
+
}
|
|
1688
|
+
request['quoteOrderQty'] = this.decimalToPrecision(quoteAmount, number.TRUNCATE, precision, this.precisionMode);
|
|
1673
1689
|
}
|
|
1674
1690
|
else {
|
|
1675
1691
|
quantityIsRequired = true;
|
package/dist/cjs/src/wazirx.js
CHANGED
package/dist/cjs/src/whitebit.js
CHANGED
package/dist/cjs/src/woo.js
CHANGED
|
@@ -37,7 +37,10 @@ class woo extends woo$1 {
|
|
|
37
37
|
'closeAllPositions': false,
|
|
38
38
|
'closePosition': false,
|
|
39
39
|
'createDepositAddress': false,
|
|
40
|
+
'createMarketBuyOrderWithCost': true,
|
|
40
41
|
'createMarketOrder': false,
|
|
42
|
+
'createMarketOrderWithCost': false,
|
|
43
|
+
'createMarketSellOrderWithCost': false,
|
|
41
44
|
'createOrder': true,
|
|
42
45
|
'createReduceOnlyOrder': true,
|
|
43
46
|
'createStopLimitOrder': false,
|
|
@@ -739,6 +742,25 @@ class woo extends woo$1 {
|
|
|
739
742
|
}
|
|
740
743
|
return result;
|
|
741
744
|
}
|
|
745
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
746
|
+
/**
|
|
747
|
+
* @method
|
|
748
|
+
* @name woo#createMarketBuyOrderWithCost
|
|
749
|
+
* @description create a market buy order by providing the symbol and cost
|
|
750
|
+
* @see https://docs.woo.org/#send-order
|
|
751
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
752
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
753
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
754
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
755
|
+
*/
|
|
756
|
+
await this.loadMarkets();
|
|
757
|
+
const market = this.market(symbol);
|
|
758
|
+
if (!market['spot']) {
|
|
759
|
+
throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
760
|
+
}
|
|
761
|
+
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
762
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
763
|
+
}
|
|
742
764
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
743
765
|
/**
|
|
744
766
|
* @method
|
|
@@ -758,9 +780,11 @@ class woo extends woo$1 {
|
|
|
758
780
|
* @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only)
|
|
759
781
|
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
|
|
760
782
|
* @param {float} [params.algoType] 'STOP'or 'TRAILING_STOP' or 'OCO' or 'CLOSE_POSITION'
|
|
783
|
+
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
761
784
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
762
785
|
*/
|
|
763
786
|
const reduceOnly = this.safeValue2(params, 'reduceOnly', 'reduce_only');
|
|
787
|
+
params = this.omit(params, ['reduceOnly', 'reduce_only']);
|
|
764
788
|
const orderType = type.toUpperCase();
|
|
765
789
|
await this.loadMarkets();
|
|
766
790
|
const market = this.market(symbol);
|
|
@@ -803,26 +827,29 @@ class woo extends woo$1 {
|
|
|
803
827
|
if (isMarket && !isStop) {
|
|
804
828
|
// for market buy it requires the amount of quote currency to spend
|
|
805
829
|
if (market['spot'] && orderSide === 'BUY') {
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
}
|
|
830
|
+
let quoteAmount = undefined;
|
|
831
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
832
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
833
|
+
const cost = this.safeNumber2(params, 'cost', 'order_amount');
|
|
834
|
+
params = this.omit(params, ['cost', 'order_amount']);
|
|
835
|
+
if (cost !== undefined) {
|
|
836
|
+
quoteAmount = this.costToPrecision(symbol, cost);
|
|
837
|
+
}
|
|
838
|
+
else if (createMarketBuyOrderRequiresPrice) {
|
|
839
|
+
if (price === undefined) {
|
|
840
|
+
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');
|
|
818
841
|
}
|
|
819
842
|
else {
|
|
820
|
-
|
|
843
|
+
const amountString = this.numberToString(amount);
|
|
844
|
+
const priceString = this.numberToString(price);
|
|
845
|
+
const costRequest = Precise["default"].stringMul(amountString, priceString);
|
|
846
|
+
quoteAmount = this.costToPrecision(symbol, costRequest);
|
|
821
847
|
}
|
|
822
848
|
}
|
|
823
849
|
else {
|
|
824
|
-
|
|
850
|
+
quoteAmount = this.costToPrecision(symbol, amount);
|
|
825
851
|
}
|
|
852
|
+
request['order_amount'] = quoteAmount;
|
|
826
853
|
}
|
|
827
854
|
else {
|
|
828
855
|
request['order_quantity'] = this.amountToPrecision(symbol, amount);
|
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 type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } 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.1.
|
|
7
|
+
declare const version = "4.1.89";
|
|
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.1.
|
|
41
|
+
const version = '4.1.90';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -22,6 +22,7 @@ interface Exchange {
|
|
|
22
22
|
v1GetMdSpotTicker24hrAll(params?: {}): Promise<implicitReturnType>;
|
|
23
23
|
v1GetExchangePublicProducts(params?: {}): Promise<implicitReturnType>;
|
|
24
24
|
v1GetApiDataPublicDataFundingRateHistory(params?: {}): Promise<implicitReturnType>;
|
|
25
|
+
v2GetPublicProducts(params?: {}): Promise<implicitReturnType>;
|
|
25
26
|
v2GetMdV2Orderbook(params?: {}): Promise<implicitReturnType>;
|
|
26
27
|
v2GetMdV2Trade(params?: {}): Promise<implicitReturnType>;
|
|
27
28
|
v2GetMdV2Ticker24hr(params?: {}): Promise<implicitReturnType>;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -3693,7 +3693,7 @@ export default class Exchange {
|
|
|
3693
3693
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3694
3694
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3695
3695
|
*/
|
|
3696
|
-
if (this.
|
|
3696
|
+
if (this.has['createMarketOrderWithCost'] || (this.has['createMarketBuyOrderWithCost'] && this.has['createMarketSellOrderWithCost'])) {
|
|
3697
3697
|
return await this.createOrder(symbol, 'market', side, cost, 1, params);
|
|
3698
3698
|
}
|
|
3699
3699
|
throw new NotSupported(this.id + ' createMarketOrderWithCost() is not supported yet');
|
|
@@ -3708,7 +3708,7 @@ export default class Exchange {
|
|
|
3708
3708
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3709
3709
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3710
3710
|
*/
|
|
3711
|
-
if (this.options['createMarketBuyOrderRequiresPrice'] || this.
|
|
3711
|
+
if (this.options['createMarketBuyOrderRequiresPrice'] || this.has['createMarketBuyOrderWithCost']) {
|
|
3712
3712
|
return await this.createOrder(symbol, 'market', 'buy', cost, 1, params);
|
|
3713
3713
|
}
|
|
3714
3714
|
throw new NotSupported(this.id + ' createMarketBuyOrderWithCost() is not supported yet');
|
package/js/src/bigone.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import Exchange from './abstract/bigone.js';
|
|
9
|
-
import { ExchangeError, AuthenticationError, InsufficientFunds, PermissionDenied, BadRequest, BadSymbol, RateLimitExceeded, InvalidOrder, ArgumentsRequired } from './base/errors.js';
|
|
9
|
+
import { ExchangeError, AuthenticationError, InsufficientFunds, PermissionDenied, BadRequest, BadSymbol, RateLimitExceeded, InvalidOrder, ArgumentsRequired, NotSupported } from './base/errors.js';
|
|
10
10
|
import { TICK_SIZE } from './base/functions/number.js';
|
|
11
11
|
import { jwt } from './base/functions/rsa.js';
|
|
12
12
|
import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
|
|
@@ -34,6 +34,7 @@ export default class bigone extends Exchange {
|
|
|
34
34
|
'cancelAllOrders': true,
|
|
35
35
|
'cancelOrder': true,
|
|
36
36
|
'createMarketBuyOrderWithCost': true,
|
|
37
|
+
'createMarketOrderWithCost': false,
|
|
37
38
|
'createMarketSellOrderWithCost': false,
|
|
38
39
|
'createOrder': true,
|
|
39
40
|
'createPostOnlyOrder': true,
|
|
@@ -1161,13 +1162,18 @@ export default class bigone extends Exchange {
|
|
|
1161
1162
|
/**
|
|
1162
1163
|
* @method
|
|
1163
1164
|
* @name bigone#createMarketBuyOrderWithCost
|
|
1164
|
-
* @see https://open.big.one/docs/spot_orders.html#create-order
|
|
1165
1165
|
* @description create a market buy order by providing the symbol and cost
|
|
1166
|
+
* @see https://open.big.one/docs/spot_orders.html#create-order
|
|
1166
1167
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1167
1168
|
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1168
1169
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1169
1170
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1170
1171
|
*/
|
|
1172
|
+
await this.loadMarkets();
|
|
1173
|
+
const market = this.market(symbol);
|
|
1174
|
+
if (!market['spot']) {
|
|
1175
|
+
throw new NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
1176
|
+
}
|
|
1171
1177
|
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
1172
1178
|
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
1173
1179
|
}
|
|
@@ -1186,6 +1192,7 @@ export default class bigone extends Exchange {
|
|
|
1186
1192
|
* @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
1187
1193
|
* @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately
|
|
1188
1194
|
* @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
|
|
1195
|
+
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
1189
1196
|
*
|
|
1190
1197
|
* EXCHANGE SPECIFIC PARAMETERS
|
|
1191
1198
|
* @param {string} operator *stop order only* GTE or LTE (default)
|
package/js/src/bitforex.js
CHANGED
|
@@ -77,6 +77,8 @@ export default class bitforex extends Exchange {
|
|
|
77
77
|
'fetchWithdrawal': false,
|
|
78
78
|
'fetchWithdrawals': false,
|
|
79
79
|
'reduceMargin': false,
|
|
80
|
+
'repayCrossMargin': false,
|
|
81
|
+
'repayIsolatedMargin': false,
|
|
80
82
|
'setLeverage': false,
|
|
81
83
|
'setMargin': false,
|
|
82
84
|
'setMarginMode': false,
|
package/js/src/bitget.js
CHANGED
|
@@ -3858,7 +3858,7 @@ export default class bitget extends Exchange {
|
|
|
3858
3858
|
if (feeCostString !== undefined) {
|
|
3859
3859
|
// swap
|
|
3860
3860
|
fee = {
|
|
3861
|
-
'cost': feeCostString,
|
|
3861
|
+
'cost': this.parseNumber(Precise.stringAbs(feeCostString)),
|
|
3862
3862
|
'currency': market['settle'],
|
|
3863
3863
|
};
|
|
3864
3864
|
}
|
|
@@ -3866,10 +3866,17 @@ export default class bitget extends Exchange {
|
|
|
3866
3866
|
if (feeDetail !== undefined) {
|
|
3867
3867
|
const parsedFeeDetail = JSON.parse(feeDetail);
|
|
3868
3868
|
const feeValues = Object.values(parsedFeeDetail);
|
|
3869
|
-
|
|
3869
|
+
let feeObject = undefined;
|
|
3870
|
+
for (let i = 0; i < feeValues.length; i++) {
|
|
3871
|
+
const feeValue = feeValues[i];
|
|
3872
|
+
if (this.safeValue(feeValue, 'feeCoinCode') !== undefined) {
|
|
3873
|
+
feeObject = feeValue;
|
|
3874
|
+
break;
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3870
3877
|
fee = {
|
|
3871
|
-
'cost': this.safeString(
|
|
3872
|
-
'currency': this.safeCurrencyCode(this.safeString(
|
|
3878
|
+
'cost': this.parseNumber(Precise.stringAbs(this.safeString(feeObject, 'totalFee'))),
|
|
3879
|
+
'currency': this.safeCurrencyCode(this.safeString(feeObject, 'feeCoinCode')),
|
|
3873
3880
|
};
|
|
3874
3881
|
}
|
|
3875
3882
|
let postOnly = undefined;
|
package/js/src/bitmex.js
CHANGED
|
@@ -41,6 +41,8 @@ export default class bitmex extends Exchange {
|
|
|
41
41
|
'cancelAllOrders': true,
|
|
42
42
|
'cancelOrder': true,
|
|
43
43
|
'cancelOrders': true,
|
|
44
|
+
'closeAllPositions': false,
|
|
45
|
+
'closePosition': true,
|
|
44
46
|
'createOrder': true,
|
|
45
47
|
'createReduceOnlyOrder': true,
|
|
46
48
|
'editOrder': true,
|
|
@@ -36,8 +36,6 @@ export default class blockchaincom extends Exchange {
|
|
|
36
36
|
}>;
|
|
37
37
|
parseTransactionState(state: any): string;
|
|
38
38
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
|
39
|
-
fetchWithdrawalWhitelist(params?: {}): Promise<any[]>;
|
|
40
|
-
fetchWithdrawalWhitelistByCurrency(code: string, params?: {}): Promise<any[]>;
|
|
41
39
|
withdraw(code: string, amount: any, address: any, tag?: any, params?: {}): Promise<Transaction>;
|
|
42
40
|
fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
43
41
|
fetchWithdrawal(id: string, code?: Str, params?: {}): Promise<Transaction>;
|
package/js/src/blockchaincom.js
CHANGED
|
@@ -909,47 +909,6 @@ export default class blockchaincom extends Exchange {
|
|
|
909
909
|
'fee': fee,
|
|
910
910
|
};
|
|
911
911
|
}
|
|
912
|
-
async fetchWithdrawalWhitelist(params = {}) {
|
|
913
|
-
/**
|
|
914
|
-
* @method
|
|
915
|
-
* @name blockchaincom#fetchWithdrawalWhitelist
|
|
916
|
-
* @description fetch the list of withdrawal addresses on the whitelist
|
|
917
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
918
|
-
* @returns {object} dictionary with keys beneficiaryId, name, currency
|
|
919
|
-
*/
|
|
920
|
-
await this.loadMarkets();
|
|
921
|
-
const response = await this.privateGetWhitelist();
|
|
922
|
-
const result = [];
|
|
923
|
-
for (let i = 0; i < response.length; i++) {
|
|
924
|
-
const entry = response[i];
|
|
925
|
-
result.push({
|
|
926
|
-
'beneficiaryId': this.safeString(entry, 'whitelistId'),
|
|
927
|
-
'name': this.safeString(entry, 'name'),
|
|
928
|
-
'currency': this.safeString(entry, 'currency'),
|
|
929
|
-
'info': entry,
|
|
930
|
-
});
|
|
931
|
-
}
|
|
932
|
-
return result;
|
|
933
|
-
}
|
|
934
|
-
async fetchWithdrawalWhitelistByCurrency(code, params = {}) {
|
|
935
|
-
await this.loadMarkets();
|
|
936
|
-
const currency = this.currency(code);
|
|
937
|
-
const request = {
|
|
938
|
-
'currency': currency['id'],
|
|
939
|
-
};
|
|
940
|
-
const response = await this.privateGetWhitelistCurrency(this.extend(request, params));
|
|
941
|
-
const result = [];
|
|
942
|
-
for (let i = 0; i < response.length; i++) {
|
|
943
|
-
const entry = response[i];
|
|
944
|
-
result.push({
|
|
945
|
-
'beneficiaryId': this.safeString(entry, 'whitelistId'),
|
|
946
|
-
'name': this.safeString(entry, 'name'),
|
|
947
|
-
'currency': this.safeString(entry, 'currency'),
|
|
948
|
-
'info': entry,
|
|
949
|
-
});
|
|
950
|
-
}
|
|
951
|
-
return result;
|
|
952
|
-
}
|
|
953
912
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
954
913
|
/**
|
|
955
914
|
* @method
|
package/js/src/bybit.js
CHANGED
|
@@ -947,6 +947,7 @@ export default class bybit extends Exchange {
|
|
|
947
947
|
},
|
|
948
948
|
'precisionMode': TICK_SIZE,
|
|
949
949
|
'options': {
|
|
950
|
+
'fetchMarkets': ['spot', 'linear', 'inverse', 'option'],
|
|
950
951
|
'enableUnifiedMargin': undefined,
|
|
951
952
|
'enableUnifiedAccount': undefined,
|
|
952
953
|
'createMarketBuyOrderRequiresPrice': true,
|
|
@@ -1452,21 +1453,35 @@ export default class bybit extends Exchange {
|
|
|
1452
1453
|
if (this.options['adjustForTimeDifference']) {
|
|
1453
1454
|
await this.loadTimeDifference();
|
|
1454
1455
|
}
|
|
1455
|
-
const promisesUnresolved = [
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1456
|
+
const promisesUnresolved = [];
|
|
1457
|
+
const fetchMarkets = this.safeValue(this.options, 'fetchMarkets', ['spot', 'linear', 'inverse']);
|
|
1458
|
+
for (let i = 0; i < fetchMarkets.length; i++) {
|
|
1459
|
+
const marketType = fetchMarkets[i];
|
|
1460
|
+
if (marketType === 'spot') {
|
|
1461
|
+
promisesUnresolved.push(this.fetchSpotMarkets(params));
|
|
1462
|
+
}
|
|
1463
|
+
else if (marketType === 'linear') {
|
|
1464
|
+
promisesUnresolved.push(this.fetchFutureMarkets({ 'category': 'linear' }));
|
|
1465
|
+
}
|
|
1466
|
+
else if (marketType === 'inverse') {
|
|
1467
|
+
promisesUnresolved.push(this.fetchFutureMarkets({ 'category': 'inverse' }));
|
|
1468
|
+
}
|
|
1469
|
+
else if (marketType === 'option') {
|
|
1470
|
+
promisesUnresolved.push(this.fetchOptionMarkets({ 'baseCoin': 'BTC' }));
|
|
1471
|
+
promisesUnresolved.push(this.fetchOptionMarkets({ 'baseCoin': 'ETH' }));
|
|
1472
|
+
promisesUnresolved.push(this.fetchOptionMarkets({ 'baseCoin': 'SOL' }));
|
|
1473
|
+
}
|
|
1474
|
+
else {
|
|
1475
|
+
throw new ExchangeError(this.id + ' fetchMarkets() this.options fetchMarkets "' + marketType + '" is not a supported market type');
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1463
1478
|
const promises = await Promise.all(promisesUnresolved);
|
|
1464
|
-
const spotMarkets = promises[
|
|
1465
|
-
const linearMarkets = promises[
|
|
1466
|
-
const inverseMarkets = promises[
|
|
1467
|
-
const btcOptionMarkets = promises[
|
|
1468
|
-
const ethOptionMarkets = promises[
|
|
1469
|
-
const solOptionMarkets = promises[
|
|
1479
|
+
const spotMarkets = this.safeValue(promises, 0, []);
|
|
1480
|
+
const linearMarkets = this.safeValue(promises, 1, []);
|
|
1481
|
+
const inverseMarkets = this.safeValue(promises, 2, []);
|
|
1482
|
+
const btcOptionMarkets = this.safeValue(promises, 3, []);
|
|
1483
|
+
const ethOptionMarkets = this.safeValue(promises, 4, []);
|
|
1484
|
+
const solOptionMarkets = this.safeValue(promises, 5, []);
|
|
1470
1485
|
const futureMarkets = this.arrayConcat(linearMarkets, inverseMarkets);
|
|
1471
1486
|
let optionMarkets = this.arrayConcat(btcOptionMarkets, ethOptionMarkets);
|
|
1472
1487
|
optionMarkets = this.arrayConcat(optionMarkets, solOptionMarkets);
|
package/js/src/coinex.js
CHANGED
|
@@ -49,6 +49,8 @@ export default class coinex extends Exchange {
|
|
|
49
49
|
'cancelOrders': true,
|
|
50
50
|
'createDepositAddress': true,
|
|
51
51
|
'createMarketBuyOrderWithCost': true,
|
|
52
|
+
'createMarketOrderWithCost': false,
|
|
53
|
+
'createMarketSellOrderWithCost': false,
|
|
52
54
|
'createOrder': true,
|
|
53
55
|
'createOrders': true,
|
|
54
56
|
'createReduceOnlyOrder': true,
|
|
@@ -1929,13 +1931,19 @@ export default class coinex extends Exchange {
|
|
|
1929
1931
|
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
1930
1932
|
/**
|
|
1931
1933
|
* @method
|
|
1932
|
-
* @name coinex#
|
|
1934
|
+
* @name coinex#createMarketBuyOrderWithCost
|
|
1933
1935
|
* @description create a market buy order by providing the symbol and cost
|
|
1936
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade003_market_order
|
|
1934
1937
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1935
1938
|
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1936
1939
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1937
1940
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1938
1941
|
*/
|
|
1942
|
+
await this.loadMarkets();
|
|
1943
|
+
const market = this.market(symbol);
|
|
1944
|
+
if (!market['spot']) {
|
|
1945
|
+
throw new NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
1946
|
+
}
|
|
1939
1947
|
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
1940
1948
|
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
1941
1949
|
}
|
|
@@ -2101,6 +2109,11 @@ export default class coinex extends Exchange {
|
|
|
2101
2109
|
* @method
|
|
2102
2110
|
* @name coinex#createOrder
|
|
2103
2111
|
* @description create a trade order
|
|
2112
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade001_limit_order
|
|
2113
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade003_market_order
|
|
2114
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade004_IOC_order
|
|
2115
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade005_stop_limit_order
|
|
2116
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade006_stop_market_order
|
|
2104
2117
|
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http017_put_limit
|
|
2105
2118
|
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http018_put_market
|
|
2106
2119
|
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http019_put_limit_stop
|
package/js/src/coinlist.js
CHANGED
|
@@ -109,6 +109,8 @@ export default class coinlist extends Exchange {
|
|
|
109
109
|
'fetchWithdrawals': false,
|
|
110
110
|
'fetchWithdrawalWhitelist': false,
|
|
111
111
|
'reduceMargin': false,
|
|
112
|
+
'repayCrossMargin': false,
|
|
113
|
+
'repayIsolatedMargin': false,
|
|
112
114
|
'setLeverage': false,
|
|
113
115
|
'setMargin': false,
|
|
114
116
|
'setMarginMode': false,
|
package/js/src/coinsph.js
CHANGED
|
@@ -111,6 +111,8 @@ export default class coinsph extends Exchange {
|
|
|
111
111
|
'fetchWithdrawals': true,
|
|
112
112
|
'fetchWithdrawalWhitelist': false,
|
|
113
113
|
'reduceMargin': false,
|
|
114
|
+
'repayCrossMargin': false,
|
|
115
|
+
'repayIsolatedMargin': false,
|
|
114
116
|
'setLeverage': false,
|
|
115
117
|
'setMargin': false,
|
|
116
118
|
'setMarginMode': false,
|
package/js/src/cryptocom.js
CHANGED
|
@@ -99,6 +99,8 @@ export default class cryptocom extends Exchange {
|
|
|
99
99
|
'fetchVolatilityHistory': false,
|
|
100
100
|
'fetchWithdrawals': true,
|
|
101
101
|
'reduceMargin': false,
|
|
102
|
+
'repayCrossMargin': false,
|
|
103
|
+
'repayIsolatedMargin': false,
|
|
102
104
|
'setLeverage': false,
|
|
103
105
|
'setMarginMode': false,
|
|
104
106
|
'setPositionMode': false,
|