Skip to content

Commit

Permalink
Added getSupportedMapping removed this.omit array use
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan-krm committed Jan 29, 2022
1 parent e06512c commit 4cd36c1
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions js/huobi.js
Original file line number Diff line number Diff line change
Expand Up @@ -4485,23 +4485,17 @@ module.exports = class huobi extends Exchange {
async fetchFundingRates (symbols, params = {}) {
await this.loadMarkets ();
const options = this.safeValue (this.options, 'fetchFundingRates', {});
let method = undefined;
const defaultSubType = this.safeString (this.options, 'defaultSubType', 'inverse');
let subType = this.safeString (options, 'subType', defaultSubType);
subType = this.safeString (params, 'subType', subType);
const request = {
// 'contract_code': market['id'],
};
const linear = (subType === 'linear');
const inverse = (subType === 'inverse');
if (linear) {
method = 'contractPublicGetLinearSwapApiV1SwapBatchFundingRate';
} else if (inverse) {
method = 'contractPublicGetSwapApiV1SwapBatchFundingRate';
} else {
throw new NotSupported (this.id + ' fetchFundingRates() supports linear and inverse swaps only');
}
params = this.omit (params, [ 'subType' ]);
const method = this.getSupportedMapping (subType, {
'linear': 'contractPublicGetLinearSwapApiV1SwapBatchFundingRate',
'inverse': 'contractPublicGetSwapApiV1SwapBatchFundingRate',
});
params = this.omit (params, 'subType');
const response = await this[method] (this.extend (request, params));
//
// {
Expand Down

0 comments on commit 4cd36c1

Please sign in to comment.