Пример #1
0
    def test_strip_message(self):
        bitmex = bitws.BitWs()

        d = json.loads(data.trade_data_long)

        result = bitmex.strip_trade_message(d)
        print(result)
Пример #2
0
    def test_time_sec(self):
        bitmex = bitws.BitWs()
        iso_string = "2019-01-12T15:12:51.313Z"
        sec = time_sec(iso_string)

        iso_string2 = "2019-01-12T15:12:01.313Z"
        sec2 = time_sec(iso_string2)

        assert (sec == sec2 + 50)
Пример #3
0
    def test_ws_decode_encode(self):
        bitmex = bitws.BitWs()

        encodeline = encoder.encode(data.line)
        decodeline = encoder.decode(encodeline)

        print(encodeline)

        print("\n")

        print(decodeline)

        self.assertEqual(data.line, decodeline, "decode error")
Пример #4
0
    def test_ws_mesage_append(self):
        bitmex = bitws.BitWs()

        bitmex.on_message(None, data.line2)
        #        bitmex.dump_message()

        #        time.sleep(2)

        bitmex.on_message(None, data.line2)

        #        time.sleep(2)
        bitmex.on_message(None, data.line2)

        #        bitmex.dump_message()
        bitmex.on_message(None, data.line3)

        bitmex.on_message(None, data.line2)
        bitmex.on_message(None, data.line2)

        bitmex.dump_message()
Пример #5
0
    def test_ws_connect(self):
        bitmex = bitws.BitWs()
        #        bitmex.start()

        pass
Пример #6
0
 def test_ws_process_ID(self):
     bitmex = bitws.BitWs()
Пример #7
0
    def test_ws_check_flag2(self):
        bitmex = bitws.BitWs()

        bitmex.create_terminate_flag()
        if (bitmex.check_terminate_flag()):
            print("terminate flag ok")
Пример #8
0
 def test_ws_create_flag(self):
     bitmex = bitws.BitWs()
     bitmex.create_terminate_flag()