From 445b4a7712fb7fe45e17b6b76356dd3be42dd900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sat, 24 Mar 2018 15:18:56 +0100 Subject: Move request wrapper to ccxt --- ccxt_wrapper.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ccxt_wrapper.py') diff --git a/ccxt_wrapper.py b/ccxt_wrapper.py index c500659..4ed37d9 100644 --- a/ccxt_wrapper.py +++ b/ccxt_wrapper.py @@ -37,6 +37,21 @@ class poloniexE(poloniex): else: return origin_request(path, **kwargs) + def __init__(self, *args, **kwargs): + super(poloniexE, self).__init__(*args, **kwargs) + + # For requests logging + self.session.origin_request = self.session.request + self.session._parent = self + + def request_wrap(self, *args, **kwargs): + r = self.origin_request(*args, **kwargs) + self._parent._market.report.log_http_request(args[0], + args[1], kwargs["data"], kwargs["headers"], r) + return r + self.session.request = request_wrap.__get__(self.session, + self.session.__class__) + @staticmethod def nanoseconds(): return int(time.time() * 1000000000) -- cgit v1.2.3