gowestyang/grandma-stock-valuation

Default date shown instead of the input date

Opened this issue · 1 comments

Existing EOD data file contains 20 rows over 20 dates from 2022-01-03 to 2022-01-31

Overview

Tried a different start and end date. Line 2 of printed result shows the default date. I'm quite not sure if this is how the date for line 2 would look like no matter what start or end date I input?

Code

from grandma_stock_valuation import YahooDataLoader

ticker = 'IVV'
yahoo = YahooDataLoader(ticker, date_start='2021-10-01', date_end_ex='2021-12-30', verbose=2)

df = yahoo.queryEOD(save=True, file_name=None)
print(df.head())

Output

IVV: Existing EOD data file found at __data__\IVV_EOD.csv.gz.
IVV: Existing EOD data file contains 20 rows over 20 dates from 2022-01-03 to 2022-01-31.
IVV: Queried EOD data contains 62 rows over 62 dates from 2021-10-01 to 2021-12-29.
IVV: Amended data file contains 82 rows over 82 dates from 2021-10-01 to 2022-01-31.
        date        open        high  ...       close   close_adj   volume
0 2021-10-01  432.700012  437.730011  ...  435.950012  434.568604  6783700
1 2021-10-04  434.690002  435.609985  ...  430.290009  428.926514  7911000
2 2021-10-05  431.970001  437.170013  ...  434.799988  433.422211  4738500
3 2021-10-06  430.980011  436.820007  ...  436.649994  435.266357  5125700
4 2021-10-07  440.130005  443.390015  ...  440.269989  438.874878  4110900

Hi, thanks for rising it up! The data loader tries to refresh existing data:

  • it first load the existing EOD data from the data file (2nd row, from 2022-01-03 to 2022-01-31)
  • then queries new data (3rd row, you queried 2021-10-01 to 2021-12-29)
  • then it removes the duplicated periods from the existing data, and add new queried data to get the refreshed data.
    (last row, 2021-10-01 to 2022-01-31 is the combined data)

I have updated detailed documentation and examples here: https://github.com/gowestyang/grandma-stock-valuation/tree/main/doc

Please also update to version 0.1.0 - with addition bug fix and new features :)