tedchou12 / webull

Unofficial APIs for Webull.
MIT License
597 stars 183 forks source link

500 Internal Server Error from alerts_add #261

Open BigDaddyBastonkadonkz opened 3 years ago

BigDaddyBastonkadonkz commented 3 years ago

Getting a 500 Internal Server Error when invoking alerts_add with the following exception:

Exception: ('alerts_add failed', 500, 'Internal Server Error')

Anyone encounter this?

alexonab commented 3 years ago

More code would be helpful to identify your issue. I just tested here and alerts are still working.

>>> priceRules = [{'field': 'price', 'type': 'above', 'value': '900.00', 'remark': 'above'}, {'field': 'price', 'type': 'below',
...          'value': '900.00', 'remark': 'below'}]
>>> smartRules = [{'type':'earnPre','active':'on'},{'type':'fastUp','active':'on'},{'type':'fastDown','active':'on'},
...         {'type':'week52Up','active':'on'},{'type':'week52Down','active':'on'},{'type':'day5Down','active':'on'}]
>>> wb.alerts_add('AAPL', priceRules=priceRules, smartRules=smartRules)
True
>>> wb.alerts_list()
[{'regionId': 6, 'tickerType': 2, 'tickerId': 913256135, 'tickerSymbol': 'AAPL', 'disSymbol': 'AAPL', 'tinyName': 'Apple', 'tickerName': 'Apple', 'exchangeCode': 'NSQ', 'showCode': 'NAS', 'disExchangeCode': 'NASDAQ', 'tickerWarning': {'tickerId': 913256135, 'tickerType': 2, 'warningFrequency': 1, 'bizTimestamp': 1630029896631, 'rules': [{'active': 'on', 'field': 'price', 'type': 'above', 'value': 900.0, 'remark': 'above'}, {'active': 'on', 'field': 'price', 'type': 'below', 'value': 900.0, 'remark': 'below'}], 'tickerSymbol': 'AAPL', 'exchangeCode': 'NSQ', 'del': False, 'showCode': 'NAS', 'disSymbol': 'AAPL', 'disExchangeCode': 'NASDAQ', 'updateTime': '2021-08-27T02:04:56.635+0000', 'regionId': 6, 'warningInterval': 1}, 'eventWarning': {'id': 1, 'userId': 'none;, 'tickerId': 913256135, 'tickerType': 2, 'exchangeId': 96, 'rules': [{'type': 'earnPre', 'active': 'on'}, {'type': 'fastUp', 'active': 'on'}, {'type': 'fastDown', 'active': 'on'}, {'type': 'week52Up', 'active': 'on'}, {'type': 'week52Down', 'active': 'on'}, {'type': 'day5Down', 'active': 'on'}], 'del': False, 'remove': False}}]
>>>
>>> wb.alerts_remove(wb.alerts_list()[0])
True
>>> wb.alerts_list()
[]
BigDaddyBastonkadonkz commented 3 years ago

Here's an example:

pr = [{'field': 'price', 'type': 'above', 'value': '57.00', 'remark': 'TEST21'}] result = wb.alerts_add('VZ', frequency=1, interval=1, priceRules=pr) print(result)

Traceback (most recent call last): File "/Users/**/Documents/Development/StonkTrader/StonkScreener/testOptPull.py", line 84, in result = wb.alerts_add('VZ', frequency=1, interval=1, priceRules=pr) File "/usr/local/lib/python3.9/site-packages/webull/webull.py", line 869, in alerts_add raise Exception('alerts_add failed', response.status_code, response.reason) Exception: ('alerts_add failed', 500, 'Internal Server Error')

Oddly enough, it adds the alert, but it also throws that error.

asam007s commented 2 years ago

I face another issue with setting Alert to Stock script. After setting Alert using Alerts_Add (...) API i am not able to get the Notification call back. I verified that the Alert is set successfully! But my question is : How do I get the notification if the Alert condition is met ?