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

curses example #49

Closed DaWe35 closed 4 years ago

DaWe35 commented 4 years ago

Description

Discussed in #48

How Has This Been Tested

Tested on Win 10

Types of changes

Checklist

oliver-zehentleitner commented 4 years ago

I downloaded the example from your branch and get this error:

oliver@valkyrie ~/pyCharmProjects/unicorn-binance-websocket-api $ ./example_curses.py 
Traceback (most recent call last):
  File "./example_curses.py", line 121, in <module>
    wrapper(main)
  File "/opt/anaconda/anaconda/lib/python3.7/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "./example_curses.py", line 117, in main
    display.addstr(0, 0, summary)
_curses.error: addwstr() returned ERR

i run it in bash on linux mint. Are you able to run it on linux?

DaWe35 commented 4 years ago

I downloaded the example from your branch and get this error:

oliver@valkyrie ~/pyCharmProjects/unicorn-binance-websocket-api $ ./example_curses.py 
Traceback (most recent call last):
  File "./example_curses.py", line 121, in <module>
    wrapper(main)
  File "/opt/anaconda/anaconda/lib/python3.7/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "./example_curses.py", line 117, in main
    display.addstr(0, 0, summary)
_curses.error: addwstr() returned ERR

i run it in bash on linux mint. Are you able to run it on linux?

I think you get this error when the window size is too small. Can you retry in maximized window? I really don't know how to solve it... https://stackoverflow.com/questions/54409924/curses-error-addwstr-returned-err-on-changing-nlines-to-1-on-newwin-method

DaWe35 commented 4 years ago

Ok I have an idea

DaWe35 commented 4 years ago

Okay, now it works on small window

DaWe35 commented 4 years ago

I found another problem (besides the colors), curses just cut the last character of every line.

kép

DaWe35 commented 4 years ago

Okay, I'm getting a black screen with Ubuntu/Putty

oliver-zehentleitner commented 4 years ago

I have to read about curses, atm i have no knowledge about it. (https://docs.python.org/3/howto/curses.html)

  1. If last char gets removed, we can add one extra char at the end of every line that can get removed and will not be missed. But maybe there is a more elegant solution like a parameter (need reading the docs)
  2. I would try to make a new method like curses_summary() that can be used instead of print_summary()
  3. It must be stable without errors on windows and unix.

I dont know, do you want to do this together or do you like to try it your self?

oliver-zehentleitner commented 4 years ago

One more suggestion, can you create an example_curses.py file? If it works fine, we can update other example files.

DaWe35 commented 4 years ago

Okay, it needs more testing & doc reading, we found more bugs than I expected. I have to postpone the task until later, cause I have a lot of urgent work now.

oliver-zehentleitner commented 4 years ago

No worries! Lets make it uncomplicated, work on it as you like it and when its ready we merge it.

I am happy about your contributions! THANKS!