Code Duplication    Length = 29-29 lines in 4 locations

tests/test_tradehub_demex_client.py 4 locations

@@ 205-233 (lines=29) @@
202
        result: dict = self.demex_client.stop_market_buy(pair=pair, quantity='400', stop_price=stop_price)
203
        self.assertDictStructure(expect, result)
204
205
    def test_stop_market_sell(self):
206
        expect: dict = {
207
            'height': str,
208
            'txhash': str,
209
            'raw_log': str,
210
            'logs': [{
211
                'msg_index': int,
212
                'log': str,
213
                'events': [{
214
                    'type': str,
215
                    'attributes': [{
216
                        'key': str,
217
                        'value': str
218
                    }, {
219
                        'key': str,
220
                        'value': str
221
                    }]
222
                }]
223
            }],
224
            'gas_wanted': str,
225
            'gas_used': str
226
        }
227
228
        pair = 'swth_eth'
229
        current_price = self.demex_client.tradehub.get_prices(market=pair)["last"]
230
        stop_price = "{:10.8f}".format(float(current_price) - 0.000001)
231
232
        result: dict = self.demex_client.stop_market_sell(pair=pair, quantity='400', stop_price=stop_price)
233
        self.assertDictStructure(expect, result)
234
235
    def test_cancel_order(self):
236
        expect: dict = {
@@ 175-203 (lines=29) @@
172
        result: dict = self.demex_client.stop_limit_sell(pair=pair, quantity='400', price='0.0000227', stop_price=stop_price)
173
        self.assertDictStructure(expect, result)
174
175
    def test_stop_market_buy(self):
176
        expect: dict = {
177
            'height': str,
178
            'txhash': str,
179
            'raw_log': str,
180
            'logs': [{
181
                'msg_index': int,
182
                'log': str,
183
                'events': [{
184
                    'type': str,
185
                    'attributes': [{
186
                        'key': str,
187
                        'value': str
188
                    }, {
189
                        'key': str,
190
                        'value': str
191
                    }]
192
                }]
193
            }],
194
            'gas_wanted': str,
195
            'gas_used': str
196
        }
197
198
        pair = 'swth_eth'
199
        current_price = self.demex_client.tradehub.get_prices(market=pair)["last"]
200
        stop_price = "{:10.8f}".format(float(current_price) + 0.000001)
201
202
        result: dict = self.demex_client.stop_market_buy(pair=pair, quantity='400', stop_price=stop_price)
203
        self.assertDictStructure(expect, result)
204
205
    def test_stop_market_sell(self):
206
        expect: dict = {
@@ 145-173 (lines=29) @@
142
        result: dict = self.demex_client.stop_limit_buy(pair=pair, quantity='400', price='0.0000091', stop_price=stop_price)
143
        self.assertDictStructure(expect, result)
144
145
    def test_stop_limit_sell(self):
146
        expect: dict = {
147
            'height': str,
148
            'txhash': str,
149
            'raw_log': str,
150
            'logs': [{
151
                'msg_index': int,
152
                'log': str,
153
                'events': [{
154
                    'type': str,
155
                    'attributes': [{
156
                        'key': str,
157
                        'value': str
158
                    }, {
159
                        'key': str,
160
                        'value': str
161
                    }]
162
                }]
163
            }],
164
            'gas_wanted': str,
165
            'gas_used': str
166
        }
167
168
        pair = 'swth_eth'
169
        current_price = self.demex_client.tradehub.get_prices(market=pair)["last"]
170
        stop_price = "{:10.8f}".format(float(current_price) - 0.000001)
171
172
        result: dict = self.demex_client.stop_limit_sell(pair=pair, quantity='400', price='0.0000227', stop_price=stop_price)
173
        self.assertDictStructure(expect, result)
174
175
    def test_stop_market_buy(self):
176
        expect: dict = {
@@ 115-143 (lines=29) @@
112
        result: dict = self.demex_client.market_sell(pair='swth_eth', quantity='400')
113
        self.assertDictStructure(expect, result)
114
115
    def test_stop_limit_buy(self):
116
        expect: dict = {
117
            'height': str,
118
            'txhash': str,
119
            'raw_log': str,
120
            'logs': [{
121
                'msg_index': int,
122
                'log': str,
123
                'events': [{
124
                    'type': str,
125
                    'attributes': [{
126
                        'key': str,
127
                        'value': str
128
                    }, {
129
                        'key': str,
130
                        'value': str
131
                    }]
132
                }]
133
            }],
134
            'gas_wanted': str,
135
            'gas_used': str
136
        }
137
138
        pair = 'swth_eth'
139
        current_price = self.demex_client.tradehub.get_prices(market=pair)["last"]
140
        stop_price = "{:10.8f}".format(float(current_price) + 0.000001)
141
142
        result: dict = self.demex_client.stop_limit_buy(pair=pair, quantity='400', price='0.0000091', stop_price=stop_price)
143
        self.assertDictStructure(expect, result)
144
145
    def test_stop_limit_sell(self):
146
        expect: dict = {