LUCIT-Systems-and-Development / unicorn-binance-websocket-api

A Python SDK by LUCIT to use the Binance Websocket API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet) in a simple, fast, flexible, robust and fully-featured way.
https://unicorn-binance-websocket-api.docs.lucit.tech/
Other
683 stars 164 forks source link

CPU friendly alternative to print_summary() every second / Interactive console #62

Closed oliver-zehentleitner closed 4 years ago

oliver-zehentleitner commented 4 years ago

Is your feature request related to a problem? Please describe. print_summary() needs some CPU power and calling it every second even not needed is a waste of cpu power on small servers.

Having a interactive console with short commands that get suggested on writing and selectable via tab could be a nice way to interact with the websocket lib.

Describe the solution you'd like A method to call instead of print_summary() and its waiting for an console input. Here it should be possible so write a short command like help and show which triggers one output of print_summary(). This could be some kind of interactive console with much more commands added later and some kind of code hinting and a list of stream_ids to choose comfortable.

Describe alternatives you've considered

Additional context

oliver-zehentleitner commented 4 years ago

A very nice alternative is iPython!

Install it via pip: python3 -m pip install jupyter --upgrade

And run example_interactive_mode.

Wait a few seconds and then type "ubwa." and press tab tab ...

All you need to active this shell is this code in your file:

import IPython
...
IPython.embed()

Its even possible to create a webinterface easily and submit commands: http://ipython.org/ipython-doc/stable/notebook/public_server.html

More Infos: https://ipython.org/ipython-doc/stable/interactive/reference.html#embedding

oliver-zehentleitner commented 4 years ago

I added some methods for a better experience in iPython: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/issues/60#issuecomment-625549948

oliver-zehentleitner commented 4 years ago

Some things are not working as expected and need modifications. If you find methods that need modifications please open a new issue.