MCPcopy Create free account
hub / github.com/ccxt/ccxt / loadUnifiedStatus

Method loadUnifiedStatus

js/src/gate.js:1174–1201  ·  view source on GitHub ↗

* @method * @name gate#loadUnifiedStatus * @param {object} [params] extra parameters specific to the exchange API endpoint * @description returns unifiedAccount so the user can check if the unified account is enabled * @see https://www.gate.com/docs/developers/apiv4/#retrieve-use

(params = {})

Source from the content-addressed store, hash-verified

1172 * @returns {boolean} true or false if the enabled unified account is enabled or not and sets the unifiedAccount option if it is undefined
1173 */
1174 async loadUnifiedStatus(params = {}) {
1175 const unifiedAccount = this.safeBool(this.options, 'unifiedAccount');
1176 if (unifiedAccount === undefined) {
1177 try {
1178 //
1179 // {
1180 // "user_id": 10406147,
1181 // "ip_whitelist": [],
1182 // "currency_pairs": [],
1183 // "key": {
1184 // "mode": 1
1185 // },
1186 // "tier": 0,
1187 // "tier_expire_time": "0001-01-01T00:00:00Z",
1188 // "copy_trading_role": 0
1189 // }
1190 //
1191 const response = await this.privateAccountGetDetail(params);
1192 const result = this.safeDict(response, 'key', {});
1193 this.options['unifiedAccount'] = this.safeInteger(result, 'mode') === 2;
1194 }
1195 catch (e) {
1196 // if the request fails, the unifiedAccount is disabled
1197 this.options['unifiedAccount'] = false;
1198 }
1199 }
1200 return this.options['unifiedAccount'];
1201 }
1202 async upgradeUnifiedTradeAccount(params = {}) {
1203 return await this.privateUnifiedPutUnifiedMode(params);
1204 }

Callers 15

fetchMarketsMethod · 0.95
fetchBalanceMethod · 0.95
fetchMyTradesMethod · 0.95
createOrderMethod · 0.95
createOrdersMethod · 0.95
editOrderMethod · 0.95
fetchOrderMethod · 0.95
fetchClosedOrdersMethod · 0.95
fetchOrdersByStatusMethod · 0.95
cancelOrderMethod · 0.95
cancelOrdersMethod · 0.95

Calls 4

safeBoolMethod · 0.45
safeDictMethod · 0.45
safeIntegerMethod · 0.45

Tested by

no test coverage detected