Nairobi Security Exchange (NSE) Kenya daily historical prices of all the stocks listed since 11 September 2006
This is a web crawler for Nairobi Security Exchange (NSE) Share prices since its digitization
on 11th September 2006 to 28th April 2022.
The data crawled can be found in the data
folder.
Setup
pip3 install -r requirements.txt
Data Format in the csv
Daily csv Format
Monthly , Yearly and Company csv Format
The data
folder has 4 folders inside:
Daily
folderMonthly
folderYearly
folderCompany
folderAll errors 404 errors for pages not found can be found in the errorlog
folder in the error.log
NB Unable to remove the following holidays as of now because they are dynamic
Eid al Adha (was gazetted in Kenya as of September 2016)
Eid Fitr
Usage
python3 getData.py
getData file
Set the following input
The script also does the following:
The script crawls the data given the start dates and end dates.
It gets data from [mystocks website](https://live.mystocks.co.ke/) , credits to them and saves them under the `data/daily/` folder.
It gets each company’s data from the daily csvs. It creates a csv for each company and saves the monthly share prices of that company. The data is stored in the data/monthly/
folder.
It gets each company’s data from the monthly csvs. It creates a csv for each company and saves the yearly share prices of that company. The data is stored in the data/yearly/
folder.
It gets each company’s data from the yearly csvs. It creates a csv for each company and saves the company’s share prices for the period specified. The data is stored in the data/company/
folder.