Error if company doesn't have long enough history
- Dominant language
- Python
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
As a regular user, I try to get a stock report for a new company, and I get the included error. I expect to get a report of as much data as is available.
Error Log:
https://github.com/CyIC/warren/blob/7f11402bb50bf8bebeddb3ff7e145f3aef5fbcb8/src/warrenBot/stock_analysis.py#L51
```
[2023-07-26 21:19:12] [INFO ] discord: split_content: ['!sr', 'dkng']
[2023-07-26 21:19:15] [ERROR ] discord.client: Ignoring exception in on_message
Traceback (most recent call last):
File "D:\03Projects\cyicBot\venv\Lib\site-packages\discord\client.py", line 441, in _run_event
await coro(*args, **kwargs)
File "D:\03Projects\cyicBot\dchat.py", line 147, in on_message
await run_stock_report(message)
File "D:\03Projects\cyicBot\dchat.py", line 89, in run_stock_report
raise e
File "D:\03Projects\cyicBot\dchat.py", line 80, in run_stock_report
await stock_analysis.run(message, ticker, KEY)
File "d:\03projects\cyicbot\src\warrenBot\stock_analysis.py", line 873, in run
await utils.send_message_in_chunks(message.channel, past_sales_records(income_statement['annualReports']))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "d:\03projects\cyicbot\src\warrenBot\stock_analysis.py", line 51, in past_sales_records
recent_sales_trend = (sales_per_year[-1] + sales_per_year[-2]) / 2
~~~~~~~~~~~~~~^^^^
```
Contributor guide
Assessment
This issue has not been assessed yet.