pytr icon indicating copy to clipboard operation
pytr copied to clipboard

get_price_alarm: TypeError: unsupported operand types

Open miry opened this issue 2 years ago • 0 comments

Description of the bug A clear and concise description of what the bug is.

Error log

$ pytr -v debug get_price_alarms

...
ISIN         status created  target diff% createdAt        triggeredAT
Traceback (most recent call last):
  File "/Users/miry/src/marzzzello/pytr/pytr/main.py", line 229, in <module>
    main()
  File "/Users/miry/src/marzzzello/pytr/pytr/main.py", line 213, in main
    Alarms(login(phone_no=args.phone_no, pin=args.pin, web=not args.applogin)).get()
  File "/opt/homebrew/lib/python3.11/site-packages/pytr/alarms.py", line 64, in get
    self.overview()
  File "/opt/homebrew/lib/python3.11/site-packages/pytr/alarms.py", line 54, in overview
    diffP = (a['targetPrice'] / a['createdPrice']) * 100 - 100
             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for /: 'str' and 'str'

Environment

  • OS: MacOS
  • pytr version: 0.1.9

Solution

Add logger to alarms. Convert alarms fields from string to float.

miry avatar Nov 01 '23 12:11 miry