ccxt 4.3.29 → 4.3.30
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 +3 -3
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +6 -0
- package/dist/cjs/src/bingx.js +1 -1
- package/dist/cjs/src/coinex.js +260 -311
- package/dist/cjs/src/whitebit.js +54 -4
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.js +6 -0
- package/js/src/bingx.js +1 -1
- package/js/src/coinex.d.ts +5 -6
- package/js/src/coinex.js +260 -311
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/js/src/whitebit.d.ts +2 -0
- package/js/src/whitebit.js +54 -4
- package/package.json +3 -1
package/dist/cjs/src/whitebit.js
CHANGED
|
@@ -32,6 +32,9 @@ class whitebit extends whitebit$1 {
|
|
|
32
32
|
'cancelAllOrdersAfter': true,
|
|
33
33
|
'cancelOrder': true,
|
|
34
34
|
'cancelOrders': false,
|
|
35
|
+
'createMarketBuyOrderWithCost': true,
|
|
36
|
+
'createMarketOrderWithCost': false,
|
|
37
|
+
'createMarketSellOrderWithCost': false,
|
|
35
38
|
'createOrder': true,
|
|
36
39
|
'createStopLimitOrder': true,
|
|
37
40
|
'createStopMarketOrder': true,
|
|
@@ -1197,6 +1200,33 @@ class whitebit extends whitebit$1 {
|
|
|
1197
1200
|
//
|
|
1198
1201
|
return this.safeInteger(response, 'time');
|
|
1199
1202
|
}
|
|
1203
|
+
async createMarketOrderWithCost(symbol, side, cost, params = {}) {
|
|
1204
|
+
/**
|
|
1205
|
+
* @method
|
|
1206
|
+
* @name createMarketOrderWithCost
|
|
1207
|
+
* @description create a market order by providing the symbol, side and cost
|
|
1208
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1209
|
+
* @param {string} side 'buy' or 'sell'
|
|
1210
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1211
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1212
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1213
|
+
*/
|
|
1214
|
+
params['cost'] = cost;
|
|
1215
|
+
// only buy side is supported
|
|
1216
|
+
return await this.createOrder(symbol, 'market', side, 0, undefined, params);
|
|
1217
|
+
}
|
|
1218
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
1219
|
+
/**
|
|
1220
|
+
* @method
|
|
1221
|
+
* @name createMarketBuyOrderWithCost
|
|
1222
|
+
* @description create a market buy order by providing the symbol and cost
|
|
1223
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1224
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1225
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1226
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1227
|
+
*/
|
|
1228
|
+
return await this.createMarketOrderWithCost(symbol, 'buy', cost, params);
|
|
1229
|
+
}
|
|
1200
1230
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1201
1231
|
/**
|
|
1202
1232
|
* @method
|
|
@@ -1213,6 +1243,7 @@ class whitebit extends whitebit$1 {
|
|
|
1213
1243
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
1214
1244
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1215
1245
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1246
|
+
* @param {float} [params.cost] *market orders only* the cost of the order in units of the base currency
|
|
1216
1247
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1217
1248
|
*/
|
|
1218
1249
|
await this.loadMarkets();
|
|
@@ -1220,8 +1251,18 @@ class whitebit extends whitebit$1 {
|
|
|
1220
1251
|
const request = {
|
|
1221
1252
|
'market': market['id'],
|
|
1222
1253
|
'side': side,
|
|
1223
|
-
'amount': this.amountToPrecision(symbol, amount),
|
|
1224
1254
|
};
|
|
1255
|
+
let cost = undefined;
|
|
1256
|
+
[cost, params] = this.handleParamString(params, 'cost');
|
|
1257
|
+
if (cost !== undefined) {
|
|
1258
|
+
if ((side !== 'buy') || (type !== 'market')) {
|
|
1259
|
+
throw new errors.InvalidOrder(this.id + ' createOrder() cost is only supported for market buy orders');
|
|
1260
|
+
}
|
|
1261
|
+
request['amount'] = this.costToPrecision(symbol, cost);
|
|
1262
|
+
}
|
|
1263
|
+
else {
|
|
1264
|
+
request['amount'] = this.amountToPrecision(symbol, amount);
|
|
1265
|
+
}
|
|
1225
1266
|
const clientOrderId = this.safeString2(params, 'clOrdId', 'clientOrderId');
|
|
1226
1267
|
if (clientOrderId === undefined) {
|
|
1227
1268
|
const brokerId = this.safeString(this.options, 'brokerId');
|
|
@@ -1283,7 +1324,12 @@ class whitebit extends whitebit$1 {
|
|
|
1283
1324
|
response = await this.v4PrivatePostOrderCollateralMarket(this.extend(request, params));
|
|
1284
1325
|
}
|
|
1285
1326
|
else {
|
|
1286
|
-
|
|
1327
|
+
if (cost !== undefined) {
|
|
1328
|
+
response = await this.v4PrivatePostOrderMarket(this.extend(request, params));
|
|
1329
|
+
}
|
|
1330
|
+
else {
|
|
1331
|
+
response = await this.v4PrivatePostOrderStockMarket(this.extend(request, params));
|
|
1332
|
+
}
|
|
1287
1333
|
}
|
|
1288
1334
|
}
|
|
1289
1335
|
}
|
|
@@ -1694,7 +1740,7 @@ class whitebit extends whitebit$1 {
|
|
|
1694
1740
|
const symbol = market['symbol'];
|
|
1695
1741
|
const side = this.safeString(order, 'side');
|
|
1696
1742
|
const filled = this.safeString(order, 'dealStock');
|
|
1697
|
-
|
|
1743
|
+
let remaining = this.safeString(order, 'left');
|
|
1698
1744
|
let clientOrderId = this.safeString(order, 'clientOrderId');
|
|
1699
1745
|
if (clientOrderId === '') {
|
|
1700
1746
|
clientOrderId = undefined;
|
|
@@ -1703,6 +1749,10 @@ class whitebit extends whitebit$1 {
|
|
|
1703
1749
|
const stopPrice = this.safeNumber(order, 'activation_price');
|
|
1704
1750
|
const orderId = this.safeString2(order, 'orderId', 'id');
|
|
1705
1751
|
const type = this.safeString(order, 'type');
|
|
1752
|
+
const orderType = this.parseOrderType(type);
|
|
1753
|
+
if (orderType === 'market') {
|
|
1754
|
+
remaining = undefined;
|
|
1755
|
+
}
|
|
1706
1756
|
let amount = this.safeString(order, 'amount');
|
|
1707
1757
|
const cost = this.safeString(order, 'dealMoney');
|
|
1708
1758
|
if ((side === 'buy') && ((type === 'market') || (type === 'stop market'))) {
|
|
@@ -1731,7 +1781,7 @@ class whitebit extends whitebit$1 {
|
|
|
1731
1781
|
'status': undefined,
|
|
1732
1782
|
'side': side,
|
|
1733
1783
|
'price': price,
|
|
1734
|
-
'type':
|
|
1784
|
+
'type': orderType,
|
|
1735
1785
|
'stopPrice': stopPrice,
|
|
1736
1786
|
'triggerPrice': stopPrice,
|
|
1737
1787
|
'amount': 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, Leverage, Leverages, Option, OptionChain, Conversion } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.3.
|
|
7
|
+
declare const version = "4.3.29";
|
|
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, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.3.
|
|
41
|
+
const version = '4.3.30';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -6113,6 +6113,9 @@ export default class Exchange {
|
|
|
6113
6113
|
}
|
|
6114
6114
|
parseMarginModes(response, symbols = undefined, symbolKey = undefined, marketType = undefined) {
|
|
6115
6115
|
const marginModeStructures = {};
|
|
6116
|
+
if (marketType === undefined) {
|
|
6117
|
+
marketType = 'swap'; // default to swap
|
|
6118
|
+
}
|
|
6116
6119
|
for (let i = 0; i < response.length; i++) {
|
|
6117
6120
|
const info = response[i];
|
|
6118
6121
|
const marketId = this.safeString(info, symbolKey);
|
|
@@ -6128,6 +6131,9 @@ export default class Exchange {
|
|
|
6128
6131
|
}
|
|
6129
6132
|
parseLeverages(response, symbols = undefined, symbolKey = undefined, marketType = undefined) {
|
|
6130
6133
|
const leverageStructures = {};
|
|
6134
|
+
if (marketType === undefined) {
|
|
6135
|
+
marketType = 'swap'; // default to swap
|
|
6136
|
+
}
|
|
6131
6137
|
for (let i = 0; i < response.length; i++) {
|
|
6132
6138
|
const info = response[i];
|
|
6133
6139
|
const marketId = this.safeString(info, symbolKey);
|
package/js/src/bingx.js
CHANGED
|
@@ -2544,7 +2544,7 @@ export default class bingx extends Exchange {
|
|
|
2544
2544
|
'stopLossPrice': stopLossPrice,
|
|
2545
2545
|
'takeProfitPrice': takeProfitPrice,
|
|
2546
2546
|
'average': this.safeString2(order, 'avgPrice', 'ap'),
|
|
2547
|
-
'cost':
|
|
2547
|
+
'cost': this.safeString(order, 'cummulativeQuoteQty'),
|
|
2548
2548
|
'amount': this.safeStringN(order, ['origQty', 'q', 'quantity']),
|
|
2549
2549
|
'filled': this.safeString2(order, 'executedQty', 'z'),
|
|
2550
2550
|
'remaining': undefined,
|
package/js/src/coinex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/coinex.js';
|
|
2
|
-
import type { Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, OHLCV, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, OrderRequest, TransferEntry, Leverage, Leverages, Num, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position,
|
|
2
|
+
import type { Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, OHLCV, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, OrderRequest, TransferEntry, Leverage, Leverages, Num, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position, IsolatedBorrowRate, Dict, TransferEntries } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class coinex
|
|
5
5
|
* @augments Exchange
|
|
@@ -128,7 +128,6 @@ export default class coinex extends Exchange {
|
|
|
128
128
|
fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
129
129
|
parseIsolatedBorrowRate(info: any, market?: Market): IsolatedBorrowRate;
|
|
130
130
|
fetchIsolatedBorrowRate(symbol: string, params?: {}): Promise<IsolatedBorrowRate>;
|
|
131
|
-
fetchIsolatedBorrowRates(params?: {}): Promise<IsolatedBorrowRates>;
|
|
132
131
|
fetchBorrowInterest(code?: Str, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
133
132
|
parseBorrowInterest(info: any, market?: Market): {
|
|
134
133
|
account: any;
|
|
@@ -148,10 +147,10 @@ export default class coinex extends Exchange {
|
|
|
148
147
|
parseMarginLoan(info: any, currency?: Currency): {
|
|
149
148
|
id: number;
|
|
150
149
|
currency: string;
|
|
151
|
-
amount:
|
|
152
|
-
symbol:
|
|
153
|
-
timestamp:
|
|
154
|
-
datetime:
|
|
150
|
+
amount: string;
|
|
151
|
+
symbol: string;
|
|
152
|
+
timestamp: number;
|
|
153
|
+
datetime: string;
|
|
155
154
|
info: any;
|
|
156
155
|
};
|
|
157
156
|
fetchDepositWithdrawFees(codes?: Strings, params?: {}): Promise<{}>;
|