Skip to content

Bug fix #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged

Conversation

gronastech
Copy link
Contributor

@gronastech gronastech commented Jan 16, 2021

PR Details

Description

Bug fix for:

unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py", line 1300, in create_websocket_uri
elif "!" in market:
UnboundLocalError: local variable 'market' referenced before assignment

added default empty values for market & channel

Related Issue

Motivation and Context

How Has This Been Tested

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the
    CONTRIBUTING
    document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py", line 1300, in create_websocket_uri
    elif "!" in market:
UnboundLocalError: local variable 'market' referenced before assignment
unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py", line 1300, in create_websocket_uri
    elif "!" in market:
UnboundLocalError: local variable 'market' referenced before assignment
Copy link
Member

@oliver-zehentleitner oliver-zehentleitner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @gronastech!

  1. How can I reproduce the error?
  2. Please dont change the version numbers! The last release has the version 1.28.0. As soon as a change is committed on github, it becomes 1.28.0.dev - only when a release is created, it becomes 1.29.0 or 1.28.1.

Best regards,
Oliver

@@ -27,7 +27,7 @@
# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
release = '1.28.0'
release = '1.28.1'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not change that! This is done during the build of the package!

Copy link
Contributor Author

@gronastech gronastech Jan 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @gronastech!

  1. How can I reproduce the error?

Best regards,
Oliver

Such issues appear when socket restart initiated (abnormal connection closed, etc - any reason). And at the same time markets was empty - without a subscription to exact trade pairs, just open depth channel.

You have typical issue across the code when you don't check that key exists in the dictionary and trying to open it directly.

The same issue appeared for !userData channel:
Exception in thread Thread-4:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/lordserenity/.local/lib/python3.8/site-packages/unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py", line 433, in _create_stream_thread
loop.run_until_complete(socket.start_socket())
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/home/lordserenity/.local/lib/python3.8/site-packages/unicorn_binance_websocket_api/unicorn_binance_websocket_api_socket.py", line 114, in start_socket
received_stream_data = self.unicorn_fy.binance_com_websocket(received_stream_data_json)
File "/home/lordserenity/.local/lib/python3.8/site-packages/unicorn_fy/unicorn_fy.py", line 85, in binance_com_websocket
return UnicornFy.binance_websocket(stream_data_json, exchange="binance.com", show_deprecated_warning=False)
File "/home/lordserenity/.local/lib/python3.8/site-packages/unicorn_fy/unicorn_fy.py", line 255, in binance_websocket
if stream_data['data']['e'] == 'aggTrade':
KeyError: 'data'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx

@@ -154,7 +154,7 @@ def __init__(self,
enable_stream_signal_buffer=False):
threading.Thread.__init__(self)
self.name = "unicorn-binance-websocket-api"
self.version = "1.28.0.dev"
self.version = "1.28.1.dev"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*.dev is the development stage. Only when we create a new package we update this and remove the "dev". You dont need to care about this! Its done during the build of the package!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you undo the version changes? Then I would merge this.

@oliver-zehentleitner
Copy link
Member

Any news?

@oliver-zehentleitner
Copy link
Member

Please do some conversation with me! I dont want to merge a PR if I have to fix something afterwards. So please remove the changes in unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py or I will close this.

Thanks and best regards,
Oliver

Copy link
Member

@oliver-zehentleitner oliver-zehentleitner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@oliver-zehentleitner oliver-zehentleitner merged commit df21077 into LUCIT-Systems-and-Development:master Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants