Пример #1
0
    def test_pong(self, qtbot):
        client = BitmexWsClient(test=True,
                                api_key=api_key,
                                api_secret=api_secret)
        with qtbot.waitSignal(client.sig_message, timeout=10000) as blocking:
            client.start()

        assert blocking.signal_triggered

        connected = client.json()
        assert type(connected) == dict
        assert 'info' in connected
        assert 'version' in connected
        assert 'timestamp' in connected
        assert 'docs' in connected
        assert 'limit' in connected

        with qtbot.waitSignal(client.sig_message, timeout=10000) as blocking:
            client.ping()

        assert blocking.signal_triggered
        assert type(client.data()) == str
        assert client.data() == 'pong'
Пример #2
0
    def test_data(self, qtbot):
        client = BitmexWsClient(test=True,
                                api_key=api_key,
                                api_secret=api_secret)
        with qtbot.waitSignal(client.sig_message, timeout=10000) as blocking:
            client.start()

        assert blocking.signal_triggered

        connected = client.json()
        assert type(connected) == dict
        assert 'info' in connected
        assert 'version' in connected
        assert 'timestamp' in connected
        assert 'docs' in connected
        assert 'limit' in connected

        with qtbot.waitSignal(client.sig_message, timeout=10000) as blocking:
            client.send({"op": "subscribe", "args": ["trade:XBTUSD"]})

        assert blocking.signal_triggered

        print(client.data())
Пример #3
0
    def test_connect(self, qtbot):
        client = BitmexWsClient(test=True,
                                api_key=api_key,
                                api_secret=api_secret)

        with qtbot.waitSignals([client.sig_message],
                               order="strict",
                               timeout=10000) as blocking:
            client.start()

        assert blocking.signal_triggered

        data = client.data()
        assert type(data) == str

        data = client.json()
        assert type(data) == dict
        assert 'info' in data
        assert 'version' in data
        assert 'timestamp' in data
        assert 'docs' in data
        assert 'limit' in data
        client.close()