Closed patrick-hovsepian closed 3 years ago
@ConradSelig if you want to merge #30 first that would be great and reduce the number of changes in this PR otherwise those changes are carried over here in addition to the call outs in the description
planning on refactoring the renderer and table printing next to make it more configurable
I havn't dived too deep into this one - but I like what I see a lot. Just need to fix the conflicts and I'll accept.
@ConradSelig conflicts resolved
Everything looks great - I love that refractored portfolio.py.
I've got one bug for you to patch before I pull. When you only have one stock in portfolio.ini you get a whole stack of errors. Here is the stack trace:
Traceback (most recent call last):
File "pandas/_libs/tslibs/conversion.pyx", line 639, in pandas._libs.tslibs.conversion._convert_str_to_tsobject
File "pandas/_libs/tslibs/parsing.pyx", line 222, in pandas._libs.tslibs.parsing.parse_datetime_string
ValueError: Given date string not likely a datetime.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/cselig/.local/lib/python3.9/site-packages/pandas/core/indexes/datetimes.py", line 664, in get_loc
key = self._maybe_cast_for_get_loc(key)
File "/home/cselig/.local/lib/python3.9/site-packages/pandas/core/indexes/datetimes.py", line 692, in _maybe_cast_for_get_loc
key = Timestamp(key)
File "pandas/_libs/tslibs/timestamps.pyx", line 1095, in pandas._libs.tslibs.timestamps.Timestamp.__new__
File "pandas/_libs/tslibs/conversion.pyx", line 398, in pandas._libs.tslibs.conversion.convert_to_tsobject
File "pandas/_libs/tslibs/conversion.pyx", line 642, in pandas._libs.tslibs.conversion._convert_str_to_tsobject
ValueError: could not convert string to Timestamp
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/cselig/Programming/Python/cliStocksTracker/cliStocksTracker.py", line 135, in <module>
main()
File "/home/cselig/Programming/Python/cliStocksTracker/cliStocksTracker.py", line 53, in main
portfolio.populate(stocks_config, args)
File "/home/cselig/Programming/Python/cliStocksTracker/portfolio.py", line 139, in populate
print(market_data[data_key][ticker])
File "/home/cselig/.local/lib/python3.9/site-packages/pandas/core/series.py", line 853, in __getitem__
return self._get_value(key)
File "/home/cselig/.local/lib/python3.9/site-packages/pandas/core/series.py", line 961, in _get_value
loc = self.index.get_loc(label)
File "/home/cselig/.local/lib/python3.9/site-packages/pandas/core/indexes/datetimes.py", line 666, in get_loc
raise KeyError(key) from err
KeyError: 'p'
@ConradSelig added a temp workaround to the single stock issue - have a couple other things in the pipeline so if you or someone else wants to come up with something more robust or create an issue to track it that would be great
I'll create a ticket for it. Thanks for the patch.
Great work on this one.