ccxt 4.1.90 → 4.1.91
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.js +229 -49
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +61 -0
- package/dist/cjs/src/kucoin.js +1 -0
- package/dist/cjs/src/kucoinfutures.js +37 -0
- package/dist/cjs/src/phemex.js +108 -27
- package/dist/cjs/src/pro/bitmart.js +19 -18
- package/dist/cjs/src/zaif.js +2 -3
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/binance.d.ts +3 -0
- package/js/src/binance.js +61 -0
- package/js/src/kucoin.js +1 -0
- package/js/src/kucoinfutures.d.ts +1 -0
- package/js/src/kucoinfutures.js +37 -0
- package/js/src/phemex.js +108 -27
- package/js/src/pro/bitmart.d.ts +1 -1
- package/js/src/pro/bitmart.js +19 -18
- package/js/src/zaif.js +2 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -208,13 +208,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
208
208
|
|
|
209
209
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
210
210
|
|
|
211
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.
|
|
212
|
-
* unpkg: https://unpkg.com/ccxt@4.1.
|
|
211
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.91/dist/ccxt.browser.js
|
|
212
|
+
* unpkg: https://unpkg.com/ccxt@4.1.91/dist/ccxt.browser.js
|
|
213
213
|
|
|
214
214
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
|
215
215
|
|
|
216
216
|
```HTML
|
|
217
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.
|
|
217
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.91/dist/ccxt.browser.js"></script>
|
|
218
218
|
```
|
|
219
219
|
|
|
220
220
|
Creates a global `ccxt` object:
|
package/dist/ccxt.browser.js
CHANGED
|
@@ -17122,6 +17122,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
17122
17122
|
'closeAllPositions': false,
|
|
17123
17123
|
'closePosition': false,
|
|
17124
17124
|
'createDepositAddress': false,
|
|
17125
|
+
'createMarketBuyOrderWithCost': true,
|
|
17126
|
+
'createMarketOrderWithCost': true,
|
|
17127
|
+
'createMarketSellOrderWithCost': true,
|
|
17125
17128
|
'createOrder': true,
|
|
17126
17129
|
'createOrders': true,
|
|
17127
17130
|
'createPostOnlyOrder': true,
|
|
@@ -21735,6 +21738,64 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21735
21738
|
const requestParams = this.omit(params, ['quoteOrderQty', 'cost', 'stopPrice', 'test', 'type', 'newClientOrderId', 'clientOrderId', 'postOnly']);
|
|
21736
21739
|
return this.extend(request, requestParams);
|
|
21737
21740
|
}
|
|
21741
|
+
async createMarketOrderWithCost(symbol, side, cost, params = {}) {
|
|
21742
|
+
/**
|
|
21743
|
+
* @method
|
|
21744
|
+
* @name binance#createMarketOrderWithCost
|
|
21745
|
+
* @description create a market order by providing the symbol, side and cost
|
|
21746
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#new-order-trade
|
|
21747
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
21748
|
+
* @param {string} side 'buy' or 'sell'
|
|
21749
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
21750
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
21751
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
21752
|
+
*/
|
|
21753
|
+
await this.loadMarkets();
|
|
21754
|
+
const market = this.market(symbol);
|
|
21755
|
+
if (!market['spot']) {
|
|
21756
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketOrderWithCost() supports spot orders only');
|
|
21757
|
+
}
|
|
21758
|
+
params['quoteOrderQty'] = cost;
|
|
21759
|
+
return await this.createOrder(symbol, 'market', side, cost, undefined, params);
|
|
21760
|
+
}
|
|
21761
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
21762
|
+
/**
|
|
21763
|
+
* @method
|
|
21764
|
+
* @name binance#createMarketBuyOrderWithCost
|
|
21765
|
+
* @description create a market buy order by providing the symbol and cost
|
|
21766
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#new-order-trade
|
|
21767
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
21768
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
21769
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
21770
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
21771
|
+
*/
|
|
21772
|
+
await this.loadMarkets();
|
|
21773
|
+
const market = this.market(symbol);
|
|
21774
|
+
if (!market['spot']) {
|
|
21775
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
21776
|
+
}
|
|
21777
|
+
params['quoteOrderQty'] = cost;
|
|
21778
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
21779
|
+
}
|
|
21780
|
+
async createMarketSellOrderWithCost(symbol, cost, params = {}) {
|
|
21781
|
+
/**
|
|
21782
|
+
* @method
|
|
21783
|
+
* @name binance#createMarketSellOrderWithCost
|
|
21784
|
+
* @description create a market sell order by providing the symbol and cost
|
|
21785
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#new-order-trade
|
|
21786
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
21787
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
21788
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
21789
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
21790
|
+
*/
|
|
21791
|
+
await this.loadMarkets();
|
|
21792
|
+
const market = this.market(symbol);
|
|
21793
|
+
if (!market['spot']) {
|
|
21794
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketSellOrderWithCost() supports spot orders only');
|
|
21795
|
+
}
|
|
21796
|
+
params['quoteOrderQty'] = cost;
|
|
21797
|
+
return await this.createOrder(symbol, 'market', 'sell', cost, undefined, params);
|
|
21798
|
+
}
|
|
21738
21799
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
21739
21800
|
/**
|
|
21740
21801
|
* @method
|
|
@@ -155466,6 +155527,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155466
155527
|
'commonCurrencies': {
|
|
155467
155528
|
'BIFI': 'BIFIF',
|
|
155468
155529
|
'VAI': 'VAIOT',
|
|
155530
|
+
'WAX': 'WAXP',
|
|
155469
155531
|
},
|
|
155470
155532
|
'options': {
|
|
155471
155533
|
'version': 'v1',
|
|
@@ -159414,6 +159476,8 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
159414
159476
|
'createStopLimitOrder': true,
|
|
159415
159477
|
'createStopMarketOrder': true,
|
|
159416
159478
|
'createStopOrder': true,
|
|
159479
|
+
'closePosition': true,
|
|
159480
|
+
'closePositions': false,
|
|
159417
159481
|
'fetchAccounts': true,
|
|
159418
159482
|
'fetchBalance': true,
|
|
159419
159483
|
'fetchBorrowRateHistories': false,
|
|
@@ -161791,6 +161855,41 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
161791
161855
|
'datetime': this.iso8601(timestamp),
|
|
161792
161856
|
};
|
|
161793
161857
|
}
|
|
161858
|
+
async closePosition(symbol, side = undefined, params = {}) {
|
|
161859
|
+
/**
|
|
161860
|
+
* @method
|
|
161861
|
+
* @name kucoinfutures#closePosition
|
|
161862
|
+
* @description closes open positions for a market
|
|
161863
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/orders/place-order
|
|
161864
|
+
* @param {string} symbol Unified CCXT market symbol
|
|
161865
|
+
* @param {string} side not used by kucoinfutures closePositions
|
|
161866
|
+
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
161867
|
+
* @param {string} [params.clientOrderId] client order id of the order
|
|
161868
|
+
* @returns {[object]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
161869
|
+
*/
|
|
161870
|
+
await this.loadMarkets();
|
|
161871
|
+
const market = this.market(symbol);
|
|
161872
|
+
let clientOrderId = this.safeString(params, 'clientOrderId');
|
|
161873
|
+
const testOrder = this.safeValue(params, 'test', false);
|
|
161874
|
+
params = this.omit(params, ['test', 'clientOrderId']);
|
|
161875
|
+
if (clientOrderId === undefined) {
|
|
161876
|
+
clientOrderId = this.numberToString(this.nonce());
|
|
161877
|
+
}
|
|
161878
|
+
const request = {
|
|
161879
|
+
'symbol': market['id'],
|
|
161880
|
+
'closeOrder': true,
|
|
161881
|
+
'clientOid': clientOrderId,
|
|
161882
|
+
'type': 'market',
|
|
161883
|
+
};
|
|
161884
|
+
let response = undefined;
|
|
161885
|
+
if (testOrder) {
|
|
161886
|
+
response = await this.futuresPrivatePostOrdersTest(this.extend(request, params));
|
|
161887
|
+
}
|
|
161888
|
+
else {
|
|
161889
|
+
response = await this.futuresPrivatePostOrders(this.extend(request, params));
|
|
161890
|
+
}
|
|
161891
|
+
return this.parseOrder(response, market);
|
|
161892
|
+
}
|
|
161794
161893
|
}
|
|
161795
161894
|
|
|
161796
161895
|
|
|
@@ -194749,6 +194848,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
194749
194848
|
'networks': {
|
|
194750
194849
|
'TRC20': 'TRX',
|
|
194751
194850
|
'ERC20': 'ETH',
|
|
194851
|
+
'BEP20': 'BNB',
|
|
194752
194852
|
},
|
|
194753
194853
|
'defaultNetworks': {
|
|
194754
194854
|
'USDT': 'ETH',
|
|
@@ -197687,6 +197787,19 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
197687
197787
|
const statuses = {
|
|
197688
197788
|
'Success': 'ok',
|
|
197689
197789
|
'Succeed': 'ok',
|
|
197790
|
+
'Rejected': 'failed',
|
|
197791
|
+
'Security check failed': 'failed',
|
|
197792
|
+
'SecurityCheckFailed': 'failed',
|
|
197793
|
+
'Expired': 'failed',
|
|
197794
|
+
'Address Risk': 'failed',
|
|
197795
|
+
'Security Checking': 'pending',
|
|
197796
|
+
'SecurityChecking': 'pending',
|
|
197797
|
+
'Pending Review': 'pending',
|
|
197798
|
+
'Pending Transfer': 'pending',
|
|
197799
|
+
'AmlCsApporve': 'pending',
|
|
197800
|
+
'New': 'pending',
|
|
197801
|
+
'Confirmed': 'pending',
|
|
197802
|
+
'Cancelled': 'canceled',
|
|
197690
197803
|
};
|
|
197691
197804
|
return this.safeString(statuses, status, status);
|
|
197692
197805
|
}
|
|
@@ -197694,36 +197807,68 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
197694
197807
|
//
|
|
197695
197808
|
// withdraw
|
|
197696
197809
|
//
|
|
197697
|
-
//
|
|
197810
|
+
// {
|
|
197811
|
+
// "id": "10000001",
|
|
197812
|
+
// "freezeId": null,
|
|
197813
|
+
// "address": "44exxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
197814
|
+
// "amountRv": "100",
|
|
197815
|
+
// "chainCode": "11",
|
|
197816
|
+
// "chainName": "TRX",
|
|
197817
|
+
// "currency": "USDT",
|
|
197818
|
+
// "currencyCode": 3,
|
|
197819
|
+
// "email": "abc@gmail.com",
|
|
197820
|
+
// "expiredTime": "0",
|
|
197821
|
+
// "feeRv": "1",
|
|
197822
|
+
// "nickName": null,
|
|
197823
|
+
// "phone": null,
|
|
197824
|
+
// "rejectReason": "",
|
|
197825
|
+
// "submitedAt": "1670000000000",
|
|
197826
|
+
// "submittedAt": "1670000000000",
|
|
197827
|
+
// "txHash": null,
|
|
197828
|
+
// "userId": "10000001",
|
|
197829
|
+
// "status": "Success"
|
|
197698
197830
|
//
|
|
197699
197831
|
// fetchDeposits
|
|
197700
197832
|
//
|
|
197701
197833
|
// {
|
|
197702
|
-
// "id":29200,
|
|
197703
|
-
// "currency":"USDT",
|
|
197704
|
-
// "currencyCode":3,
|
|
197705
|
-
// "
|
|
197706
|
-
// "
|
|
197707
|
-
// "
|
|
197708
|
-
// "
|
|
197709
|
-
// "
|
|
197710
|
-
// "
|
|
197711
|
-
// "
|
|
197834
|
+
// "id": "29200",
|
|
197835
|
+
// "currency": "USDT",
|
|
197836
|
+
// "currencyCode": "3",
|
|
197837
|
+
// "chainName": "ETH",
|
|
197838
|
+
// "chainCode": "4",
|
|
197839
|
+
// "txHash": "0x0bdbdc47807769a03b158d5753f54dfc58b92993d2f5e818db21863e01238e5d",
|
|
197840
|
+
// "address": "0x5bfbf60e0fa7f63598e6cfd8a7fd3ffac4ccc6ad",
|
|
197841
|
+
// "amountEv": "3000000000",
|
|
197842
|
+
// "confirmations": "13",
|
|
197843
|
+
// "type": "Deposit",
|
|
197844
|
+
// "status": "Success",
|
|
197845
|
+
// "createdAt": "1592722565000",
|
|
197712
197846
|
// }
|
|
197713
197847
|
//
|
|
197714
197848
|
// fetchWithdrawals
|
|
197715
197849
|
//
|
|
197716
197850
|
// {
|
|
197717
|
-
// "
|
|
197718
|
-
// "
|
|
197719
|
-
// "
|
|
197720
|
-
// "
|
|
197721
|
-
// "
|
|
197722
|
-
// "
|
|
197723
|
-
// "
|
|
197724
|
-
// "
|
|
197725
|
-
// "
|
|
197726
|
-
// "withdrawStatus: ""
|
|
197851
|
+
// "id": "10000001",
|
|
197852
|
+
// "userId": "10000001",
|
|
197853
|
+
// "freezeId": "10000002",
|
|
197854
|
+
// "phone": null,
|
|
197855
|
+
// "email": "abc@gmail.com",
|
|
197856
|
+
// "nickName": null,
|
|
197857
|
+
// "currency": "USDT",
|
|
197858
|
+
// "currencyCode": "3",
|
|
197859
|
+
// "status": "Succeed",
|
|
197860
|
+
// "withdrawStatus": "Succeed",
|
|
197861
|
+
// "amountEv": "8800000000",
|
|
197862
|
+
// "feeEv": "1200000000",
|
|
197863
|
+
// "address": "0x5xxxad",
|
|
197864
|
+
// "txHash: "0x0xxxx5d",
|
|
197865
|
+
// "submitedAt": "1702571922000",
|
|
197866
|
+
// "submittedAt": "1702571922000",
|
|
197867
|
+
// "expiredTime": "0",
|
|
197868
|
+
// "rejectReason": null,
|
|
197869
|
+
// "chainName": "ETH",
|
|
197870
|
+
// "chainCode": "4",
|
|
197871
|
+
// "proxyAddress": null
|
|
197727
197872
|
// }
|
|
197728
197873
|
//
|
|
197729
197874
|
const id = this.safeString(transaction, 'id');
|
|
@@ -197733,9 +197878,13 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
197733
197878
|
const currencyId = this.safeString(transaction, 'currency');
|
|
197734
197879
|
currency = this.safeCurrency(currencyId, currency);
|
|
197735
197880
|
const code = currency['code'];
|
|
197736
|
-
const
|
|
197881
|
+
const networkId = this.safeString(transaction, 'chainName');
|
|
197882
|
+
const timestamp = this.safeIntegerN(transaction, ['createdAt', 'submitedAt', 'submittedAt']);
|
|
197737
197883
|
let type = this.safeStringLower(transaction, 'type');
|
|
197738
|
-
|
|
197884
|
+
let feeCost = this.parseNumber(this.fromEn(this.safeString(transaction, 'feeEv'), currency['valueScale']));
|
|
197885
|
+
if (feeCost === undefined) {
|
|
197886
|
+
feeCost = this.safeNumber(transaction, 'feeRv');
|
|
197887
|
+
}
|
|
197739
197888
|
let fee = undefined;
|
|
197740
197889
|
if (feeCost !== undefined) {
|
|
197741
197890
|
type = 'withdrawal';
|
|
@@ -197745,14 +197894,17 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
197745
197894
|
};
|
|
197746
197895
|
}
|
|
197747
197896
|
const status = this.parseTransactionStatus(this.safeString(transaction, 'status'));
|
|
197748
|
-
|
|
197897
|
+
let amount = this.parseNumber(this.fromEn(this.safeString(transaction, 'amountEv'), currency['valueScale']));
|
|
197898
|
+
if (amount === undefined) {
|
|
197899
|
+
amount = this.safeNumber(transaction, 'amountRv');
|
|
197900
|
+
}
|
|
197749
197901
|
return {
|
|
197750
197902
|
'info': transaction,
|
|
197751
197903
|
'id': id,
|
|
197752
197904
|
'txid': txid,
|
|
197753
197905
|
'timestamp': timestamp,
|
|
197754
197906
|
'datetime': this.iso8601(timestamp),
|
|
197755
|
-
'network':
|
|
197907
|
+
'network': this.networkIdToCode(networkId),
|
|
197756
197908
|
'address': address,
|
|
197757
197909
|
'addressTo': address,
|
|
197758
197910
|
'addressFrom': undefined,
|
|
@@ -198894,10 +199046,38 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
198894
199046
|
'chainName': networkId.toUpperCase(),
|
|
198895
199047
|
};
|
|
198896
199048
|
if (tag !== undefined) {
|
|
198897
|
-
request['
|
|
199049
|
+
request['addressTag'] = tag;
|
|
198898
199050
|
}
|
|
198899
199051
|
const response = await this.privatePostPhemexWithdrawWalletsApiCreateWithdraw(this.extend(request, params));
|
|
198900
|
-
|
|
199052
|
+
//
|
|
199053
|
+
// {
|
|
199054
|
+
// "code": 0,
|
|
199055
|
+
// "msg": "OK",
|
|
199056
|
+
// "data": {
|
|
199057
|
+
// "id": "10000001",
|
|
199058
|
+
// "freezeId": null,
|
|
199059
|
+
// "address": "44exxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
199060
|
+
// "amountRv": "100",
|
|
199061
|
+
// "chainCode": "11",
|
|
199062
|
+
// "chainName": "TRX",
|
|
199063
|
+
// "currency": "USDT",
|
|
199064
|
+
// "currencyCode": 3,
|
|
199065
|
+
// "email": "abc@gmail.com",
|
|
199066
|
+
// "expiredTime": "0",
|
|
199067
|
+
// "feeRv": "1",
|
|
199068
|
+
// "nickName": null,
|
|
199069
|
+
// "phone": null,
|
|
199070
|
+
// "rejectReason": "",
|
|
199071
|
+
// "submitedAt": "1670000000000",
|
|
199072
|
+
// "submittedAt": "1670000000000",
|
|
199073
|
+
// "txHash": null,
|
|
199074
|
+
// "userId": "10000001",
|
|
199075
|
+
// "status": "Success"
|
|
199076
|
+
// }
|
|
199077
|
+
// }
|
|
199078
|
+
//
|
|
199079
|
+
const data = this.safeValue(response, 'data', {});
|
|
199080
|
+
return this.parseTransaction(data, currency);
|
|
198901
199081
|
}
|
|
198902
199082
|
handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
198903
199083
|
if (response === undefined) {
|
|
@@ -212283,7 +212463,7 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
212283
212463
|
'defaultType': 'spot',
|
|
212284
212464
|
'watchBalance': {
|
|
212285
212465
|
'fetchBalanceSnapshot': true,
|
|
212286
|
-
'awaitBalanceSnapshot':
|
|
212466
|
+
'awaitBalanceSnapshot': false, // whether to wait for the balance snapshot before providing updates
|
|
212287
212467
|
},
|
|
212288
212468
|
'watchOrderBook': {
|
|
212289
212469
|
'depth': 'depth50', // depth5, depth20, depth50
|
|
@@ -212363,30 +212543,31 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
212363
212543
|
const messageHash = 'balance:' + type;
|
|
212364
212544
|
const url = this.implodeHostname(this.urls['api']['ws'][type]['private']);
|
|
212365
212545
|
const client = this.client(url);
|
|
212366
|
-
this.setBalanceCache(client, type);
|
|
212367
|
-
|
|
212368
|
-
|
|
212546
|
+
this.setBalanceCache(client, type, messageHash);
|
|
212547
|
+
let fetchBalanceSnapshot = undefined;
|
|
212548
|
+
let awaitBalanceSnapshot = undefined;
|
|
212549
|
+
[fetchBalanceSnapshot, params] = this.handleOptionAndParams(this.options, 'watchBalance', 'fetchBalanceSnapshot', true);
|
|
212550
|
+
[awaitBalanceSnapshot, params] = this.handleOptionAndParams(this.options, 'watchBalance', 'awaitBalanceSnapshot', false);
|
|
212369
212551
|
if (fetchBalanceSnapshot && awaitBalanceSnapshot) {
|
|
212370
212552
|
await client.future(type + ':fetchBalanceSnapshot');
|
|
212371
212553
|
}
|
|
212372
212554
|
return await this.watch(url, messageHash, this.deepExtend(request, params), messageHash);
|
|
212373
212555
|
}
|
|
212374
|
-
setBalanceCache(client, type) {
|
|
212375
|
-
if (
|
|
212376
|
-
return
|
|
212556
|
+
setBalanceCache(client, type, subscribeHash) {
|
|
212557
|
+
if (subscribeHash in client.subscriptions) {
|
|
212558
|
+
return;
|
|
212377
212559
|
}
|
|
212378
212560
|
const options = this.safeValue(this.options, 'watchBalance');
|
|
212379
|
-
const
|
|
212380
|
-
if (
|
|
212381
|
-
const messageHash = type + ':fetchBalanceSnapshot';
|
|
212561
|
+
const snapshot = this.safeValue(options, 'fetchBalanceSnapshot', true);
|
|
212562
|
+
if (snapshot) {
|
|
212563
|
+
const messageHash = type + ':' + 'fetchBalanceSnapshot';
|
|
212382
212564
|
if (!(messageHash in client.futures)) {
|
|
212383
212565
|
client.future(messageHash);
|
|
212384
212566
|
this.spawn(this.loadBalanceSnapshot, client, messageHash, type);
|
|
212385
212567
|
}
|
|
212386
212568
|
}
|
|
212387
|
-
|
|
212388
|
-
|
|
212389
|
-
}
|
|
212569
|
+
this.balance[type] = {};
|
|
212570
|
+
// without this comment, transpilation breaks for some reason...
|
|
212390
212571
|
}
|
|
212391
212572
|
async loadBalanceSnapshot(client, messageHash, type) {
|
|
212392
212573
|
const response = await this.fetchBalance({ 'type': type });
|
|
@@ -212433,15 +212614,15 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
212433
212614
|
}
|
|
212434
212615
|
const isSpot = (channel.indexOf('spot') >= 0);
|
|
212435
212616
|
const type = isSpot ? 'spot' : 'swap';
|
|
212436
|
-
this.balance['info'] = message;
|
|
212617
|
+
this.balance[type]['info'] = message;
|
|
212437
212618
|
if (isSpot) {
|
|
212438
212619
|
if (!Array.isArray(data)) {
|
|
212439
212620
|
return;
|
|
212440
212621
|
}
|
|
212441
212622
|
for (let i = 0; i < data.length; i++) {
|
|
212442
212623
|
const timestamp = this.safeInteger(message, 'event_time');
|
|
212443
|
-
this.balance['timestamp'] = timestamp;
|
|
212444
|
-
this.balance['datetime'] = this.iso8601(timestamp);
|
|
212624
|
+
this.balance[type]['timestamp'] = timestamp;
|
|
212625
|
+
this.balance[type]['datetime'] = this.iso8601(timestamp);
|
|
212445
212626
|
const balanceDetails = this.safeValue(data[i], 'balance_details', []);
|
|
212446
212627
|
for (let ii = 0; ii < balanceDetails.length; ii++) {
|
|
212447
212628
|
const rawBalance = balanceDetails[i];
|
|
@@ -212449,8 +212630,8 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
212449
212630
|
const currencyId = this.safeString(rawBalance, 'ccy');
|
|
212450
212631
|
const code = this.safeCurrencyCode(currencyId);
|
|
212451
212632
|
account['free'] = this.safeString(rawBalance, 'av_bal');
|
|
212452
|
-
account['
|
|
212453
|
-
this.balance[code] = account;
|
|
212633
|
+
account['used'] = this.safeString(rawBalance, 'fz_bal');
|
|
212634
|
+
this.balance[type][code] = account;
|
|
212454
212635
|
}
|
|
212455
212636
|
}
|
|
212456
212637
|
}
|
|
@@ -279932,15 +280113,14 @@ class zaif extends _abstract_zaif_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
279932
280113
|
// }
|
|
279933
280114
|
//
|
|
279934
280115
|
const symbol = this.safeSymbol(undefined, market);
|
|
279935
|
-
const timestamp = this.milliseconds();
|
|
279936
280116
|
const vwap = this.safeString(ticker, 'vwap');
|
|
279937
280117
|
const baseVolume = this.safeString(ticker, 'volume');
|
|
279938
280118
|
const quoteVolume = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(baseVolume, vwap);
|
|
279939
280119
|
const last = this.safeString(ticker, 'last');
|
|
279940
280120
|
return this.safeTicker({
|
|
279941
280121
|
'symbol': symbol,
|
|
279942
|
-
'timestamp':
|
|
279943
|
-
'datetime':
|
|
280122
|
+
'timestamp': undefined,
|
|
280123
|
+
'datetime': undefined,
|
|
279944
280124
|
'high': this.safeString(ticker, 'high'),
|
|
279945
280125
|
'low': this.safeString(ticker, 'low'),
|
|
279946
280126
|
'bid': this.safeString(ticker, 'bid'),
|
|
@@ -287814,7 +287994,7 @@ SOFTWARE.
|
|
|
287814
287994
|
|
|
287815
287995
|
//-----------------------------------------------------------------------------
|
|
287816
287996
|
// this is updated by vss.js when building
|
|
287817
|
-
const version = '4.1.
|
|
287997
|
+
const version = '4.1.91';
|
|
287818
287998
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
287819
287999
|
//-----------------------------------------------------------------------------
|
|
287820
288000
|
|