Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #72 from jerrydboonstra/bugfix/issue-71-websocket-…
Browse files Browse the repository at this point in the history
…fetch

Patch for Issue #71: websockets fetch test is wrong, and displays an unhandled error in the code
  • Loading branch information
dextertd authored Dec 30, 2021
2 parents 0842528 + 8a755c8 commit 1628025
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions pybit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2045,8 +2045,7 @@ def fetch(self, topic):
topic = self.conform_topic(topic)
# If the topic given isn't in the initial subscribed list.
if topic not in self.subscriptions:
self.logger.error(f'You aren\'t subscribed to the {topic} topic.')
return
raise Exception(f"You aren\'t subscribed to the {topic} topic.")

# Pop all trade or execution data on each poll.
# don't pop order or stop_order data as we will lose valuable state
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pybit.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ class WebSocketTest(unittest.TestCase):
# A very simple test to ensure we're getting something from WS.
def test_websocket(self):
self.assertNotEqual(
ws.fetch(['instrument_info.100ms.BTCUSD']),
ws.fetch('instrument_info.100ms.BTCUSD'),
[]
)
)

0 comments on commit 1628025

Please sign in to comment.