BennyThadikaran/eod2

Error Coming in Making Adjustments - KeyError(datetime.datetime(2024,1,25,0,0)

cotton1234 opened this issue · 3 comments

Hello Benny,

Today while syncing error is coming.
Error:

saurabhgarg@MacBook-Pro src % python3 --version
Python 3.9.6
saurabhgarg@MacBook-Pro src % python3 init.py
sh: color: command not found
Downloading Files
Starting Data Sync
EOD sync complete
Index sync complete.
Makings adjustments for splits and bonus
Error while making adjustments. KeyError(datetime.datetime(2024, 1, 25, 0, 0))
All adjustments have been discarded.
Rolling back changes from 2024-01-25: /Users/saurabhgarg/shivshakti/eod2/src/eod2_data/daily
Rollback successful
saurabhgarg@MacBook-Pro src %

Can you pls check your repo.

Thanks
Saurabh

Hi Saurabh, Thanks for taking the time. I have the same issue on my side, looking into it. 😌

Issue was caused by Dolphin stock. There was no trading on the stock today, so it was not included in today bhavcopy.
When making adjustments, i split the file by todays date, to make adjustments to the rest of the data. That caused the KeyError, since today was not updated.

Solution is to add a check if the date exists before proceeding. That should resolve any future issues. I will update the repo in some time.

Fine Benny

Pulled the new code and its working fine now.
Thanks Benny.