ccxt 4.4.2 → 4.4.4
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.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +2 -2
- package/dist/cjs/src/base/functions/misc.js +11 -0
- package/dist/cjs/src/base/functions.js +1 -0
- package/dist/cjs/src/base/ws/WsClient.js +2 -1
- package/dist/cjs/src/binance.js +49 -22
- package/dist/cjs/src/bingx.js +1 -0
- package/dist/cjs/src/bitfinex2.js +7 -6
- package/dist/cjs/src/bitget.js +10 -6
- package/dist/cjs/src/bitmart.js +3 -1
- package/dist/cjs/src/bitmex.js +11 -10
- package/dist/cjs/src/bitso.js +5 -4
- package/dist/cjs/src/bitstamp.js +33 -45
- package/dist/cjs/src/blofin.js +21 -23
- package/dist/cjs/src/bybit.js +22 -20
- package/dist/cjs/src/coinbase.js +28 -7
- package/dist/cjs/src/coinbaseexchange.js +11 -11
- package/dist/cjs/src/coinlist.js +6 -5
- package/dist/cjs/src/coinmetro.js +3 -3
- package/dist/cjs/src/cryptocom.js +9 -6
- package/dist/cjs/src/currencycom.js +6 -6
- package/dist/cjs/src/delta.js +5 -5
- package/dist/cjs/src/digifinex.js +8 -6
- package/dist/cjs/src/gate.js +6 -5
- package/dist/cjs/src/hashkey.js +9 -7
- package/dist/cjs/src/htx.js +13 -16
- package/dist/cjs/src/hyperliquid.js +67 -114
- package/dist/cjs/src/kraken.js +8 -6
- package/dist/cjs/src/kucoin.js +9 -8
- package/dist/cjs/src/luno.js +10 -9
- package/dist/cjs/src/mexc.js +54 -2
- package/dist/cjs/src/ndax.js +6 -5
- package/dist/cjs/src/okcoin.js +18 -27
- package/dist/cjs/src/okx.js +18 -26
- package/dist/cjs/src/p2b.js +2 -2
- package/dist/cjs/src/pro/bybit.js +56 -0
- package/dist/cjs/src/pro/cryptocom.js +191 -21
- package/dist/cjs/src/pro/mexc.js +165 -3
- package/dist/cjs/src/pro/okx.js +6 -3
- package/dist/cjs/src/pro/oxfun.js +75 -0
- package/dist/cjs/src/pro/phemex.js +45 -1
- package/dist/cjs/src/pro/woofipro.js +67 -0
- package/dist/cjs/src/woo.js +7 -6
- package/dist/cjs/src/woofipro.js +8 -6
- package/dist/cjs/src/xt.js +10 -4
- package/dist/cjs/src/zonda.js +6 -5
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitmart.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +2 -2
- package/js/src/base/Exchange.js +2 -2
- package/js/src/base/functions/misc.d.ts +2 -1
- package/js/src/base/functions/misc.js +11 -1
- package/js/src/base/types.d.ts +1 -1
- package/js/src/base/ws/WsClient.js +2 -2
- package/js/src/binance.d.ts +4 -20
- package/js/src/binance.js +49 -22
- package/js/src/bingx.js +1 -0
- package/js/src/bitfinex2.d.ts +3 -19
- package/js/src/bitfinex2.js +7 -6
- package/js/src/bitget.d.ts +3 -19
- package/js/src/bitget.js +10 -6
- package/js/src/bitmart.js +3 -1
- package/js/src/bitmex.d.ts +3 -22
- package/js/src/bitmex.js +11 -10
- package/js/src/bitso.d.ts +3 -19
- package/js/src/bitso.js +5 -4
- package/js/src/bitstamp.d.ts +3 -35
- package/js/src/bitstamp.js +33 -45
- package/js/src/blofin.d.ts +3 -15
- package/js/src/blofin.js +21 -23
- package/js/src/bybit.d.ts +3 -19
- package/js/src/bybit.js +23 -21
- package/js/src/coinbase.d.ts +3 -19
- package/js/src/coinbase.js +28 -7
- package/js/src/coinbaseexchange.d.ts +3 -19
- package/js/src/coinbaseexchange.js +11 -11
- package/js/src/coinlist.d.ts +3 -19
- package/js/src/coinlist.js +6 -5
- package/js/src/coinmetro.d.ts +3 -19
- package/js/src/coinmetro.js +3 -3
- package/js/src/cryptocom.d.ts +3 -22
- package/js/src/cryptocom.js +9 -6
- package/js/src/currencycom.d.ts +3 -3
- package/js/src/currencycom.js +6 -6
- package/js/src/delta.d.ts +3 -19
- package/js/src/delta.js +5 -5
- package/js/src/digifinex.d.ts +3 -19
- package/js/src/digifinex.js +8 -6
- package/js/src/gate.d.ts +3 -19
- package/js/src/gate.js +6 -5
- package/js/src/hashkey.d.ts +3 -20
- package/js/src/hashkey.js +9 -7
- package/js/src/htx.d.ts +3 -19
- package/js/src/htx.js +13 -16
- package/js/src/hyperliquid.d.ts +3 -19
- package/js/src/hyperliquid.js +68 -115
- package/js/src/kraken.d.ts +5 -24
- package/js/src/kraken.js +8 -6
- package/js/src/kucoin.d.ts +3 -19
- package/js/src/kucoin.js +9 -8
- package/js/src/luno.d.ts +4 -20
- package/js/src/luno.js +10 -9
- package/js/src/mexc.js +54 -2
- package/js/src/ndax.d.ts +3 -19
- package/js/src/ndax.js +6 -5
- package/js/src/okcoin.d.ts +3 -19
- package/js/src/okcoin.js +18 -27
- package/js/src/okx.d.ts +3 -19
- package/js/src/okx.js +18 -26
- package/js/src/p2b.js +2 -2
- package/js/src/pro/bybit.d.ts +2 -0
- package/js/src/pro/bybit.js +56 -0
- package/js/src/pro/cryptocom.d.ts +7 -1
- package/js/src/pro/cryptocom.js +191 -21
- package/js/src/pro/mexc.d.ts +6 -1
- package/js/src/pro/mexc.js +166 -4
- package/js/src/pro/okx.js +6 -3
- package/js/src/pro/oxfun.d.ts +3 -0
- package/js/src/pro/oxfun.js +75 -0
- package/js/src/pro/phemex.d.ts +2 -1
- package/js/src/pro/phemex.js +45 -1
- package/js/src/pro/woofipro.d.ts +3 -0
- package/js/src/pro/woofipro.js +67 -0
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
- package/js/src/woo.d.ts +3 -19
- package/js/src/woo.js +7 -6
- package/js/src/woofipro.d.ts +3 -19
- package/js/src/woofipro.js +8 -6
- package/js/src/xt.d.ts +3 -22
- package/js/src/xt.js +10 -4
- package/js/src/zonda.d.ts +3 -19
- package/js/src/zonda.js +6 -5
- package/package.json +1 -1
package/js/src/mexc.js
CHANGED
|
@@ -1017,8 +1017,9 @@ export default class mexc extends Exchange {
|
|
|
1017
1017
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1018
1018
|
* @returns {object[]} an array of objects representing market data
|
|
1019
1019
|
*/
|
|
1020
|
-
const
|
|
1021
|
-
const
|
|
1020
|
+
const spotMarketPromise = this.fetchSpotMarkets(params);
|
|
1021
|
+
const swapMarketPromise = this.fetchSwapMarkets(params);
|
|
1022
|
+
const [spotMarket, swapMarket] = await Promise.all([spotMarketPromise, swapMarketPromise]);
|
|
1022
1023
|
return this.arrayConcat(spotMarket, swapMarket);
|
|
1023
1024
|
}
|
|
1024
1025
|
async fetchSpotMarkets(params = {}) {
|
|
@@ -1157,7 +1158,10 @@ export default class mexc extends Exchange {
|
|
|
1157
1158
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1158
1159
|
* @returns {object[]} an array of objects representing market data
|
|
1159
1160
|
*/
|
|
1161
|
+
const currentRl = this.rateLimit;
|
|
1162
|
+
this.setProperty(this, 'rateLimit', 10); // see comment: https://github.com/ccxt/ccxt/pull/23698
|
|
1160
1163
|
const response = await this.contractPublicGetDetail(params);
|
|
1164
|
+
this.setProperty(this, 'rateLimit', currentRl);
|
|
1161
1165
|
//
|
|
1162
1166
|
// {
|
|
1163
1167
|
// "success":true,
|
|
@@ -3065,6 +3069,9 @@ export default class mexc extends Exchange {
|
|
|
3065
3069
|
* @method
|
|
3066
3070
|
* @name mexc#cancelAllOrders
|
|
3067
3071
|
* @description cancel all open orders
|
|
3072
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#cancel-all-open-orders-on-a-symbol
|
|
3073
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-all-orders-under-a-contract-under-maintenance
|
|
3074
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-all-trigger-orders-under-maintenance
|
|
3068
3075
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
3069
3076
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3070
3077
|
* @param {string} [params.marginMode] only 'isolated' is supported for spot-margin trading
|
|
@@ -3468,6 +3475,8 @@ export default class mexc extends Exchange {
|
|
|
3468
3475
|
* @method
|
|
3469
3476
|
* @name mexc#fetchAccounts
|
|
3470
3477
|
* @description fetch all the accounts associated with a profile
|
|
3478
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#account-information
|
|
3479
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-all-informations-of-user-39-s-asset
|
|
3471
3480
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3472
3481
|
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
3473
3482
|
*/
|
|
@@ -3495,6 +3504,8 @@ export default class mexc extends Exchange {
|
|
|
3495
3504
|
* @method
|
|
3496
3505
|
* @name mexc#fetchTradingFees
|
|
3497
3506
|
* @description fetch the trading fees for multiple markets
|
|
3507
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#account-information
|
|
3508
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-all-informations-of-user-39-s-asset
|
|
3498
3509
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3499
3510
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
3500
3511
|
*/
|
|
@@ -3780,6 +3791,8 @@ export default class mexc extends Exchange {
|
|
|
3780
3791
|
* @method
|
|
3781
3792
|
* @name mexc#fetchMyTrades
|
|
3782
3793
|
* @description fetch all trades made by the user
|
|
3794
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#account-trade-list
|
|
3795
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-all-transaction-details-of-the-user-s-order
|
|
3783
3796
|
* @param {string} symbol unified market symbol
|
|
3784
3797
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
3785
3798
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -3870,6 +3883,8 @@ export default class mexc extends Exchange {
|
|
|
3870
3883
|
* @method
|
|
3871
3884
|
* @name mexc#fetchOrderTrades
|
|
3872
3885
|
* @description fetch all the trades made from a single order
|
|
3886
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#account-trade-list
|
|
3887
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#query-the-order-based-on-the-order-number
|
|
3873
3888
|
* @param {string} id order id
|
|
3874
3889
|
* @param {string} symbol unified market symbol
|
|
3875
3890
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
@@ -3968,6 +3983,7 @@ export default class mexc extends Exchange {
|
|
|
3968
3983
|
* @method
|
|
3969
3984
|
* @name mexc#reduceMargin
|
|
3970
3985
|
* @description remove margin from a position
|
|
3986
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#increase-or-decrease-margin
|
|
3971
3987
|
* @param {string} symbol unified market symbol
|
|
3972
3988
|
* @param {float} amount the amount of margin to remove
|
|
3973
3989
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -3980,6 +3996,7 @@ export default class mexc extends Exchange {
|
|
|
3980
3996
|
* @method
|
|
3981
3997
|
* @name mexc#addMargin
|
|
3982
3998
|
* @description add margin
|
|
3999
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#increase-or-decrease-margin
|
|
3983
4000
|
* @param {string} symbol unified market symbol
|
|
3984
4001
|
* @param {float} amount amount of margin to add
|
|
3985
4002
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -3992,6 +4009,7 @@ export default class mexc extends Exchange {
|
|
|
3992
4009
|
* @method
|
|
3993
4010
|
* @name mexc#setLeverage
|
|
3994
4011
|
* @description set the level of leverage for a market
|
|
4012
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#switch-leverage
|
|
3995
4013
|
* @param {float} leverage the rate of leverage
|
|
3996
4014
|
* @param {string} symbol unified market symbol
|
|
3997
4015
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -4025,6 +4043,7 @@ export default class mexc extends Exchange {
|
|
|
4025
4043
|
* @method
|
|
4026
4044
|
* @name mexc#fetchFundingHistory
|
|
4027
4045
|
* @description fetch the history of funding payments paid and received on this account
|
|
4046
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-details-of-user-s-funding-rate
|
|
4028
4047
|
* @param {string} symbol unified market symbol
|
|
4029
4048
|
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
4030
4049
|
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
@@ -4140,6 +4159,7 @@ export default class mexc extends Exchange {
|
|
|
4140
4159
|
* @method
|
|
4141
4160
|
* @name mexc#fetchFundingRate
|
|
4142
4161
|
* @description fetch the current funding rate
|
|
4162
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-funding-rate
|
|
4143
4163
|
* @param {string} symbol unified market symbol
|
|
4144
4164
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4145
4165
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
@@ -4173,6 +4193,7 @@ export default class mexc extends Exchange {
|
|
|
4173
4193
|
* @method
|
|
4174
4194
|
* @name mexc#fetchFundingRateHistory
|
|
4175
4195
|
* @description fetches historical funding rate prices
|
|
4196
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-funding-rate-history
|
|
4176
4197
|
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
4177
4198
|
* @param {int} [since] not used by mexc, but filtered internally by ccxt
|
|
4178
4199
|
* @param {int} [limit] mexc limit is page_size default 20, maximum is 100
|
|
@@ -4906,6 +4927,16 @@ export default class mexc extends Exchange {
|
|
|
4906
4927
|
});
|
|
4907
4928
|
}
|
|
4908
4929
|
async fetchTransfer(id, code = undefined, params = {}) {
|
|
4930
|
+
/**
|
|
4931
|
+
* @method
|
|
4932
|
+
* @name mexc#fetchTransfer
|
|
4933
|
+
* @description fetches a transfer
|
|
4934
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v2_en/#internal-assets-transfer-order-inquiry
|
|
4935
|
+
* @param {string} id transfer id
|
|
4936
|
+
* @param {string} [code] not used by mexc fetchTransfer
|
|
4937
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
4938
|
+
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
4939
|
+
*/
|
|
4909
4940
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchTransfer', undefined, params);
|
|
4910
4941
|
await this.loadMarkets();
|
|
4911
4942
|
if (marketType === 'spot') {
|
|
@@ -4939,6 +4970,8 @@ export default class mexc extends Exchange {
|
|
|
4939
4970
|
* @method
|
|
4940
4971
|
* @name mexc#fetchTransfers
|
|
4941
4972
|
* @description fetch a history of internal transfers made on an account
|
|
4973
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v2_en/#get-internal-assets-transfer-records
|
|
4974
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-39-s-asset-transfer-records
|
|
4942
4975
|
* @param {string} code unified currency code of the currency transferred
|
|
4943
4976
|
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
4944
4977
|
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
@@ -5196,6 +5229,16 @@ export default class mexc extends Exchange {
|
|
|
5196
5229
|
return this.parseTransaction(response, currency);
|
|
5197
5230
|
}
|
|
5198
5231
|
async setPositionMode(hedged, symbol = undefined, params = {}) {
|
|
5232
|
+
/**
|
|
5233
|
+
* @method
|
|
5234
|
+
* @name mexc#setPositionMode
|
|
5235
|
+
* @description set hedged to true or false for a market
|
|
5236
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#change-position-mode
|
|
5237
|
+
* @param {bool} hedged set to true to use dualSidePosition
|
|
5238
|
+
* @param {string} symbol not used by mexc setPositionMode ()
|
|
5239
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5240
|
+
* @returns {object} response from the exchange
|
|
5241
|
+
*/
|
|
5199
5242
|
const request = {
|
|
5200
5243
|
'positionMode': hedged ? 1 : 2, // 1 Hedge, 2 One-way, before changing position mode make sure that there are no active orders, planned orders, or open positions, the risk limit level will be reset to 1
|
|
5201
5244
|
};
|
|
@@ -5209,6 +5252,15 @@ export default class mexc extends Exchange {
|
|
|
5209
5252
|
return response;
|
|
5210
5253
|
}
|
|
5211
5254
|
async fetchPositionMode(symbol = undefined, params = {}) {
|
|
5255
|
+
/**
|
|
5256
|
+
* @method
|
|
5257
|
+
* @name mexc#fetchPositionMode
|
|
5258
|
+
* @description fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
|
|
5259
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-position-mode
|
|
5260
|
+
* @param {string} symbol not used by mexc fetchPositionMode
|
|
5261
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5262
|
+
* @returns {object} an object detailing whether the market is in hedged or one-way mode
|
|
5263
|
+
*/
|
|
5212
5264
|
const response = await this.contractPrivateGetPositionPositionMode(params);
|
|
5213
5265
|
//
|
|
5214
5266
|
// {
|
package/js/src/ndax.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/ndax.js';
|
|
2
|
-
import type { IndexType, Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, Transaction, Num, Account, Currencies, Dict, int } from './base/types.js';
|
|
2
|
+
import type { IndexType, Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, Transaction, Num, Account, Currencies, Dict, int, LedgerEntry } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class ndax
|
|
5
5
|
* @augments Exchange
|
|
@@ -22,24 +22,8 @@ export default class ndax extends Exchange {
|
|
|
22
22
|
parseBalance(response: any): Balances;
|
|
23
23
|
fetchBalance(params?: {}): Promise<Balances>;
|
|
24
24
|
parseLedgerEntryType(type: any): string;
|
|
25
|
-
parseLedgerEntry(item: Dict, currency?: Currency):
|
|
26
|
-
|
|
27
|
-
id: string;
|
|
28
|
-
direction: any;
|
|
29
|
-
account: string;
|
|
30
|
-
referenceId: string;
|
|
31
|
-
referenceAccount: string;
|
|
32
|
-
type: string;
|
|
33
|
-
currency: string;
|
|
34
|
-
amount: number;
|
|
35
|
-
before: number;
|
|
36
|
-
after: number;
|
|
37
|
-
status: string;
|
|
38
|
-
timestamp: number;
|
|
39
|
-
datetime: string;
|
|
40
|
-
fee: any;
|
|
41
|
-
};
|
|
42
|
-
fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
25
|
+
parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
|
|
26
|
+
fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
|
|
43
27
|
parseOrderStatus(status: Str): string;
|
|
44
28
|
parseOrder(order: Dict, market?: Market): Order;
|
|
45
29
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
package/js/src/ndax.js
CHANGED
|
@@ -1141,6 +1141,7 @@ export default class ndax extends Exchange {
|
|
|
1141
1141
|
// }
|
|
1142
1142
|
//
|
|
1143
1143
|
const currencyId = this.safeString(item, 'ProductId');
|
|
1144
|
+
currency = this.safeCurrency(currencyId, currency);
|
|
1144
1145
|
const credit = this.safeString(item, 'CR');
|
|
1145
1146
|
const debit = this.safeString(item, 'DR');
|
|
1146
1147
|
let amount = undefined;
|
|
@@ -1162,7 +1163,7 @@ export default class ndax extends Exchange {
|
|
|
1162
1163
|
before = Precise.stringMax('0', Precise.stringSub(after, amount));
|
|
1163
1164
|
}
|
|
1164
1165
|
const timestamp = this.safeInteger(item, 'TimeStamp');
|
|
1165
|
-
return {
|
|
1166
|
+
return this.safeLedgerEntry({
|
|
1166
1167
|
'info': item,
|
|
1167
1168
|
'id': this.safeString(item, 'TransactionId'),
|
|
1168
1169
|
'direction': direction,
|
|
@@ -1178,17 +1179,17 @@ export default class ndax extends Exchange {
|
|
|
1178
1179
|
'timestamp': timestamp,
|
|
1179
1180
|
'datetime': this.iso8601(timestamp),
|
|
1180
1181
|
'fee': undefined,
|
|
1181
|
-
};
|
|
1182
|
+
}, currency);
|
|
1182
1183
|
}
|
|
1183
1184
|
async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1184
1185
|
/**
|
|
1185
1186
|
* @method
|
|
1186
1187
|
* @name ndax#fetchLedger
|
|
1187
|
-
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
1188
|
+
* @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
1188
1189
|
* @see https://apidoc.ndax.io/#getaccounttransactions
|
|
1189
|
-
* @param {string} code unified currency code, default is undefined
|
|
1190
|
+
* @param {string} [code] unified currency code, default is undefined
|
|
1190
1191
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
1191
|
-
* @param {int} [limit] max number of ledger
|
|
1192
|
+
* @param {int} [limit] max number of ledger entries to return, default is undefined
|
|
1192
1193
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1193
1194
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
1194
1195
|
*/
|
package/js/src/okcoin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/okcoin.js';
|
|
2
|
-
import type { TransferEntry, Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, Num, Currencies, Dict, int } from './base/types.js';
|
|
2
|
+
import type { TransferEntry, Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, Num, Currencies, Dict, int, LedgerEntry } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class okcoin
|
|
5
5
|
* @augments Exchange
|
|
@@ -52,25 +52,9 @@ export default class okcoin extends Exchange {
|
|
|
52
52
|
parseTransaction(transaction: Dict, currency?: Currency): Transaction;
|
|
53
53
|
fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
54
54
|
fetchOrderTrades(id: string, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
55
|
-
fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<
|
|
55
|
+
fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
|
|
56
56
|
parseLedgerEntryType(type: any): string;
|
|
57
|
-
parseLedgerEntry(item: Dict, currency?: Currency):
|
|
58
|
-
id: string;
|
|
59
|
-
info: Dict;
|
|
60
|
-
timestamp: number;
|
|
61
|
-
datetime: string;
|
|
62
|
-
account: any;
|
|
63
|
-
referenceId: string;
|
|
64
|
-
referenceAccount: any;
|
|
65
|
-
type: string;
|
|
66
|
-
currency: string;
|
|
67
|
-
symbol: string;
|
|
68
|
-
amount: number;
|
|
69
|
-
before: any;
|
|
70
|
-
after: number;
|
|
71
|
-
status: string;
|
|
72
|
-
fee: any;
|
|
73
|
-
};
|
|
57
|
+
parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
|
|
74
58
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
75
59
|
url: string;
|
|
76
60
|
method: string;
|
package/js/src/okcoin.js
CHANGED
|
@@ -2861,13 +2861,13 @@ export default class okcoin extends Exchange {
|
|
|
2861
2861
|
/**
|
|
2862
2862
|
* @method
|
|
2863
2863
|
* @name okcoin#fetchLedger
|
|
2864
|
+
* @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
2864
2865
|
* @see https://www.okcoin.com/docs-v5/en/#rest-api-funding-asset-bills-details
|
|
2865
2866
|
* @see https://www.okcoin.com/docs-v5/en/#rest-api-account-get-bills-details-last-7-days
|
|
2866
2867
|
* @see https://www.okcoin.com/docs-v5/en/#rest-api-account-get-bills-details-last-3-months
|
|
2867
|
-
* @
|
|
2868
|
-
* @param {string} code unified currency code, default is undefined
|
|
2868
|
+
* @param {string} [code] unified currency code, default is undefined
|
|
2869
2869
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
2870
|
-
* @param {int} [limit] max number of ledger
|
|
2870
|
+
* @param {int} [limit] max number of ledger entries to return, default is undefined
|
|
2871
2871
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2872
2872
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
2873
2873
|
*/
|
|
@@ -3009,46 +3009,37 @@ export default class okcoin extends Exchange {
|
|
|
3009
3009
|
// "ts": "1597026383085"
|
|
3010
3010
|
// }
|
|
3011
3011
|
//
|
|
3012
|
-
const
|
|
3013
|
-
const
|
|
3014
|
-
|
|
3015
|
-
const referenceAccount = undefined;
|
|
3016
|
-
const type = this.parseLedgerEntryType(this.safeString(item, 'type'));
|
|
3017
|
-
const code = this.safeCurrencyCode(this.safeString(item, 'ccy'), currency);
|
|
3018
|
-
const amountString = this.safeString(item, 'balChg');
|
|
3019
|
-
const amount = this.parseNumber(amountString);
|
|
3012
|
+
const currencyId = this.safeString(item, 'ccy');
|
|
3013
|
+
const code = this.safeCurrencyCode(currencyId, currency);
|
|
3014
|
+
currency = this.safeCurrency(currencyId, currency);
|
|
3020
3015
|
const timestamp = this.safeInteger(item, 'ts');
|
|
3021
3016
|
const feeCostString = this.safeString(item, 'fee');
|
|
3022
3017
|
let fee = undefined;
|
|
3023
3018
|
if (feeCostString !== undefined) {
|
|
3024
3019
|
fee = {
|
|
3025
|
-
'cost': this.
|
|
3020
|
+
'cost': this.parseToNumeric(Precise.stringNeg(feeCostString)),
|
|
3026
3021
|
'currency': code,
|
|
3027
3022
|
};
|
|
3028
3023
|
}
|
|
3029
|
-
const before = undefined;
|
|
3030
|
-
const afterString = this.safeString(item, 'bal');
|
|
3031
|
-
const after = this.parseNumber(afterString);
|
|
3032
|
-
const status = 'ok';
|
|
3033
3024
|
const marketId = this.safeString(item, 'instId');
|
|
3034
3025
|
const symbol = this.safeSymbol(marketId, undefined, '-');
|
|
3035
|
-
return {
|
|
3036
|
-
'id': id,
|
|
3026
|
+
return this.safeLedgerEntry({
|
|
3037
3027
|
'info': item,
|
|
3028
|
+
'id': this.safeString(item, 'billId'),
|
|
3038
3029
|
'timestamp': timestamp,
|
|
3039
3030
|
'datetime': this.iso8601(timestamp),
|
|
3040
|
-
'account':
|
|
3041
|
-
'referenceId':
|
|
3042
|
-
'referenceAccount':
|
|
3043
|
-
'type': type,
|
|
3031
|
+
'account': undefined,
|
|
3032
|
+
'referenceId': this.safeString(item, 'ordId'),
|
|
3033
|
+
'referenceAccount': undefined,
|
|
3034
|
+
'type': this.parseLedgerEntryType(this.safeString(item, 'type')),
|
|
3044
3035
|
'currency': code,
|
|
3045
3036
|
'symbol': symbol,
|
|
3046
|
-
'amount':
|
|
3047
|
-
'before':
|
|
3048
|
-
'after':
|
|
3049
|
-
'status':
|
|
3037
|
+
'amount': this.safeNumber(item, 'balChg'),
|
|
3038
|
+
'before': undefined,
|
|
3039
|
+
'after': this.safeNumber(item, 'bal'),
|
|
3040
|
+
'status': 'ok',
|
|
3050
3041
|
'fee': fee,
|
|
3051
|
-
};
|
|
3042
|
+
}, currency);
|
|
3052
3043
|
}
|
|
3053
3044
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
3054
3045
|
const isArray = Array.isArray(params);
|
package/js/src/okx.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/okx.js';
|
|
2
|
-
import type { TransferEntry, Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Balances, Tickers, Market, Greeks, Strings, MarketInterface, Currency, Leverage, Num, Account, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, Conversion, CancellationRequest, Dict, Position, CrossBorrowRate, CrossBorrowRates, LeverageTier, int } from './base/types.js';
|
|
2
|
+
import type { TransferEntry, Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Balances, Tickers, Market, Greeks, Strings, MarketInterface, Currency, Leverage, Num, Account, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, Conversion, CancellationRequest, Dict, Position, CrossBorrowRate, CrossBorrowRates, LeverageTier, int, LedgerEntry } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class okx
|
|
5
5
|
* @augments Exchange
|
|
@@ -52,25 +52,9 @@ export default class okx extends Exchange {
|
|
|
52
52
|
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
53
53
|
fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
54
54
|
fetchOrderTrades(id: string, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
55
|
-
fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<
|
|
55
|
+
fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
|
|
56
56
|
parseLedgerEntryType(type: any): string;
|
|
57
|
-
parseLedgerEntry(item: Dict, currency?: Currency):
|
|
58
|
-
id: string;
|
|
59
|
-
info: Dict;
|
|
60
|
-
timestamp: number;
|
|
61
|
-
datetime: string;
|
|
62
|
-
account: any;
|
|
63
|
-
referenceId: string;
|
|
64
|
-
referenceAccount: any;
|
|
65
|
-
type: string;
|
|
66
|
-
currency: string;
|
|
67
|
-
symbol: string;
|
|
68
|
-
amount: number;
|
|
69
|
-
before: any;
|
|
70
|
-
after: number;
|
|
71
|
-
status: string;
|
|
72
|
-
fee: any;
|
|
73
|
-
};
|
|
57
|
+
parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
|
|
74
58
|
parseDepositAddress(depositAddress: any, currency?: Currency): {
|
|
75
59
|
currency: string;
|
|
76
60
|
address: string;
|
package/js/src/okx.js
CHANGED
|
@@ -793,6 +793,7 @@ export default class okx extends Exchange {
|
|
|
793
793
|
// SPOT/MARGIN error codes 54000-54999
|
|
794
794
|
'54000': ExchangeError,
|
|
795
795
|
'54001': ExchangeError,
|
|
796
|
+
'54011': InvalidOrder,
|
|
796
797
|
// Trading bot Error Code from 55100 to 55999
|
|
797
798
|
'55100': InvalidOrder,
|
|
798
799
|
'55101': InvalidOrder,
|
|
@@ -4474,13 +4475,13 @@ export default class okx extends Exchange {
|
|
|
4474
4475
|
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-7-days
|
|
4475
4476
|
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-3-months
|
|
4476
4477
|
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-asset-bills-details
|
|
4477
|
-
* @param {string} code unified currency code, default is undefined
|
|
4478
|
+
* @param {string} [code] unified currency code, default is undefined
|
|
4478
4479
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
4479
|
-
* @param {int} [limit] max number of ledger
|
|
4480
|
+
* @param {int} [limit] max number of ledger entries to return, default is undefined
|
|
4480
4481
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4481
4482
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
4482
4483
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4483
|
-
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [
|
|
4484
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
4484
4485
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
4485
4486
|
*/
|
|
4486
4487
|
await this.loadMarkets();
|
|
@@ -4643,14 +4644,9 @@ export default class okx extends Exchange {
|
|
|
4643
4644
|
// "ts": "1597026383085"
|
|
4644
4645
|
// }
|
|
4645
4646
|
//
|
|
4646
|
-
const
|
|
4647
|
-
const
|
|
4648
|
-
|
|
4649
|
-
const referenceAccount = undefined;
|
|
4650
|
-
const type = this.parseLedgerEntryType(this.safeString(item, 'type'));
|
|
4651
|
-
const code = this.safeCurrencyCode(this.safeString(item, 'ccy'), currency);
|
|
4652
|
-
const amountString = this.safeString(item, 'balChg');
|
|
4653
|
-
const amount = this.parseNumber(amountString);
|
|
4647
|
+
const currencyId = this.safeString(item, 'ccy');
|
|
4648
|
+
const code = this.safeCurrencyCode(currencyId, currency);
|
|
4649
|
+
currency = this.safeCurrency(currencyId, currency);
|
|
4654
4650
|
const timestamp = this.safeInteger(item, 'ts');
|
|
4655
4651
|
const feeCostString = this.safeString(item, 'fee');
|
|
4656
4652
|
let fee = undefined;
|
|
@@ -4660,29 +4656,25 @@ export default class okx extends Exchange {
|
|
|
4660
4656
|
'currency': code,
|
|
4661
4657
|
};
|
|
4662
4658
|
}
|
|
4663
|
-
const before = undefined;
|
|
4664
|
-
const afterString = this.safeString(item, 'bal');
|
|
4665
|
-
const after = this.parseNumber(afterString);
|
|
4666
|
-
const status = 'ok';
|
|
4667
4659
|
const marketId = this.safeString(item, 'instId');
|
|
4668
4660
|
const symbol = this.safeSymbol(marketId, undefined, '-');
|
|
4669
|
-
return {
|
|
4670
|
-
'id': id,
|
|
4661
|
+
return this.safeLedgerEntry({
|
|
4671
4662
|
'info': item,
|
|
4663
|
+
'id': this.safeString(item, 'billId'),
|
|
4672
4664
|
'timestamp': timestamp,
|
|
4673
4665
|
'datetime': this.iso8601(timestamp),
|
|
4674
|
-
'account':
|
|
4675
|
-
'referenceId':
|
|
4676
|
-
'referenceAccount':
|
|
4677
|
-
'type': type,
|
|
4666
|
+
'account': undefined,
|
|
4667
|
+
'referenceId': this.safeString(item, 'ordId'),
|
|
4668
|
+
'referenceAccount': undefined,
|
|
4669
|
+
'type': this.parseLedgerEntryType(this.safeString(item, 'type')),
|
|
4678
4670
|
'currency': code,
|
|
4679
4671
|
'symbol': symbol,
|
|
4680
|
-
'amount':
|
|
4681
|
-
'before':
|
|
4682
|
-
'after':
|
|
4683
|
-
'status':
|
|
4672
|
+
'amount': this.safeNumber(item, 'balChg'),
|
|
4673
|
+
'before': undefined,
|
|
4674
|
+
'after': this.safeNumber(item, 'bal'),
|
|
4675
|
+
'status': 'ok',
|
|
4684
4676
|
'fee': fee,
|
|
4685
|
-
};
|
|
4677
|
+
}, currency);
|
|
4686
4678
|
}
|
|
4687
4679
|
parseDepositAddress(depositAddress, currency = undefined) {
|
|
4688
4680
|
//
|
package/js/src/p2b.js
CHANGED
|
@@ -477,7 +477,7 @@ export default class p2b extends Exchange {
|
|
|
477
477
|
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
478
478
|
/**
|
|
479
479
|
* @method
|
|
480
|
-
* @name
|
|
480
|
+
* @name p2b#fetchOrderBook
|
|
481
481
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
482
482
|
* @see https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#depth-result
|
|
483
483
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
@@ -646,7 +646,7 @@ export default class p2b extends Exchange {
|
|
|
646
646
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
647
647
|
/**
|
|
648
648
|
* @method
|
|
649
|
-
* @name
|
|
649
|
+
* @name p2b#fetchOHLCV
|
|
650
650
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
651
651
|
* @see https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#kline
|
|
652
652
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
package/js/src/pro/bybit.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export default class bybit extends bybitRest {
|
|
|
14
14
|
unWatchTickers(symbols?: Strings, params?: {}): Promise<any>;
|
|
15
15
|
unWatchTicker(symbols: string, params?: {}): Promise<any>;
|
|
16
16
|
handleTicker(client: Client, message: any): void;
|
|
17
|
+
watchBidsAsks(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
18
|
+
parseWsBidAsk(orderbook: any, market?: any): Ticker;
|
|
17
19
|
watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
18
20
|
watchOHLCVForSymbols(symbolsAndTimeframes: string[][], since?: Int, limit?: Int, params?: {}): Promise<import("../base/types.js").Dictionary<import("../base/types.js").Dictionary<OHLCV[]>>>;
|
|
19
21
|
unWatchOHLCVForSymbols(symbolsAndTimeframes: string[][], params?: {}): Promise<any>;
|
package/js/src/pro/bybit.js
CHANGED
|
@@ -25,6 +25,7 @@ export default class bybit extends bybitRest {
|
|
|
25
25
|
'fetchTradesWs': false,
|
|
26
26
|
'fetchBalanceWs': false,
|
|
27
27
|
'watchBalance': true,
|
|
28
|
+
'watchBidsAsks': true,
|
|
28
29
|
'watchLiquidations': true,
|
|
29
30
|
'watchLiquidationsForSymbols': false,
|
|
30
31
|
'watchMyLiquidations': false,
|
|
@@ -581,6 +582,52 @@ export default class bybit extends bybitRest {
|
|
|
581
582
|
const messageHash = 'ticker:' + symbol;
|
|
582
583
|
client.resolve(this.tickers[symbol], messageHash);
|
|
583
584
|
}
|
|
585
|
+
async watchBidsAsks(symbols = undefined, params = {}) {
|
|
586
|
+
/**
|
|
587
|
+
* @method
|
|
588
|
+
* @name bybit#watchBidsAsks
|
|
589
|
+
* @description watches best bid & ask for symbols
|
|
590
|
+
* @see https://bybit-exchange.github.io/docs/v5/websocket/public/orderbook
|
|
591
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
592
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
593
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
594
|
+
*/
|
|
595
|
+
await this.loadMarkets();
|
|
596
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
597
|
+
const messageHashes = [];
|
|
598
|
+
const url = await this.getUrlByMarketType(symbols[0], false, 'watchBidsAsks', params);
|
|
599
|
+
params = this.cleanParams(params);
|
|
600
|
+
const marketIds = this.marketIds(symbols);
|
|
601
|
+
const topics = [];
|
|
602
|
+
for (let i = 0; i < marketIds.length; i++) {
|
|
603
|
+
const marketId = marketIds[i];
|
|
604
|
+
const topic = 'orderbook.1.' + marketId;
|
|
605
|
+
topics.push(topic);
|
|
606
|
+
messageHashes.push('bidask:' + symbols[i]);
|
|
607
|
+
}
|
|
608
|
+
const ticker = await this.watchTopics(url, messageHashes, topics, params);
|
|
609
|
+
if (this.newUpdates) {
|
|
610
|
+
return ticker;
|
|
611
|
+
}
|
|
612
|
+
return this.filterByArray(this.bidsasks, 'symbol', symbols);
|
|
613
|
+
}
|
|
614
|
+
parseWsBidAsk(orderbook, market = undefined) {
|
|
615
|
+
const timestamp = this.safeInteger(orderbook, 'timestamp');
|
|
616
|
+
const bids = this.sortBy(this.aggregate(orderbook['bids']), 0);
|
|
617
|
+
const asks = this.sortBy(this.aggregate(orderbook['asks']), 0);
|
|
618
|
+
const bestBid = this.safeList(bids, 0, []);
|
|
619
|
+
const bestAsk = this.safeList(asks, 0, []);
|
|
620
|
+
return this.safeTicker({
|
|
621
|
+
'symbol': market['symbol'],
|
|
622
|
+
'timestamp': timestamp,
|
|
623
|
+
'datetime': this.iso8601(timestamp),
|
|
624
|
+
'ask': this.safeNumber(bestAsk, 0),
|
|
625
|
+
'askVolume': this.safeNumber(bestAsk, 1),
|
|
626
|
+
'bid': this.safeNumber(bestBid, 0),
|
|
627
|
+
'bidVolume': this.safeNumber(bestBid, 1),
|
|
628
|
+
'info': orderbook,
|
|
629
|
+
}, market);
|
|
630
|
+
}
|
|
584
631
|
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
585
632
|
/**
|
|
586
633
|
* @method
|
|
@@ -905,6 +952,8 @@ export default class bybit extends bybitRest {
|
|
|
905
952
|
// }
|
|
906
953
|
// }
|
|
907
954
|
//
|
|
955
|
+
const topic = this.safeString(message, 'topic');
|
|
956
|
+
const limit = topic.split('.')[1];
|
|
908
957
|
const isSpot = client.url.indexOf('spot') >= 0;
|
|
909
958
|
const type = this.safeString(message, 'type');
|
|
910
959
|
const isSnapshot = (type === 'snapshot');
|
|
@@ -933,6 +982,13 @@ export default class bybit extends bybitRest {
|
|
|
933
982
|
const messageHash = 'orderbook' + ':' + symbol;
|
|
934
983
|
this.orderbooks[symbol] = orderbook;
|
|
935
984
|
client.resolve(orderbook, messageHash);
|
|
985
|
+
if (limit === '1') {
|
|
986
|
+
const bidask = this.parseWsBidAsk(this.orderbooks[symbol], market);
|
|
987
|
+
const newBidsAsks = {};
|
|
988
|
+
newBidsAsks[symbol] = bidask;
|
|
989
|
+
this.bidsasks[symbol] = bidask;
|
|
990
|
+
client.resolve(newBidsAsks, 'bidask:' + symbol);
|
|
991
|
+
}
|
|
936
992
|
}
|
|
937
993
|
handleDelta(bookside, delta) {
|
|
938
994
|
const bidAsk = this.parseBidAsk(delta, 0, 1);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import cryptocomRest from '../cryptocom.js';
|
|
2
|
-
import type { Int, OrderSide, OrderType, Str, Strings, OrderBook, Order, Trade, Ticker, OHLCV, Position, Balances, Num } from '../base/types.js';
|
|
2
|
+
import type { Int, OrderSide, OrderType, Str, Strings, OrderBook, Order, Trade, Ticker, OHLCV, Position, Balances, Num, Dict, Tickers, Market } from '../base/types.js';
|
|
3
3
|
import Client from '../base/ws/Client.js';
|
|
4
4
|
export default class cryptocom extends cryptocomRest {
|
|
5
5
|
describe(): any;
|
|
@@ -19,7 +19,13 @@ export default class cryptocom extends cryptocomRest {
|
|
|
19
19
|
watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
20
20
|
watchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
21
21
|
unWatchTicker(symbol: string, params?: {}): Promise<any>;
|
|
22
|
+
watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
23
|
+
unWatchTickers(symbols?: Strings, params?: {}): Promise<any>;
|
|
22
24
|
handleTicker(client: Client, message: any): void;
|
|
25
|
+
parseWsTicker(ticker: Dict, market?: Market): Ticker;
|
|
26
|
+
watchBidsAsks(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
27
|
+
handleBidAsk(client: Client, message: any): void;
|
|
28
|
+
parseWsBidAsk(ticker: any, market?: any): Ticker;
|
|
23
29
|
watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
24
30
|
unWatchOHLCV(symbol: string, timeframe?: string, params?: {}): Promise<any>;
|
|
25
31
|
handleOHLCV(client: Client, message: any): void;
|