Skip to content
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

Update "outboundAccountPosition" not supported #11

Closed
3 of 11 tasks
bmschwartz opened this issue Aug 29, 2020 · 3 comments
Closed
3 of 11 tasks

Update "outboundAccountPosition" not supported #11

bmschwartz opened this issue Aug 29, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@bmschwartz
Copy link

bmschwartz commented Aug 29, 2020

Check this or we will delete your issue. (fill in the checkbox with an X like so: [x])

  • I have searched for other issues with the same problem or similar feature requests.

Select one:

  • Bug
  • Feature Request
  • Technical Help
  • Other

Environment

  • Are you using the module on a VPS or other Cloud hosting?
  • If so, have you tried running the code on your local machine?
  • Are you using the module on a Raspberry Pi?

Operating System? (include version)

  • macOS
  • Windows
  • Linux (include flavour)

Exact Python Version?

Python 3.8.5

Pip Version?

pip 20.1.1

Description of your issue

I found that unicorn_fy does not support the outboundAccountPosition socket update. The fix is pretty straightforward and I can create a PR or just use what I put in the comments here

Traceback (most recent call last):
  File "/Users/bschwartz/.pyenv/versions/3.8.5/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/Users/bschwartz/.pyenv/versions/3.8.5/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "./project/exchange_account.py", line 23, in print_stream_data_from_stream_buffer
    stream_data = UnicornFy.binance_com_websocket(received_stream_data_json)
  File "/.../venv/lib/python3.8/site-packages/unicorn_fy/unicorn_fy.py", line 125, in binance_com_websocket
    return UnicornFy.binance_websocket(stream_data_json, exchange="binance.com", show_deprecated_warning=False)
  File "/.../venv/lib/python3.8/site-packages/unicorn_fy/unicorn_fy.py", line 246, in binance_websocket
    if stream_data['data']['e'] == 'aggTrade':
KeyError: 'data'

Fix

In unicorn_fy/unicorn_fy.py

On line 204 beneath the executionReport block

elif stream_data['e'] == 'outboundAccountPosition':
    stream_data = {'data': stream_data}

On line 441 beneath the outboundAccountInfo block:

elif stream_data['data']['e'] == 'outboundAccountPosition':
    unicorn_fied_data = {'stream_type': '!userData@arr',
                            'event_type': stream_data['data']['e'],
                            'event_time': stream_data['data']['E'],
                            'last_update_time': stream_data['data']['u'],
                            'balances': []}
    for item in stream_data['data']['B']:
        new_item = {'asset': item['a'],
                    'free': item['f'],
                    'locked': item['l']}
        unicorn_fied_data['balances'] += [new_item]
@bmschwartz bmschwartz added the bug Something isn't working label Aug 29, 2020
@CryptoFuturesAU
Copy link

When will this be available in the main package? Thank you

@oliver-zehentleitner
Copy link
Member

@bmschwartz
Thanks you very much!

@oliver-zehentleitner
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants