Skip to content

Commit

Permalink
Merge pull request #24 from olned/hot-fix-0.14.1
Browse files Browse the repository at this point in the history
Hot fix 0.14.1
  • Loading branch information
olned authored Sep 18, 2020
2 parents 2cf5764 + 7b170aa commit f591cdf
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
26 changes: 26 additions & 0 deletions examples/deribit/check_is_connected.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import asyncio
import json
from ssc2ce import Deribit

conn = Deribit()

print("Is connected after init", conn.is_connected())


def close():
print("Check connection before closing", conn.is_connected())
asyncio.ensure_future(conn.stop())


loop = asyncio.get_event_loop()


loop.call_later(1, close)

try:
loop.run_until_complete(conn.run_receiver())
except KeyboardInterrupt:
print("Application closed by KeyboardInterrupt.")


print("Is connected before exit", conn.is_connected())
2 changes: 1 addition & 1 deletion examples/deribit/deribit_private.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async def do_something_after_login(self):
async def printer(self, **kwargs):
self.logger.info(f"{repr(kwargs)}")

@ staticmethod
@staticmethod
def resolve_route(value, routes):
key, handler = None, None
for key, handler in routes:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name='ssc2ce',
version="0.14.0",
version="0.14.1",
author='Oleg Nedbaylo',
author_email='[email protected]',
description='A Set of Simple Connectors for access To Cryptocurrency Exchanges',
Expand Down
6 changes: 6 additions & 0 deletions ssc2ce/common/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,9 @@ async def public_get(self, request_path, params=None):
async def stop(self):
await self.ws.close()
await self._session.close()

def is_connected(self) -> bool:
if self.ws is None:
return False

return not self.ws.closed
6 changes: 0 additions & 6 deletions ssc2ce/deribit/deribit.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@ def __init__(self,
def close(self):
super()._close()

async def stop(self):
"""
Close connection and break the receiver loop
:return:
"""
await self.ws.close()

async def send_public(self, request: dict, callback=None, logging_it: bool = True) -> int:
"""
Expand Down

0 comments on commit f591cdf

Please sign in to comment.