ccxt 4.1.80 → 4.1.82
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/README.md +4 -4
- package/dist/ccxt.browser.js +445 -175
- package/dist/ccxt.browser.min.js +5 -5
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bybit.js +4 -2
- package/dist/cjs/src/coinex.js +191 -71
- package/dist/cjs/src/digifinex.js +42 -8
- package/dist/cjs/src/htx.js +12 -10
- package/dist/cjs/src/lbank.js +70 -38
- package/dist/cjs/src/okx.js +52 -7
- package/dist/cjs/src/pro/binance.js +1 -1
- package/dist/cjs/src/pro/bingx.js +1 -1
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/dist/cjs/src/pro/cex.js +1 -1
- package/dist/cjs/src/pro/coinbasepro.js +1 -1
- package/dist/cjs/src/pro/cryptocom.js +1 -1
- package/dist/cjs/src/pro/gate.js +1 -1
- package/dist/cjs/src/pro/kucoin.js +1 -1
- package/dist/cjs/src/pro/kucoinfutures.js +1 -1
- package/dist/cjs/src/pro/okx.js +1 -1
- package/dist/cjs/src/whitebit.js +62 -27
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bybit.d.ts +1 -0
- package/js/src/bybit.js +4 -2
- package/js/src/coinex.js +191 -71
- package/js/src/digifinex.d.ts +1 -0
- package/js/src/digifinex.js +42 -8
- package/js/src/htx.js +12 -10
- package/js/src/lbank.d.ts +1 -0
- package/js/src/lbank.js +71 -39
- package/js/src/okx.js +52 -7
- package/js/src/pro/binance.js +1 -1
- package/js/src/pro/bingx.js +1 -1
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bybit.js +1 -1
- package/js/src/pro/cex.js +1 -1
- package/js/src/pro/coinbasepro.js +1 -1
- package/js/src/pro/cryptocom.js +1 -1
- package/js/src/pro/gate.js +1 -1
- package/js/src/pro/kucoin.js +1 -1
- package/js/src/pro/kucoinfutures.js +1 -1
- package/js/src/pro/okx.js +1 -1
- package/js/src/whitebit.js +62 -27
- package/package.json +1 -1
package/js/src/digifinex.js
CHANGED
|
@@ -33,6 +33,9 @@ export default class digifinex extends Exchange {
|
|
|
33
33
|
'addMargin': true,
|
|
34
34
|
'cancelOrder': true,
|
|
35
35
|
'cancelOrders': true,
|
|
36
|
+
'createMarketBuyOrderWithCost': true,
|
|
37
|
+
'createMarketOrderWithCost': false,
|
|
38
|
+
'createMarketSellOrderWithCost': false,
|
|
36
39
|
'createOrder': true,
|
|
37
40
|
'createOrders': true,
|
|
38
41
|
'createPostOnlyOrder': true,
|
|
@@ -1565,6 +1568,7 @@ export default class digifinex extends Exchange {
|
|
|
1565
1568
|
* @param {bool} [params.postOnly] true or false
|
|
1566
1569
|
* @param {bool} [params.reduceOnly] true or false
|
|
1567
1570
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
1571
|
+
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
1568
1572
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1569
1573
|
*/
|
|
1570
1574
|
await this.loadMarkets();
|
|
@@ -1782,16 +1786,27 @@ export default class digifinex extends Exchange {
|
|
|
1782
1786
|
request['type'] = side + suffix;
|
|
1783
1787
|
// limit orders require the amount in the base currency, market orders require the amount in the quote currency
|
|
1784
1788
|
let quantity = undefined;
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
1790
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrderRequest', 'createMarketBuyOrderRequiresPrice', true);
|
|
1791
|
+
if (isMarketOrder && (side === 'buy')) {
|
|
1792
|
+
const cost = this.safeNumber(params, 'cost');
|
|
1793
|
+
params = this.omit(params, 'cost');
|
|
1794
|
+
if (cost !== undefined) {
|
|
1795
|
+
quantity = this.costToPrecision(symbol, cost);
|
|
1796
|
+
}
|
|
1797
|
+
else if (createMarketBuyOrderRequiresPrice) {
|
|
1798
|
+
if (price === undefined) {
|
|
1799
|
+
throw new InvalidOrder(this.id + ' createOrder() requires a price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
|
|
1800
|
+
}
|
|
1801
|
+
else {
|
|
1802
|
+
const amountString = this.numberToString(amount);
|
|
1803
|
+
const priceString = this.numberToString(price);
|
|
1804
|
+
const costRequest = this.parseNumber(Precise.stringMul(amountString, priceString));
|
|
1805
|
+
quantity = this.costToPrecision(symbol, costRequest);
|
|
1806
|
+
}
|
|
1789
1807
|
}
|
|
1790
1808
|
else {
|
|
1791
|
-
|
|
1792
|
-
const priceString = this.numberToString(price);
|
|
1793
|
-
const cost = this.parseNumber(Precise.stringMul(amountString, priceString));
|
|
1794
|
-
quantity = this.priceToPrecision(symbol, cost);
|
|
1809
|
+
quantity = this.costToPrecision(symbol, amount);
|
|
1795
1810
|
}
|
|
1796
1811
|
}
|
|
1797
1812
|
else {
|
|
@@ -1810,6 +1825,25 @@ export default class digifinex extends Exchange {
|
|
|
1810
1825
|
params = this.omit(params, ['postOnly']);
|
|
1811
1826
|
return this.extend(request, params);
|
|
1812
1827
|
}
|
|
1828
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
1829
|
+
/**
|
|
1830
|
+
* @method
|
|
1831
|
+
* @name digifinex#createMarketBuyOrderWithCost
|
|
1832
|
+
* @description create a market buy order by providing the symbol and cost
|
|
1833
|
+
* @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#create-new-order
|
|
1834
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1835
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1836
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1837
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1838
|
+
*/
|
|
1839
|
+
await this.loadMarkets();
|
|
1840
|
+
const market = this.market(symbol);
|
|
1841
|
+
if (!market['spot']) {
|
|
1842
|
+
throw new NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
1843
|
+
}
|
|
1844
|
+
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
1845
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
1846
|
+
}
|
|
1813
1847
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
1814
1848
|
/**
|
|
1815
1849
|
* @method
|
package/js/src/htx.js
CHANGED
|
@@ -3375,14 +3375,16 @@ export default class htx extends Exchange {
|
|
|
3375
3375
|
// "margin_mode": "cross",
|
|
3376
3376
|
// "margin_account": "USDT",
|
|
3377
3377
|
// "margin_asset": "USDT",
|
|
3378
|
-
// "margin_balance":
|
|
3379
|
-
// "
|
|
3380
|
-
// "
|
|
3381
|
-
// "
|
|
3382
|
-
// "
|
|
3383
|
-
// "
|
|
3384
|
-
// "
|
|
3385
|
-
// "
|
|
3378
|
+
// "margin_balance": 49.874186030200000000,
|
|
3379
|
+
// "money_in": 50,
|
|
3380
|
+
// "money_out": 0,
|
|
3381
|
+
// "margin_static": 49.872786030200000000,
|
|
3382
|
+
// "margin_position": 6.180000000000000000,
|
|
3383
|
+
// "margin_frozen": 6.000000000000000000,
|
|
3384
|
+
// "profit_unreal": 0.001400000000000000,
|
|
3385
|
+
// "withdraw_available": 37.6927860302,
|
|
3386
|
+
// "risk_rate": 271.984050521072796934,
|
|
3387
|
+
// "new_risk_rate": 0.001858676950514399,
|
|
3386
3388
|
// "contract_detail": [
|
|
3387
3389
|
// {
|
|
3388
3390
|
// "symbol": "MANA",
|
|
@@ -3489,8 +3491,8 @@ export default class htx extends Exchange {
|
|
|
3489
3491
|
}
|
|
3490
3492
|
else {
|
|
3491
3493
|
const account = this.account();
|
|
3492
|
-
account['free'] = this.safeString(first, '
|
|
3493
|
-
account['
|
|
3494
|
+
account['free'] = this.safeString(first, 'withdraw_available');
|
|
3495
|
+
account['total'] = this.safeString(first, 'margin_balance');
|
|
3494
3496
|
const currencyId = this.safeString2(first, 'margin_asset', 'symbol');
|
|
3495
3497
|
const code = this.safeCurrencyCode(currencyId);
|
|
3496
3498
|
result[code] = account;
|
package/js/src/lbank.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export default class lbank extends Exchange {
|
|
|
28
28
|
};
|
|
29
29
|
fetchTradingFee(symbol: string, params?: {}): Promise<{}>;
|
|
30
30
|
fetchTradingFees(params?: {}): Promise<{}>;
|
|
31
|
+
createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
|
|
31
32
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
|
|
32
33
|
parseOrderStatus(status: any): string;
|
|
33
34
|
parseOrder(order: any, market?: Market): Order;
|
package/js/src/lbank.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import Exchange from './abstract/lbank.js';
|
|
9
|
-
import { ExchangeError, InvalidAddress, DuplicateOrderId, InsufficientFunds, InvalidOrder, InvalidNonce, AuthenticationError, RateLimitExceeded, PermissionDenied, BadRequest, BadSymbol, ArgumentsRequired } from './base/errors.js';
|
|
9
|
+
import { ExchangeError, InvalidAddress, DuplicateOrderId, InsufficientFunds, InvalidOrder, InvalidNonce, AuthenticationError, RateLimitExceeded, PermissionDenied, BadRequest, BadSymbol, ArgumentsRequired, NotSupported } from './base/errors.js';
|
|
10
10
|
import { TICK_SIZE } from './base/functions/number.js';
|
|
11
11
|
import { Precise } from './base/Precise.js';
|
|
12
12
|
import { md5 } from './static_dependencies/noble-hashes/md5.js';
|
|
@@ -37,6 +37,9 @@ export default class lbank extends Exchange {
|
|
|
37
37
|
'addMargin': false,
|
|
38
38
|
'cancelAllOrders': true,
|
|
39
39
|
'cancelOrder': true,
|
|
40
|
+
'createMarketBuyOrderWithCost': true,
|
|
41
|
+
'createMarketOrderWithCost': false,
|
|
42
|
+
'createMarketSellOrderWithCost': false,
|
|
40
43
|
'createOrder': true,
|
|
41
44
|
'createReduceOnlyOrder': false,
|
|
42
45
|
'createStopLimitOrder': false,
|
|
@@ -107,10 +110,10 @@ export default class lbank extends Exchange {
|
|
|
107
110
|
'contract': 'https://lbkperp.lbank.com',
|
|
108
111
|
},
|
|
109
112
|
'api2': 'https://api.lbkex.com',
|
|
110
|
-
'www': 'https://www.lbank.
|
|
111
|
-
'doc': 'https://www.lbank.
|
|
112
|
-
'fees': 'https://
|
|
113
|
-
'referral': 'https://www.lbank.
|
|
113
|
+
'www': 'https://www.lbank.com',
|
|
114
|
+
'doc': 'https://www.lbank.com/en-US/docs/index.html',
|
|
115
|
+
'fees': 'https://support.lbank.site/hc/en-gb/articles/900000535703-Trading-Fees-From-14-00-on-April-7-2020-UTC-8-',
|
|
116
|
+
'referral': 'https://www.lbank.com/login/?icode=7QCY',
|
|
114
117
|
},
|
|
115
118
|
'api': {
|
|
116
119
|
'spot': {
|
|
@@ -298,7 +301,7 @@ export default class lbank extends Exchange {
|
|
|
298
301
|
* @method
|
|
299
302
|
* @name lbank2#fetchTime
|
|
300
303
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
301
|
-
* @see https://www.lbank.
|
|
304
|
+
* @see https://www.lbank.com/en-US/docs/index.html#get-timestamp
|
|
302
305
|
* @see https://www.lbank.com/en-US/docs/contract.html#get-the-current-time
|
|
303
306
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
304
307
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
@@ -593,7 +596,7 @@ export default class lbank extends Exchange {
|
|
|
593
596
|
* @method
|
|
594
597
|
* @name lbank2#fetchTicker
|
|
595
598
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
596
|
-
* @see https://www.lbank.
|
|
599
|
+
* @see https://www.lbank.com/en-US/docs/index.html#query-current-market-data-new
|
|
597
600
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
598
601
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
599
602
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -638,7 +641,7 @@ export default class lbank extends Exchange {
|
|
|
638
641
|
* @method
|
|
639
642
|
* @name lbank2#fetchTickers
|
|
640
643
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
641
|
-
* @see https://www.lbank.
|
|
644
|
+
* @see https://www.lbank.com/en-US/docs/index.html#query-current-market-data-new
|
|
642
645
|
* @see https://www.lbank.com/en-US/docs/contract.html#query-contract-market-list
|
|
643
646
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
644
647
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -718,7 +721,7 @@ export default class lbank extends Exchange {
|
|
|
718
721
|
* @method
|
|
719
722
|
* @name lbank2#fetchOrderBook
|
|
720
723
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
721
|
-
* @see https://www.lbank.
|
|
724
|
+
* @see https://www.lbank.com/en-US/docs/index.html#query-market-depth
|
|
722
725
|
* @see https://www.lbank.com/en-US/docs/contract.html#get-handicap
|
|
723
726
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
724
727
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
@@ -907,8 +910,8 @@ export default class lbank extends Exchange {
|
|
|
907
910
|
* @method
|
|
908
911
|
* @name lbank2#fetchTrades
|
|
909
912
|
* @description get the list of most recent trades for a particular symbol
|
|
910
|
-
* @see https://www.lbank.
|
|
911
|
-
* @see https://www.lbank.
|
|
913
|
+
* @see https://www.lbank.com/en-US/docs/index.html#query-historical-transactions
|
|
914
|
+
* @see https://www.lbank.com/en-US/docs/index.html#recent-transactions-list
|
|
912
915
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
913
916
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
914
917
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -980,7 +983,7 @@ export default class lbank extends Exchange {
|
|
|
980
983
|
* @method
|
|
981
984
|
* @name lbank2#fetchOHLCV
|
|
982
985
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
983
|
-
* @see https://www.lbank.
|
|
986
|
+
* @see https://www.lbank.com/en-US/docs/index.html#query-k-bar-data
|
|
984
987
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
985
988
|
* @param {string} timeframe the length of time each candle represents
|
|
986
989
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -1165,9 +1168,9 @@ export default class lbank extends Exchange {
|
|
|
1165
1168
|
* @method
|
|
1166
1169
|
* @name lbank2#fetchBalance
|
|
1167
1170
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
1168
|
-
* @see https://www.lbank.
|
|
1169
|
-
* @see https://www.lbank.
|
|
1170
|
-
* @see https://www.lbank.
|
|
1171
|
+
* @see https://www.lbank.com/en-US/docs/index.html#asset-information
|
|
1172
|
+
* @see https://www.lbank.com/en-US/docs/index.html#account-information
|
|
1173
|
+
* @see https://www.lbank.com/en-US/docs/index.html#get-all-coins-information
|
|
1171
1174
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1172
1175
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
1173
1176
|
*/
|
|
@@ -1232,7 +1235,7 @@ export default class lbank extends Exchange {
|
|
|
1232
1235
|
* @method
|
|
1233
1236
|
* @name lbank2#fetchTradingFee
|
|
1234
1237
|
* @description fetch the trading fees for a market
|
|
1235
|
-
* @see https://www.lbank.
|
|
1238
|
+
* @see https://www.lbank.com/en-US/docs/index.html#transaction-fee-rate-query
|
|
1236
1239
|
* @param {string} symbol unified market symbol
|
|
1237
1240
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1238
1241
|
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
@@ -1246,7 +1249,7 @@ export default class lbank extends Exchange {
|
|
|
1246
1249
|
* @method
|
|
1247
1250
|
* @name lbank2#fetchTradingFees
|
|
1248
1251
|
* @description fetch the trading fees for multiple markets
|
|
1249
|
-
* @see https://www.lbank.
|
|
1252
|
+
* @see https://www.lbank.com/en-US/docs/index.html#transaction-fee-rate-query
|
|
1250
1253
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1251
1254
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
1252
1255
|
*/
|
|
@@ -1262,13 +1265,33 @@ export default class lbank extends Exchange {
|
|
|
1262
1265
|
}
|
|
1263
1266
|
return result;
|
|
1264
1267
|
}
|
|
1268
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
1269
|
+
/**
|
|
1270
|
+
* @method
|
|
1271
|
+
* @name lbank#createMarketBuyOrderWithCost
|
|
1272
|
+
* @description create a market buy order by providing the symbol and cost
|
|
1273
|
+
* @see https://www.lbank.com/en-US/docs/index.html#place-order
|
|
1274
|
+
* @see https://www.lbank.com/en-US/docs/index.html#place-an-order
|
|
1275
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1276
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1277
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1278
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1279
|
+
*/
|
|
1280
|
+
await this.loadMarkets();
|
|
1281
|
+
const market = this.market(symbol);
|
|
1282
|
+
if (!market['spot']) {
|
|
1283
|
+
throw new NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
1284
|
+
}
|
|
1285
|
+
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
1286
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
1287
|
+
}
|
|
1265
1288
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1266
1289
|
/**
|
|
1267
1290
|
* @method
|
|
1268
1291
|
* @name lbank2#createOrder
|
|
1269
1292
|
* @description create a trade order
|
|
1270
|
-
* @see https://www.lbank.
|
|
1271
|
-
* @see https://www.lbank.
|
|
1293
|
+
* @see https://www.lbank.com/en-US/docs/index.html#place-order
|
|
1294
|
+
* @see https://www.lbank.com/en-US/docs/index.html#place-an-order
|
|
1272
1295
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1273
1296
|
* @param {string} type 'market' or 'limit'
|
|
1274
1297
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -1313,21 +1336,30 @@ export default class lbank extends Exchange {
|
|
|
1313
1336
|
}
|
|
1314
1337
|
else if (side === 'buy') {
|
|
1315
1338
|
request['type'] = side + '_' + 'market';
|
|
1316
|
-
|
|
1339
|
+
let quoteAmount = undefined;
|
|
1340
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
1341
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
1342
|
+
const cost = this.safeNumber(params, 'cost');
|
|
1343
|
+
params = this.omit(params, 'cost');
|
|
1344
|
+
if (cost !== undefined) {
|
|
1345
|
+
quoteAmount = this.costToPrecision(symbol, cost);
|
|
1346
|
+
}
|
|
1347
|
+
else if (createMarketBuyOrderRequiresPrice) {
|
|
1317
1348
|
if (price === undefined) {
|
|
1318
|
-
throw new InvalidOrder(this.id +
|
|
1349
|
+
throw new 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 in the amount argument');
|
|
1319
1350
|
}
|
|
1320
1351
|
else {
|
|
1321
1352
|
const amountString = this.numberToString(amount);
|
|
1322
1353
|
const priceString = this.numberToString(price);
|
|
1323
|
-
const
|
|
1324
|
-
|
|
1325
|
-
request['price'] = this.priceToPrecision(symbol, cost);
|
|
1354
|
+
const costRequest = Precise.stringMul(amountString, priceString);
|
|
1355
|
+
quoteAmount = this.costToPrecision(symbol, costRequest);
|
|
1326
1356
|
}
|
|
1327
1357
|
}
|
|
1328
1358
|
else {
|
|
1329
|
-
|
|
1359
|
+
quoteAmount = this.costToPrecision(symbol, amount);
|
|
1330
1360
|
}
|
|
1361
|
+
// market buys require filling the price param instead of the amount param, for market buys the price is treated as the cost by lbank
|
|
1362
|
+
request['price'] = quoteAmount;
|
|
1331
1363
|
}
|
|
1332
1364
|
}
|
|
1333
1365
|
if (clientOrderId !== undefined) {
|
|
@@ -1499,8 +1531,8 @@ export default class lbank extends Exchange {
|
|
|
1499
1531
|
* @method
|
|
1500
1532
|
* @name lbank2#fetchOrder
|
|
1501
1533
|
* @description fetches information on an order made by the user
|
|
1502
|
-
* @see https://www.lbank.
|
|
1503
|
-
* @see https://www.lbank.
|
|
1534
|
+
* @see https://www.lbank.com/en-US/docs/index.html#query-order
|
|
1535
|
+
* @see https://www.lbank.com/en-US/docs/index.html#query-order-new
|
|
1504
1536
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
1505
1537
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1506
1538
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -1603,7 +1635,7 @@ export default class lbank extends Exchange {
|
|
|
1603
1635
|
* @method
|
|
1604
1636
|
* @name lbank2#fetchMyTrades
|
|
1605
1637
|
* @description fetch all trades made by the user
|
|
1606
|
-
* @see https://www.lbank.
|
|
1638
|
+
* @see https://www.lbank.com/en-US/docs/index.html#past-transaction-details
|
|
1607
1639
|
* @param {string} symbol unified market symbol
|
|
1608
1640
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
1609
1641
|
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
@@ -1662,7 +1694,7 @@ export default class lbank extends Exchange {
|
|
|
1662
1694
|
* @method
|
|
1663
1695
|
* @name lbank2#fetchOrders
|
|
1664
1696
|
* @description fetches information on multiple orders made by the user
|
|
1665
|
-
* @see https://www.lbank.
|
|
1697
|
+
* @see https://www.lbank.com/en-US/docs/index.html#query-all-orders
|
|
1666
1698
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1667
1699
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
1668
1700
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -1722,7 +1754,7 @@ export default class lbank extends Exchange {
|
|
|
1722
1754
|
* @method
|
|
1723
1755
|
* @name lbank2#fetchOpenOrders
|
|
1724
1756
|
* @description fetch all unfilled currently open orders
|
|
1725
|
-
* @see https://www.lbank.
|
|
1757
|
+
* @see https://www.lbank.com/en-US/docs/index.html#current-pending-order
|
|
1726
1758
|
* @param {string} symbol unified market symbol
|
|
1727
1759
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
1728
1760
|
* @param {int} [limit] the maximum number of open order structures to retrieve
|
|
@@ -1779,7 +1811,7 @@ export default class lbank extends Exchange {
|
|
|
1779
1811
|
* @method
|
|
1780
1812
|
* @name lbank2#cancelOrder
|
|
1781
1813
|
* @description cancels an open order
|
|
1782
|
-
* @see https://www.lbank.
|
|
1814
|
+
* @see https://www.lbank.com/en-US/docs/index.html#cancel-order-new
|
|
1783
1815
|
* @param {string} id order id
|
|
1784
1816
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
1785
1817
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -1821,7 +1853,7 @@ export default class lbank extends Exchange {
|
|
|
1821
1853
|
* @method
|
|
1822
1854
|
* @name lbank2#cancelAllOrders
|
|
1823
1855
|
* @description cancel all open orders in a market
|
|
1824
|
-
* @see https://www.lbank.
|
|
1856
|
+
* @see https://www.lbank.com/en-US/docs/index.html#cancel-all-pending-orders-for-a-single-trading-pair
|
|
1825
1857
|
* @param {string} symbol unified market symbol of the market to cancel orders in
|
|
1826
1858
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1827
1859
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -1868,8 +1900,8 @@ export default class lbank extends Exchange {
|
|
|
1868
1900
|
* @method
|
|
1869
1901
|
* @name lbank2#fetchDepositAddress
|
|
1870
1902
|
* @description fetch the deposit address for a currency associated with this account
|
|
1871
|
-
* @see https://www.lbank.
|
|
1872
|
-
* @see https://www.lbank.
|
|
1903
|
+
* @see https://www.lbank.com/en-US/docs/index.html#get-deposit-address
|
|
1904
|
+
* @see https://www.lbank.com/en-US/docs/index.html#the-user-obtains-the-deposit-address
|
|
1873
1905
|
* @param {string} code unified currency code
|
|
1874
1906
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1875
1907
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -1967,7 +1999,7 @@ export default class lbank extends Exchange {
|
|
|
1967
1999
|
* @method
|
|
1968
2000
|
* @name lbank2#withdraw
|
|
1969
2001
|
* @description make a withdrawal
|
|
1970
|
-
* @see https://www.lbank.
|
|
2002
|
+
* @see https://www.lbank.com/en-US/docs/index.html#withdrawal
|
|
1971
2003
|
* @param {string} code unified currency code
|
|
1972
2004
|
* @param {float} amount the amount to withdraw
|
|
1973
2005
|
* @param {string} address the address to withdraw to
|
|
@@ -2133,7 +2165,7 @@ export default class lbank extends Exchange {
|
|
|
2133
2165
|
* @method
|
|
2134
2166
|
* @name lbank2#fetchDeposits
|
|
2135
2167
|
* @description fetch all deposits made to an account
|
|
2136
|
-
* @see https://www.lbank.
|
|
2168
|
+
* @see https://www.lbank.com/en-US/docs/index.html#get-recharge-history
|
|
2137
2169
|
* @param {string} code unified currency code
|
|
2138
2170
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
2139
2171
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
@@ -2186,7 +2218,7 @@ export default class lbank extends Exchange {
|
|
|
2186
2218
|
* @method
|
|
2187
2219
|
* @name lbank2#fetchWithdrawals
|
|
2188
2220
|
* @description fetch all withdrawals made from an account
|
|
2189
|
-
* @see https://www.lbank.
|
|
2221
|
+
* @see https://www.lbank.com/en-US/docs/index.html#get-withdrawal-history
|
|
2190
2222
|
* @param {string} code unified currency code
|
|
2191
2223
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
2192
2224
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
@@ -2389,8 +2421,8 @@ export default class lbank extends Exchange {
|
|
|
2389
2421
|
* @method
|
|
2390
2422
|
* @name lbank2#fetchDepositWithdrawFees
|
|
2391
2423
|
* @description when using private endpoint, only returns information for currencies with non-zero balance, use public method by specifying this.options['fetchDepositWithdrawFees']['method'] = 'fetchPublicDepositWithdrawFees'
|
|
2392
|
-
* @see https://www.lbank.
|
|
2393
|
-
* @see https://www.lbank.
|
|
2424
|
+
* @see https://www.lbank.com/en-US/docs/index.html#get-all-coins-information
|
|
2425
|
+
* @see https://www.lbank.com/en-US/docs/index.html#withdrawal-configurations
|
|
2394
2426
|
* @param {string[]|undefined} codes array of unified currency codes
|
|
2395
2427
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2396
2428
|
* @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
package/js/src/okx.js
CHANGED
|
@@ -3137,7 +3137,13 @@ export default class okx extends Exchange {
|
|
|
3137
3137
|
});
|
|
3138
3138
|
}
|
|
3139
3139
|
}
|
|
3140
|
-
|
|
3140
|
+
let response = undefined;
|
|
3141
|
+
if (method === 'privatePostTradeCancelAlgos') {
|
|
3142
|
+
response = await this.privatePostTradeCancelAlgos(request); // * dont extend with params, otherwise ARRAY will be turned into OBJECT
|
|
3143
|
+
}
|
|
3144
|
+
else {
|
|
3145
|
+
response = await this.privatePostTradeCancelBatchOrders(request); // * dont extend with params, otherwise ARRAY will be turned into OBJECT
|
|
3146
|
+
}
|
|
3141
3147
|
//
|
|
3142
3148
|
// {
|
|
3143
3149
|
// "code": "0",
|
|
@@ -3436,7 +3442,13 @@ export default class okx extends Exchange {
|
|
|
3436
3442
|
}
|
|
3437
3443
|
}
|
|
3438
3444
|
const query = this.omit(params, ['method', 'clOrdId', 'clientOrderId', 'stop']);
|
|
3439
|
-
|
|
3445
|
+
let response = undefined;
|
|
3446
|
+
if (method === 'privateGetTradeOrderAlgo') {
|
|
3447
|
+
response = await this.privateGetTradeOrderAlgo(this.extend(request, query));
|
|
3448
|
+
}
|
|
3449
|
+
else {
|
|
3450
|
+
response = await this.privateGetTradeOrder(this.extend(request, query));
|
|
3451
|
+
}
|
|
3440
3452
|
//
|
|
3441
3453
|
// Spot and Swap
|
|
3442
3454
|
//
|
|
@@ -3595,7 +3607,13 @@ export default class okx extends Exchange {
|
|
|
3595
3607
|
}
|
|
3596
3608
|
}
|
|
3597
3609
|
const query = this.omit(params, ['method', 'stop']);
|
|
3598
|
-
|
|
3610
|
+
let response = undefined;
|
|
3611
|
+
if (method === 'privateGetTradeOrdersAlgoPending') {
|
|
3612
|
+
response = await this.privateGetTradeOrdersAlgoPending(this.extend(request, query));
|
|
3613
|
+
}
|
|
3614
|
+
else {
|
|
3615
|
+
response = await this.privateGetTradeOrdersPending(this.extend(request, query));
|
|
3616
|
+
}
|
|
3599
3617
|
//
|
|
3600
3618
|
// {
|
|
3601
3619
|
// "code": "0",
|
|
@@ -3767,7 +3785,13 @@ export default class okx extends Exchange {
|
|
|
3767
3785
|
}
|
|
3768
3786
|
}
|
|
3769
3787
|
const send = this.omit(query, ['method', 'stop', 'ordType']);
|
|
3770
|
-
|
|
3788
|
+
let response = undefined;
|
|
3789
|
+
if (method === 'privateGetTradeOrdersAlgoHistory') {
|
|
3790
|
+
response = await this.privateGetTradeOrdersAlgoHistory(this.extend(request, send));
|
|
3791
|
+
}
|
|
3792
|
+
else {
|
|
3793
|
+
response = await this.privateGetTradeOrdersHistory(this.extend(request, send));
|
|
3794
|
+
}
|
|
3771
3795
|
//
|
|
3772
3796
|
// {
|
|
3773
3797
|
// "code": "0",
|
|
@@ -3944,7 +3968,13 @@ export default class okx extends Exchange {
|
|
|
3944
3968
|
request['state'] = 'filled';
|
|
3945
3969
|
}
|
|
3946
3970
|
const send = this.omit(query, ['method', 'stop']);
|
|
3947
|
-
|
|
3971
|
+
let response = undefined;
|
|
3972
|
+
if (method === 'privateGetTradeOrdersAlgoHistory') {
|
|
3973
|
+
response = await this.privateGetTradeOrdersAlgoHistory(this.extend(request, send));
|
|
3974
|
+
}
|
|
3975
|
+
else {
|
|
3976
|
+
response = await this.privateGetTradeOrdersHistory(this.extend(request, send));
|
|
3977
|
+
}
|
|
3948
3978
|
//
|
|
3949
3979
|
// {
|
|
3950
3980
|
// "code": "0",
|
|
@@ -4197,7 +4227,16 @@ export default class okx extends Exchange {
|
|
|
4197
4227
|
request['ccy'] = currency['id'];
|
|
4198
4228
|
}
|
|
4199
4229
|
[request, params] = this.handleUntilOption('end', request, params);
|
|
4200
|
-
|
|
4230
|
+
let response = undefined;
|
|
4231
|
+
if (method === 'privateGetAccountBillsArchive') {
|
|
4232
|
+
response = await this.privateGetAccountBillsArchive(this.extend(request, query));
|
|
4233
|
+
}
|
|
4234
|
+
else if (method === 'privateGetAssetBills') {
|
|
4235
|
+
response = await this.privateGetAssetBills(this.extend(request, query));
|
|
4236
|
+
}
|
|
4237
|
+
else {
|
|
4238
|
+
response = await this.privateGetAccountBills(this.extend(request, query));
|
|
4239
|
+
}
|
|
4201
4240
|
//
|
|
4202
4241
|
// privateGetAccountBills, privateGetAccountBillsArchive
|
|
4203
4242
|
//
|
|
@@ -5109,7 +5148,13 @@ export default class okx extends Exchange {
|
|
|
5109
5148
|
}
|
|
5110
5149
|
const fetchPositionsOptions = this.safeValue(this.options, 'fetchPositions', {});
|
|
5111
5150
|
const method = this.safeString(fetchPositionsOptions, 'method', 'privateGetAccountPositions');
|
|
5112
|
-
|
|
5151
|
+
let response = undefined;
|
|
5152
|
+
if (method === 'privateGetAccountPositionsHistory') {
|
|
5153
|
+
response = await this.privateGetAccountPositionsHistory(this.extend(request, params));
|
|
5154
|
+
}
|
|
5155
|
+
else {
|
|
5156
|
+
response = await this.privateGetAccountPositions(this.extend(request, params));
|
|
5157
|
+
}
|
|
5113
5158
|
//
|
|
5114
5159
|
// {
|
|
5115
5160
|
// "code": "0",
|
package/js/src/pro/binance.js
CHANGED
|
@@ -499,7 +499,7 @@ export default class binance extends binanceRest {
|
|
|
499
499
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
500
500
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
501
501
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
502
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com
|
|
502
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
503
503
|
*/
|
|
504
504
|
await this.loadMarkets();
|
|
505
505
|
symbols = this.marketSymbols(symbols, undefined, false, true, true);
|
package/js/src/pro/bingx.js
CHANGED
|
@@ -528,7 +528,7 @@ export default class bingx extends bingxRest {
|
|
|
528
528
|
* @see https://bingx-api.github.io/docs/#/swapV2/socket/account.html#Account%20balance%20and%20position%20update%20push
|
|
529
529
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
530
530
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
531
|
-
* @returns {object} a [balance structure]{@link https://docs.ccxt.com
|
|
531
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
532
532
|
*/
|
|
533
533
|
await this.loadMarkets();
|
|
534
534
|
await this.authenticate();
|
package/js/src/pro/bitget.js
CHANGED
|
@@ -664,7 +664,7 @@ export default class bitget extends bitgetRest {
|
|
|
664
664
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
665
665
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
666
666
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
667
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com
|
|
667
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
668
668
|
*/
|
|
669
669
|
const symbolsLength = symbols.length;
|
|
670
670
|
if (symbolsLength === 0) {
|
package/js/src/pro/bybit.js
CHANGED
|
@@ -704,7 +704,7 @@ export default class bybit extends bybitRest {
|
|
|
704
704
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
705
705
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
706
706
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
707
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com
|
|
707
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
708
708
|
*/
|
|
709
709
|
await this.loadMarkets();
|
|
710
710
|
symbols = this.marketSymbols(symbols);
|
package/js/src/pro/cex.js
CHANGED
|
@@ -413,7 +413,7 @@ export default class cex extends cexRest {
|
|
|
413
413
|
* @see https://docs.cex.io/#ws-api-get-balance
|
|
414
414
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
415
415
|
* @param {object} [params] extra parameters specific to the cex api endpoint
|
|
416
|
-
* @returns {object} a [balance structure]{@link https://docs.ccxt.com
|
|
416
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
417
417
|
*/
|
|
418
418
|
await this.loadMarkets();
|
|
419
419
|
await this.authenticate();
|
|
@@ -173,7 +173,7 @@ export default class coinbasepro extends coinbaseproRest {
|
|
|
173
173
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
174
174
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
175
175
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
176
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com
|
|
176
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
177
177
|
*/
|
|
178
178
|
const symbolsLength = symbols.length;
|
|
179
179
|
if (symbolsLength === 0) {
|
package/js/src/pro/cryptocom.js
CHANGED
|
@@ -179,7 +179,7 @@ export default class cryptocom extends cryptocomRest {
|
|
|
179
179
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
180
180
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
181
181
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
182
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com
|
|
182
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
183
183
|
*/
|
|
184
184
|
await this.loadMarkets();
|
|
185
185
|
symbols = this.marketSymbols(symbols);
|
package/js/src/pro/gate.js
CHANGED
|
@@ -412,7 +412,7 @@ export default class gate extends gateRest {
|
|
|
412
412
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
413
413
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
414
414
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
415
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com
|
|
415
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
416
416
|
*/
|
|
417
417
|
await this.loadMarkets();
|
|
418
418
|
symbols = this.marketSymbols(symbols);
|
package/js/src/pro/kucoin.js
CHANGED
|
@@ -357,7 +357,7 @@ export default class kucoin extends kucoinRest {
|
|
|
357
357
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
358
358
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
359
359
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
360
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com
|
|
360
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
361
361
|
*/
|
|
362
362
|
const symbolsLength = symbols.length;
|
|
363
363
|
if (symbolsLength === 0) {
|