Passed
Pull Request — main (#42)
by Switcheolytics
55s
created

tests.test_tradehub_get_markets   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 41
dl 0
loc 52
rs 10
c 0
b 0
f 0
wmc 3
1
from tests import APITestCase, mainnet_client
2
3
4
class TestTradeHubGetMarkets(APITestCase):
5
6
    def setUp(self) -> None:
7
        self._client = mainnet_client
8
9
    def test_get_markets_structure(self):
10
        """
11
        Check if response match expected dict structure.
12
        :return:
13
        """
14
        expect: dict = {
15
            "type": str,
16
            "name": str,
17
            "display_name": str,
18
            "description": str,
19
            "market_type": str,
20
            "base": str,
21
            "base_name": str,
22
            "base_precision": int,
23
            "quote": str,
24
            "quote_name": str,
25
            "quote_precision": int,
26
            "lot_size": str,
27
            "tick_size": str,
28
            "min_quantity": str,
29
            "maker_fee": str,
30
            "taker_fee": str,
31
            "risk_step_size": str,
32
            "initial_margin_base": str,
33
            "initial_margin_step": str,
34
            "maintenance_margin_ratio": str,
35
            "max_liquidation_order_ticket": str,
36
            "max_liquidation_order_duration": int,
37
            "impact_size": str,
38
            "mark_price_band": int,
39
            "last_price_protected_band": int,
40
            "index_oracle_id": str,
41
            "expiry_time": str,
42
            "is_active": bool,
43
            "is_settled": bool,
44
            "closed_block_height": int,
45
            "created_block_height": int
46
        }
47
48
        result: list = self._client.get_markets()
49
50
        for market in result:
51
            self.assertDictStructure(expect, market)
52