From 67d78e446241800e5f554d4f9680469494caed87 Mon Sep 17 00:00:00 2001 From: Fedor Soldatkin Date: Fri, 8 May 2020 12:11:31 +0300 Subject: [PATCH] Fix bug in ws_thread.py. Use future.utils.iteritems instead of iter(), add future to requirements. --- README.md | 2 +- requirements.txt | 3 ++- supervisor/__init__.py | 2 +- supervisor/core/ws_thread.py | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 170a732..0128edb 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This is a library-like application, which operates with orders and positions on your account. -*Current version:* **0.4** +*Current version:* **0.4.1** #### Features: * Creating an cancelling orders on your account. Stop-loss, Limit, passive, reduce-only, close-only, hidden orders supported. * Preventing these orders for being lost, cancelled or rejected: Supervisor will place them anew. diff --git a/requirements.txt b/requirements.txt index f9febe8..d125304 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,5 @@ idna==2.9 requests==2.23.0 six==1.14.0 urllib3==1.25.9 -websocket-client==0.56.0 \ No newline at end of file +websocket-client==0.56.0 +future==0.18.2 \ No newline at end of file diff --git a/supervisor/__init__.py b/supervisor/__init__.py index 72a6251..cb55bce 100644 --- a/supervisor/__init__.py +++ b/supervisor/__init__.py @@ -1,3 +1,3 @@ from supervisor._supervisor import * -__version__ = '0.4' +__version__ = '0.4.1' diff --git a/supervisor/core/ws_thread.py b/supervisor/core/ws_thread.py index 6b66f9a..a6e3571 100644 --- a/supervisor/core/ws_thread.py +++ b/supervisor/core/ws_thread.py @@ -11,6 +11,7 @@ from supervisor.core.utils.log import setup_custom_logger from supervisor.core.utils.math import toNearest from urllib.parse import urlparse, urlunparse +from future.utils import iteritems class BitMEXWebsocket: @@ -98,7 +99,7 @@ def get_ticker(self, symbol): } # The instrument has a tickSize. Use it to round values. - return {k: toNearest(float(v or 0), instrument['tickSize']) for k, v in iter(ticker)} + return {k: toNearest(float(v or 0), instrument['tickSize']) for k, v in iteritems(ticker)} def funds(self): return self.data['margin'][0]