-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.fetchLeverageTiers.js
33 lines (30 loc) · 1.04 KB
/
test.fetchLeverageTiers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use strict';
const assert = require ('assert')
, testLeverageTier = require ('./test.leverageTier.js')
module.exports = async (exchange, symbol) => {
const method = 'fetchLeverageTiers';
// const format = {
// 'RAY/USDT': [
// {},
// ],
// };
if (exchange.has[method]) {
const tiers = await exchange [method] ([ symbol ]);
const tierKeys = Object.keys (tiers);
const numTierKeys = tierKeys.length;
assert (numTierKeys >= 1);
console.log (method + 'for ' + numTierKeys + ' markets');
for (let i = 0; i < numTierKeys; i++) {
const tiersForSymbol = tiers [ tierKeys[i] ];
const arrayLength = tiersForSymbol.length;
assert (arrayLength >= 1);
for (let j=0; j < tiersForSymbol.length; j++) {
const tier = tiersForSymbol[j];
testLeverageTier (exchange, method, tier);
}
}
return tiers;
} else {
console.log (method + '() is not supported');
}
}