BennyThadikaran / eod2

A fully automated script to download and update NSE EOD Historical stock, index and delivery data with added features
GNU General Public License v3.0
57 stars 18 forks source link

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

Closed cotton1234 closed 7 months ago

cotton1234 commented 7 months ago

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

BennyThadikaran commented 7 months ago

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

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.

cotton1234 commented 7 months ago

Fine Benny

cotton1234 commented 7 months ago

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