Code Duplication    Length = 31-31 lines in 4 locations

tests/test_tradehub_demex_client.py 4 locations

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