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
70 stars 24 forks source link

Error downloading data when import to Amibroker flag is set to True #116

Closed Prady04 closed 8 months ago

Prady04 commented 8 months ago

Always reproducible. There is no issue with the flag set to False. If I rerun the program, it works fine and will fail for the next date.

Following is the log.

Downloading Files Starting Data Sync Converting to AmiBroker format EOD sync complete.

Nifty PE at 22.81

Index sync complete. Makings adjustments for splits and bonus Error while making adjustments. TypeError('cannot do positional indexing on DatetimeIndex with these indexers [[False False False ... False False True]] of type ndarray') All adjustments have been discarded. Rolling back changes from 2024-03-22: src\eod2_data\daily

BennyThadikaran commented 8 months ago

From your log, it looks like one of the files in src/eod2_data/daily is corrupted. Adjustments are not made for amibroker files.

  1. Run py init.py -v to check the version you're running.
  2. Also run src/defs/diagnostic.py and let me know the output. It will check for common errors in the stock data files in daily folder

Meanwhile i'll try and run with amibroker set to True. See if i encounter any issues at my end.

BennyThadikaran commented 8 months ago

I downloaded a fresh copy of EOD2 and used the below user.json. Data was last updated till 21st March 2024.

{
  "AMIBROKER": true,
  "AMI_UPDATE_DAYS": 30 
}

I then ran init.py with the below result. There was a ChunkedEncodingError on my first attempt fetching last 30 days amibroker data. I'll add some error handling in an upcoming update. That was unrelated to this issue.

Fetching bhavcopy for last 30 days and converting to AmiBroker format.
This is a one time process. It will take a few minutes.
100 %
Done
Downloading Files
Starting Data Sync
Converting to AmiBroker format
EOD sync complete
### Nifty PE at 22.81 ###
Index sync complete.
Makings adjustments for splits and bonus
REFEX: face value split (sub-division) - from rs 10/- per share to rs 2/- per share
Cleaning up files
0 files deleted
22 Mar 2024: Done
----------------------------------------------------
All Up To Date. Check again after 7pm for today's EOD data

Please do run the scripts as mentioned in my previous comment. That should confirm the cause of the error.

Else i can backtrack the data a few more days and run init.py to be sure its all working well

Prady04 commented 8 months ago

Version: EOD2 init.py: version 5.1.6 Diagnostic: Duplicate entries 20MICRONS.CSV 21STCENMGM.CSV 360ONE.CSV 3IINFOLTD.CSV 3MINDIA.CSV

Based on the diagnosis data, i deleted all the previously downloaded csv files and it worked fine without any error py src/init.py
Fetching bhavcopy for last 260 days and converting to AmiBroker format. This is a one time process. It will take a few minutes. 100 % Done All Up To Date. Check again after 7pm for today's EOD data

Prady04 commented 8 months ago

closing - details in previous comment

BennyThadikaran commented 8 months ago

Just make sure you got it correct. If you deleted the daily folder and run init.py. It will only sync from the last updated date. The daily files will only have last few days data.

You can follow the update instruction in wiki installation. This will remove the need to redownload the repo.

Anyways thanks for raising the issue and let me know if you need any further help. :smiley:

Prady04 commented 8 months ago

Thank you. I followed the wiki page.