Open cschroeder23 opened 6 years ago
The same happens when adding GAS.
The issue is caused by the API calls to get the currency prices. In some cases the resulting JSON is parsed to strings, instead of floats. This causes a TypeError on the multiplication, because float * str is undefined.
KNC as well
To overcome this issue you will need to make sure the resulting JSON that is returned from the API contains only floats--and no strings. To achieve this, you will need to transform all of the strings in the array into floats before feeding them into other helper functions. The snippet below will help you achieve this task: val = list(map(float, val))
. Just place it on line 143 of your cryptop.py file, just after val
is defined. This little snippet will iterate over each item in the array and change its type to a float. This should fix the issue.
When adding VTC as a symbol, crashes with error:
Traceback (most recent call last): File "/home/user/environments/py3_crypto/bin/cryptop", line 11, in
load_entry_point('cryptop==0.2.0', 'console_scripts', 'cryptop')()
File "/home/user/environments/py3_crypto/lib/python3.6/site-packages/cryptop/cryptop.py", line 269, in main
curses.wrapper(mainc)
File "/usr/lib/python3.6/curses/init.py", line 94, in wrapper
return func(stdscr, *args, *kwds)
File "/home/user/environments/py3_crypto/lib/python3.6/site-packages/cryptop/cryptop.py", line 223, in mainc
write_scr(stdscr, wallet, y, x)
File "/home/user/environments/py3_crypto/lib/python3.6/site-packages/cryptop/cryptop.py", line 142, in write_scr
str_formatter(coin, val, held), x, curses.color_pair(2))
File "/home/user/environments/py3_crypto/lib/python3.6/site-packages/cryptop/cryptop.py", line 108, in str_formatter
val_str = '{:>{},.{}f}'.format(float(held) val[0], max_length, dec_place)
TypeError: can't multiply sequence by non-int of type 'float'