ccxt 4.4.6 → 4.4.7
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 +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +21 -2
- package/dist/cjs/src/bingx.js +3 -0
- package/dist/cjs/src/bitget.js +10 -6
- package/dist/cjs/src/bitmart.js +124 -1
- package/dist/cjs/src/bybit.js +14 -10
- package/dist/cjs/src/gate.js +3 -0
- package/dist/cjs/src/kucoin.js +2 -2
- package/dist/cjs/src/mexc.js +97 -13
- package/dist/cjs/src/pro/bitget.js +66 -0
- package/dist/cjs/src/pro/okx.js +11 -5
- package/examples/js/cli.js +2 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +4 -0
- package/js/src/base/Exchange.js +21 -2
- package/js/src/bingx.js +3 -0
- package/js/src/bitget.js +10 -6
- package/js/src/bitmart.d.ts +1 -0
- package/js/src/bitmart.js +124 -1
- package/js/src/bybit.js +14 -10
- package/js/src/gate.js +3 -0
- package/js/src/kucoin.js +2 -2
- package/js/src/mexc.d.ts +2 -0
- package/js/src/mexc.js +97 -13
- package/js/src/pro/bitget.d.ts +3 -0
- package/js/src/pro/bitget.js +66 -0
- package/js/src/pro/okx.d.ts +1 -0
- package/js/src/pro/okx.js +11 -5
- package/package.json +1 -1
package/dist/cjs/src/pro/okx.js
CHANGED
|
@@ -1952,6 +1952,12 @@ class okx extends okx$1 {
|
|
|
1952
1952
|
client.resolve(this.orders, symbolMessageHash);
|
|
1953
1953
|
}
|
|
1954
1954
|
}
|
|
1955
|
+
requestId() {
|
|
1956
|
+
const ts = this.milliseconds().toString();
|
|
1957
|
+
const randomNumber = this.randNumber(4);
|
|
1958
|
+
const randomPart = randomNumber.toString();
|
|
1959
|
+
return ts + randomPart;
|
|
1960
|
+
}
|
|
1955
1961
|
async createOrderWs(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1956
1962
|
/**
|
|
1957
1963
|
* @method
|
|
@@ -1970,7 +1976,7 @@ class okx extends okx$1 {
|
|
|
1970
1976
|
await this.loadMarkets();
|
|
1971
1977
|
await this.authenticate();
|
|
1972
1978
|
const url = this.getUrl('private', 'private');
|
|
1973
|
-
const messageHash = this.
|
|
1979
|
+
const messageHash = this.requestId();
|
|
1974
1980
|
let op = undefined;
|
|
1975
1981
|
[op, params] = this.handleOptionAndParams(params, 'createOrderWs', 'op', 'batch-orders');
|
|
1976
1982
|
const args = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
@@ -2040,7 +2046,7 @@ class okx extends okx$1 {
|
|
|
2040
2046
|
await this.loadMarkets();
|
|
2041
2047
|
await this.authenticate();
|
|
2042
2048
|
const url = this.getUrl('private', 'private');
|
|
2043
|
-
const messageHash = this.
|
|
2049
|
+
const messageHash = this.requestId();
|
|
2044
2050
|
let op = undefined;
|
|
2045
2051
|
[op, params] = this.handleOptionAndParams(params, 'editOrderWs', 'op', 'amend-order');
|
|
2046
2052
|
const args = this.editOrderRequest(id, symbol, type, side, amount, price, params);
|
|
@@ -2069,7 +2075,7 @@ class okx extends okx$1 {
|
|
|
2069
2075
|
await this.loadMarkets();
|
|
2070
2076
|
await this.authenticate();
|
|
2071
2077
|
const url = this.getUrl('private', 'private');
|
|
2072
|
-
const messageHash = this.
|
|
2078
|
+
const messageHash = this.requestId();
|
|
2073
2079
|
const clientOrderId = this.safeString2(params, 'clOrdId', 'clientOrderId');
|
|
2074
2080
|
params = this.omit(params, ['clientOrderId', 'clOrdId']);
|
|
2075
2081
|
const arg = {
|
|
@@ -2109,7 +2115,7 @@ class okx extends okx$1 {
|
|
|
2109
2115
|
await this.loadMarkets();
|
|
2110
2116
|
await this.authenticate();
|
|
2111
2117
|
const url = this.getUrl('private', 'private');
|
|
2112
|
-
const messageHash = this.
|
|
2118
|
+
const messageHash = this.requestId();
|
|
2113
2119
|
const args = [];
|
|
2114
2120
|
for (let i = 0; i < idsLength; i++) {
|
|
2115
2121
|
const arg = {
|
|
@@ -2145,7 +2151,7 @@ class okx extends okx$1 {
|
|
|
2145
2151
|
throw new errors.BadRequest(this.id + 'cancelAllOrdersWs is only applicable to Option in Portfolio Margin mode, and MMP privilege is required.');
|
|
2146
2152
|
}
|
|
2147
2153
|
const url = this.getUrl('private', 'private');
|
|
2148
|
-
const messageHash = this.
|
|
2154
|
+
const messageHash = this.requestId();
|
|
2149
2155
|
const request = {
|
|
2150
2156
|
'id': messageHash,
|
|
2151
2157
|
'op': 'mass-cancel',
|
package/examples/js/cli.js
CHANGED
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 { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.4.
|
|
7
|
+
declare const version = "4.4.6";
|
|
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, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.4.
|
|
41
|
+
const version = '4.4.7';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -379,6 +379,7 @@ export default class Exchange {
|
|
|
379
379
|
extendExchangeOptions(newOptions: Dict): void;
|
|
380
380
|
createSafeDictionary(): {};
|
|
381
381
|
randomBytes(length: number): string;
|
|
382
|
+
randNumber(size: number): number;
|
|
382
383
|
describe(): {
|
|
383
384
|
id: any;
|
|
384
385
|
name: any;
|
|
@@ -809,6 +810,9 @@ export default class Exchange {
|
|
|
809
810
|
CRO: {
|
|
810
811
|
CRC20: string;
|
|
811
812
|
};
|
|
813
|
+
BRC20: {
|
|
814
|
+
BRC20: string;
|
|
815
|
+
};
|
|
812
816
|
};
|
|
813
817
|
};
|
|
814
818
|
safeLedgerEntry(entry: object, currency?: Currency): {
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -1220,6 +1220,13 @@ export default class Exchange {
|
|
|
1220
1220
|
rng.nextBytes(x);
|
|
1221
1221
|
return Buffer.from(x).toString('hex');
|
|
1222
1222
|
}
|
|
1223
|
+
randNumber(size) {
|
|
1224
|
+
let number = '';
|
|
1225
|
+
for (let i = 0; i < size; i++) {
|
|
1226
|
+
number += Math.floor(Math.random() * 10);
|
|
1227
|
+
}
|
|
1228
|
+
return parseInt(number, 10);
|
|
1229
|
+
}
|
|
1223
1230
|
/* eslint-enable */
|
|
1224
1231
|
// ------------------------------------------------------------------------
|
|
1225
1232
|
// ########################################################################
|
|
@@ -2248,6 +2255,7 @@ export default class Exchange {
|
|
|
2248
2255
|
'ETH': { 'ERC20': 'ETH' },
|
|
2249
2256
|
'TRX': { 'TRC20': 'TRX' },
|
|
2250
2257
|
'CRO': { 'CRC20': 'CRONOS' },
|
|
2258
|
+
'BRC20': { 'BRC20': 'BTC' },
|
|
2251
2259
|
},
|
|
2252
2260
|
};
|
|
2253
2261
|
}
|
|
@@ -6105,8 +6113,19 @@ export default class Exchange {
|
|
|
6105
6113
|
break;
|
|
6106
6114
|
}
|
|
6107
6115
|
result = this.arrayConcat(result, response);
|
|
6108
|
-
const last = this.
|
|
6109
|
-
cursorValue = this.safeValue(last['info'], cursorReceived);
|
|
6116
|
+
const last = this.safeDict(response, responseLength - 1);
|
|
6117
|
+
// cursorValue = this.safeValue (last['info'], cursorReceived);
|
|
6118
|
+
cursorValue = undefined; // search for the cursor
|
|
6119
|
+
for (let j = 0; j < responseLength; j++) {
|
|
6120
|
+
const index = responseLength - j - 1;
|
|
6121
|
+
const entry = this.safeDict(response, index);
|
|
6122
|
+
const info = this.safeDict(entry, 'info');
|
|
6123
|
+
const cursor = this.safeValue(info, cursorReceived);
|
|
6124
|
+
if (cursor !== undefined) {
|
|
6125
|
+
cursorValue = cursor;
|
|
6126
|
+
break;
|
|
6127
|
+
}
|
|
6128
|
+
}
|
|
6110
6129
|
if (cursorValue === undefined) {
|
|
6111
6130
|
break;
|
|
6112
6131
|
}
|
package/js/src/bingx.js
CHANGED
package/js/src/bitget.js
CHANGED
|
@@ -1418,12 +1418,13 @@ export default class bitget extends Exchange {
|
|
|
1418
1418
|
'networks': {
|
|
1419
1419
|
'TRX': 'TRC20',
|
|
1420
1420
|
'ETH': 'ERC20',
|
|
1421
|
-
'
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
'
|
|
1425
|
-
'
|
|
1421
|
+
'BEP20': 'BSC',
|
|
1422
|
+
'ZKSYNC': 'zkSyncEra',
|
|
1423
|
+
'STARKNET': 'Starknet',
|
|
1424
|
+
'OPTIMISM': 'Optimism',
|
|
1425
|
+
'ARBITRUM': 'Arbitrum',
|
|
1426
1426
|
},
|
|
1427
|
+
'networksById': {},
|
|
1427
1428
|
'fetchPositions': {
|
|
1428
1429
|
'method': 'privateMixGetV2MixPositionAllPosition', // or privateMixGetV2MixPositionHistoryPosition
|
|
1429
1430
|
},
|
|
@@ -1865,7 +1866,10 @@ export default class bitget extends Exchange {
|
|
|
1865
1866
|
for (let j = 0; j < chains.length; j++) {
|
|
1866
1867
|
const chain = chains[j];
|
|
1867
1868
|
const networkId = this.safeString(chain, 'chain');
|
|
1868
|
-
|
|
1869
|
+
let network = this.networkIdToCode(networkId, code);
|
|
1870
|
+
if (network !== undefined) {
|
|
1871
|
+
network = network.toUpperCase();
|
|
1872
|
+
}
|
|
1869
1873
|
const withdrawEnabled = this.safeString(chain, 'withdrawable');
|
|
1870
1874
|
const canWithdraw = withdrawEnabled === 'true';
|
|
1871
1875
|
withdraw = (canWithdraw) ? canWithdraw : withdraw;
|
package/js/src/bitmart.d.ts
CHANGED
|
@@ -167,6 +167,7 @@ export default class bitmart extends Exchange {
|
|
|
167
167
|
parsePosition(position: Dict, market?: Market): import("./base/types.js").Position;
|
|
168
168
|
fetchMyLiquidations(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Liquidation[]>;
|
|
169
169
|
parseLiquidation(liquidation: any, market?: Market): import("./base/types.js").Liquidation;
|
|
170
|
+
editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
|
|
170
171
|
nonce(): number;
|
|
171
172
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
172
173
|
url: string;
|
package/js/src/bitmart.js
CHANGED
|
@@ -2297,7 +2297,7 @@ export default class bitmart extends Exchange {
|
|
|
2297
2297
|
}
|
|
2298
2298
|
parseOrder(order, market = undefined) {
|
|
2299
2299
|
//
|
|
2300
|
-
// createOrder
|
|
2300
|
+
// createOrder, editOrder
|
|
2301
2301
|
//
|
|
2302
2302
|
// {
|
|
2303
2303
|
// "order_id": 2707217580
|
|
@@ -4780,6 +4780,129 @@ export default class bitmart extends Exchange {
|
|
|
4780
4780
|
'datetime': this.iso8601(timestamp),
|
|
4781
4781
|
});
|
|
4782
4782
|
}
|
|
4783
|
+
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
4784
|
+
/**
|
|
4785
|
+
* @method
|
|
4786
|
+
* @name bitmart#editOrder
|
|
4787
|
+
* @description edits an open order
|
|
4788
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#modify-plan-order-signed
|
|
4789
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#modify-tp-sl-order-signed
|
|
4790
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#modify-preset-plan-order-signed
|
|
4791
|
+
* @param {string} id order id
|
|
4792
|
+
* @param {string} symbol unified symbol of the market to edit an order in
|
|
4793
|
+
* @param {string} type 'market' or 'limit'
|
|
4794
|
+
* @param {string} side 'buy' or 'sell'
|
|
4795
|
+
* @param {float} [amount] how much you want to trade in units of the base currency
|
|
4796
|
+
* @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
|
|
4797
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4798
|
+
* @param {string} [params.triggerPrice] *swap only* the price to trigger a stop order
|
|
4799
|
+
* @param {string} [params.stopLossPrice] *swap only* the price to trigger a stop-loss order
|
|
4800
|
+
* @param {string} [params.takeProfitPrice] *swap only* the price to trigger a take-profit order
|
|
4801
|
+
* @param {string} [params.stopLoss.triggerPrice] *swap only* the price to trigger a preset stop-loss order
|
|
4802
|
+
* @param {string} [params.takeProfit.triggerPrice] *swap only* the price to trigger a preset take-profit order
|
|
4803
|
+
* @param {string} [params.clientOrderId] client order id of the order
|
|
4804
|
+
* @param {int} [params.price_type] *swap only* 1: last price, 2: fair price, default is 1
|
|
4805
|
+
* @param {int} [params.plan_category] *swap tp/sl only* 1: tp/sl, 2: position tp/sl, default is 1
|
|
4806
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4807
|
+
*/
|
|
4808
|
+
await this.loadMarkets();
|
|
4809
|
+
const market = this.market(symbol);
|
|
4810
|
+
if (!market['swap']) {
|
|
4811
|
+
throw new NotSupported(this.id + ' editOrder() does not support ' + market['type'] + ' markets, only swap markets are supported');
|
|
4812
|
+
}
|
|
4813
|
+
const stopLossPrice = this.safeString(params, 'stopLossPrice');
|
|
4814
|
+
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
4815
|
+
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'trigger_price']);
|
|
4816
|
+
const stopLoss = this.safeDict(params, 'stopLoss', {});
|
|
4817
|
+
const takeProfit = this.safeDict(params, 'takeProfit', {});
|
|
4818
|
+
const presetStopLoss = this.safeString(stopLoss, 'triggerPrice');
|
|
4819
|
+
const presetTakeProfit = this.safeString(takeProfit, 'triggerPrice');
|
|
4820
|
+
const isTriggerOrder = triggerPrice !== undefined;
|
|
4821
|
+
const isStopLoss = stopLossPrice !== undefined;
|
|
4822
|
+
const isTakeProfit = takeProfitPrice !== undefined;
|
|
4823
|
+
const isPresetStopLoss = presetStopLoss !== undefined;
|
|
4824
|
+
const isPresetTakeProfit = presetTakeProfit !== undefined;
|
|
4825
|
+
const request = {
|
|
4826
|
+
'symbol': market['id'],
|
|
4827
|
+
};
|
|
4828
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
4829
|
+
if (clientOrderId !== undefined) {
|
|
4830
|
+
params = this.omit(params, 'clientOrderId');
|
|
4831
|
+
request['client_order_id'] = clientOrderId;
|
|
4832
|
+
}
|
|
4833
|
+
if (id !== undefined) {
|
|
4834
|
+
request['order_id'] = id;
|
|
4835
|
+
}
|
|
4836
|
+
params = this.omit(params, ['triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'stopLoss', 'takeProfit']);
|
|
4837
|
+
let response = undefined;
|
|
4838
|
+
if (isTriggerOrder || isStopLoss || isTakeProfit) {
|
|
4839
|
+
request['price_type'] = this.safeInteger(params, 'price_type', 1);
|
|
4840
|
+
if (price !== undefined) {
|
|
4841
|
+
request['executive_price'] = this.priceToPrecision(symbol, price);
|
|
4842
|
+
}
|
|
4843
|
+
}
|
|
4844
|
+
if (isTriggerOrder) {
|
|
4845
|
+
request['type'] = type;
|
|
4846
|
+
request['trigger_price'] = this.priceToPrecision(symbol, triggerPrice);
|
|
4847
|
+
response = await this.privatePostContractPrivateModifyPlanOrder(this.extend(request, params));
|
|
4848
|
+
//
|
|
4849
|
+
// {
|
|
4850
|
+
// "code": 1000,
|
|
4851
|
+
// "message": "Ok",
|
|
4852
|
+
// "data": {
|
|
4853
|
+
// "order_id": "3000023150003503"
|
|
4854
|
+
// },
|
|
4855
|
+
// "trace": "324523453245.108.1734567125596324575"
|
|
4856
|
+
// }
|
|
4857
|
+
//
|
|
4858
|
+
}
|
|
4859
|
+
else if (isStopLoss || isTakeProfit) {
|
|
4860
|
+
request['category'] = type;
|
|
4861
|
+
if (isStopLoss) {
|
|
4862
|
+
request['trigger_price'] = this.priceToPrecision(symbol, stopLossPrice);
|
|
4863
|
+
}
|
|
4864
|
+
else {
|
|
4865
|
+
request['trigger_price'] = this.priceToPrecision(symbol, takeProfitPrice);
|
|
4866
|
+
}
|
|
4867
|
+
response = await this.privatePostContractPrivateModifyTpSlOrder(this.extend(request, params));
|
|
4868
|
+
//
|
|
4869
|
+
// {
|
|
4870
|
+
// "code": 1000,
|
|
4871
|
+
// "message": "Ok",
|
|
4872
|
+
// "data": {
|
|
4873
|
+
// "order_id": "3000023150003480"
|
|
4874
|
+
// },
|
|
4875
|
+
// "trace": "23452345.104.1724536582682345459"
|
|
4876
|
+
// }
|
|
4877
|
+
//
|
|
4878
|
+
}
|
|
4879
|
+
else if (isPresetStopLoss || isPresetTakeProfit) {
|
|
4880
|
+
if (isPresetStopLoss) {
|
|
4881
|
+
request['preset_stop_loss_price_type'] = this.safeInteger(params, 'price_type', 1);
|
|
4882
|
+
request['preset_stop_loss_price'] = this.priceToPrecision(symbol, presetStopLoss);
|
|
4883
|
+
}
|
|
4884
|
+
else {
|
|
4885
|
+
request['preset_take_profit_price_type'] = this.safeInteger(params, 'price_type', 1);
|
|
4886
|
+
request['preset_take_profit_price'] = this.priceToPrecision(symbol, presetTakeProfit);
|
|
4887
|
+
}
|
|
4888
|
+
response = await this.privatePostContractPrivateModifyPresetPlanOrder(this.extend(request, params));
|
|
4889
|
+
//
|
|
4890
|
+
// {
|
|
4891
|
+
// "code": 1000,
|
|
4892
|
+
// "message": "Ok",
|
|
4893
|
+
// "data": {
|
|
4894
|
+
// "order_id": "3000023150003496"
|
|
4895
|
+
// },
|
|
4896
|
+
// "trace": "a5c3234534534a836bc476a203.123452.172716624359200197"
|
|
4897
|
+
// }
|
|
4898
|
+
//
|
|
4899
|
+
}
|
|
4900
|
+
else {
|
|
4901
|
+
throw new NotSupported(this.id + ' editOrder() only supports trigger, stop loss and take profit orders');
|
|
4902
|
+
}
|
|
4903
|
+
const data = this.safeDict(response, 'data', {});
|
|
4904
|
+
return this.parseOrder(data, market);
|
|
4905
|
+
}
|
|
4783
4906
|
nonce() {
|
|
4784
4907
|
return this.milliseconds();
|
|
4785
4908
|
}
|
package/js/src/bybit.js
CHANGED
|
@@ -6226,13 +6226,17 @@ export default class bybit extends Exchange {
|
|
|
6226
6226
|
const currencyId = this.safeString2(item, 'coin', 'currency');
|
|
6227
6227
|
const code = this.safeCurrencyCode(currencyId, currency);
|
|
6228
6228
|
currency = this.safeCurrency(currencyId, currency);
|
|
6229
|
-
const
|
|
6230
|
-
const
|
|
6231
|
-
const direction = Precise.stringLt(
|
|
6229
|
+
const amountString = this.safeString2(item, 'amount', 'change');
|
|
6230
|
+
const afterString = this.safeString2(item, 'wallet_balance', 'cashBalance');
|
|
6231
|
+
const direction = Precise.stringLt(amountString, '0') ? 'out' : 'in';
|
|
6232
6232
|
let before = undefined;
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6233
|
+
let after = undefined;
|
|
6234
|
+
let amount = undefined;
|
|
6235
|
+
if (afterString !== undefined && amountString !== undefined) {
|
|
6236
|
+
const difference = (direction === 'out') ? amountString : Precise.stringNeg(amountString);
|
|
6237
|
+
before = this.parseToNumeric(Precise.stringAdd(afterString, difference));
|
|
6238
|
+
after = this.parseToNumeric(afterString);
|
|
6239
|
+
amount = this.parseToNumeric(Precise.stringAbs(amountString));
|
|
6236
6240
|
}
|
|
6237
6241
|
let timestamp = this.parse8601(this.safeString(item, 'exec_time'));
|
|
6238
6242
|
if (timestamp === undefined) {
|
|
@@ -6247,15 +6251,15 @@ export default class bybit extends Exchange {
|
|
|
6247
6251
|
'referenceAccount': undefined,
|
|
6248
6252
|
'type': this.parseLedgerEntryType(this.safeString(item, 'type')),
|
|
6249
6253
|
'currency': code,
|
|
6250
|
-
'amount':
|
|
6254
|
+
'amount': amount,
|
|
6251
6255
|
'timestamp': timestamp,
|
|
6252
6256
|
'datetime': this.iso8601(timestamp),
|
|
6253
|
-
'before':
|
|
6254
|
-
'after':
|
|
6257
|
+
'before': before,
|
|
6258
|
+
'after': after,
|
|
6255
6259
|
'status': 'ok',
|
|
6256
6260
|
'fee': {
|
|
6257
6261
|
'currency': code,
|
|
6258
|
-
'cost': this.
|
|
6262
|
+
'cost': this.safeNumber(item, 'fee'),
|
|
6259
6263
|
},
|
|
6260
6264
|
}, currency);
|
|
6261
6265
|
}
|
package/js/src/gate.js
CHANGED
package/js/src/kucoin.js
CHANGED
|
@@ -761,7 +761,7 @@ export default class kucoin extends Exchange {
|
|
|
761
761
|
'hf': 'trade_hf',
|
|
762
762
|
},
|
|
763
763
|
'networks': {
|
|
764
|
-
'
|
|
764
|
+
'BRC20': 'btc',
|
|
765
765
|
'BTCNATIVESEGWIT': 'bech32',
|
|
766
766
|
'ERC20': 'eth',
|
|
767
767
|
'TRC20': 'trx',
|
|
@@ -1343,7 +1343,7 @@ export default class kucoin extends Exchange {
|
|
|
1343
1343
|
for (let j = 0; j < chainsLength; j++) {
|
|
1344
1344
|
const chain = chains[j];
|
|
1345
1345
|
const chainId = this.safeString(chain, 'chainId');
|
|
1346
|
-
const networkCode = this.networkIdToCode(chainId);
|
|
1346
|
+
const networkCode = this.networkIdToCode(chainId, code);
|
|
1347
1347
|
const chainWithdrawEnabled = this.safeBool(chain, 'isWithdrawEnabled', false);
|
|
1348
1348
|
if (isWithdrawEnabled === undefined) {
|
|
1349
1349
|
isWithdrawEnabled = chainWithdrawEnabled;
|
package/js/src/mexc.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export default class mexc extends Exchange {
|
|
|
30
30
|
parseTicker(ticker: Dict, market?: Market): Ticker;
|
|
31
31
|
fetchBidsAsks(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
32
32
|
createMarketBuyOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
|
|
33
|
+
createMarketSellOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
|
|
33
34
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
|
34
35
|
createSpotOrderRequest(market: any, type: any, side: any, amount: any, price?: any, marginMode?: any, params?: {}): any;
|
|
35
36
|
createSpotOrder(market: any, type: any, side: any, amount: any, price?: any, marginMode?: any, params?: {}): Promise<Order>;
|
|
@@ -156,6 +157,7 @@ export default class mexc extends Exchange {
|
|
|
156
157
|
parseLeverage(leverage: Dict, market?: Market): Leverage;
|
|
157
158
|
handleMarginModeAndParams(methodName: any, params?: {}, defaultValue?: any): any[];
|
|
158
159
|
fetchPositionsHistory(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
|
|
160
|
+
setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<Leverage>;
|
|
159
161
|
nonce(): number;
|
|
160
162
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
161
163
|
url: any;
|