mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-29 19:44:23 +01:00
Merge pull request #180 from itsdeka/marketorders
added support for py 3.9 and 3.10
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
1.2.7
|
||||
-) Added ws support for Python 3.9 and 3.10
|
||||
|
||||
1.2.6
|
||||
-) Updated websockets to 9.1
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import pytest
|
||||
import json
|
||||
import asyncio
|
||||
from .helpers import (create_stubbed_client, ws_publish_connection_init, EventWatcher)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
This module contains the current version of the bfxapi lib
|
||||
"""
|
||||
|
||||
__version__ = '1.2.6'
|
||||
__version__ = '1.2.7'
|
||||
|
||||
@@ -266,7 +266,7 @@ class BfxWebsocket(GenericWebsocket):
|
||||
socketId,
|
||||
ERRORS[data.get('code', 10000)],
|
||||
data.get("msg", ""))
|
||||
self._emit('error', err_string)
|
||||
self._emit(Exception(err_string))
|
||||
|
||||
async def _system_auth_handler(self, socketId, data):
|
||||
if data.get('status') == 'FAILED':
|
||||
|
||||
@@ -44,7 +44,7 @@ class Socket():
|
||||
|
||||
def set_authenticated(self):
|
||||
self.isAuthenticated = True
|
||||
|
||||
|
||||
def set_unauthenticated(self):
|
||||
self.isAuthenticated = False
|
||||
|
||||
@@ -84,6 +84,8 @@ class GenericWebsocket:
|
||||
thread and connection.
|
||||
"""
|
||||
self._start_new_socket()
|
||||
while True:
|
||||
time.sleep(1)
|
||||
|
||||
def get_task_executable(self):
|
||||
"""
|
||||
@@ -91,14 +93,14 @@ class GenericWebsocket:
|
||||
"""
|
||||
return self._run_socket()
|
||||
|
||||
def _start_new_async_socket(self):
|
||||
loop = asyncio.new_event_loop()
|
||||
loop.run_until_complete(self._run_socket())
|
||||
|
||||
def _start_new_socket(self, socketId=None):
|
||||
if not socketId:
|
||||
socketId = len(self.sockets)
|
||||
def start_loop(loop):
|
||||
asyncio.set_event_loop(loop)
|
||||
loop.run_until_complete(self._run_socket())
|
||||
worker_loop = asyncio.new_event_loop()
|
||||
worker = Thread(target=start_loop, args=(worker_loop,))
|
||||
worker = Thread(target=self._start_new_async_socket)
|
||||
worker.start()
|
||||
return socketId
|
||||
|
||||
@@ -190,6 +192,8 @@ class GenericWebsocket:
|
||||
self.events.once(event, func)
|
||||
|
||||
def _emit(self, event, *args, **kwargs):
|
||||
if type(event) == Exception:
|
||||
self.logger.error(event)
|
||||
self.events.emit(event, *args, **kwargs)
|
||||
|
||||
async def on_error(self, error):
|
||||
|
||||
@@ -5,4 +5,4 @@ pytest-asyncio==0.15.1
|
||||
six==1.12.0
|
||||
pyee==8.0.1
|
||||
aiohttp==3.4.4
|
||||
isort==4.3.21
|
||||
isort==4.3.21
|
||||
2
setup.py
2
setup.py
@@ -11,7 +11,7 @@ from os import path
|
||||
here = path.abspath(path.dirname(__file__))
|
||||
setup(
|
||||
name='bitfinex-api-py',
|
||||
version='1.2.6',
|
||||
version='1.2.7',
|
||||
description='Official Bitfinex Python API',
|
||||
long_description='A Python reference implementation of the Bitfinex API for both REST and websocket interaction',
|
||||
long_description_content_type='text/markdown',
|
||||
|
||||
Reference in New Issue
Block a user