Nairobi Securities Exchange (NSE) Kenya - All Stocks Prices 2021

Published: 5 January 2022| Version 4 | DOI: 10.17632/97hkwn5y3x.4
Barack Wanjawa


This compilation of historical daily stock market price data relates to the Kenyan Nairobi Securities Exchange (NSE) for whole of year 2021. This data is valuable for any machine learning algorithm that needs data (training, validation, testing). This compilation develops on an earlier dataset (2008-2012) that was initially compiled as part of a research project to predict next day stock price, based on the previous five days, using Artificial Neural Networks (ANN). This initial research [1],[2] tested 6 stocks [3] using ANN of configuration 5:21:21:1. The data was then enhanced as a new compilation of all stocks in the period 2007-2012 [4]. Thereafter, the NSE dataset for 2013 to 2020 [5] was compiled followed by this compilation that now has the 2021 data (upto Dec.31). The method of data compilation has remained as it was originally, being data scrapping from a publicly accessible website [6] licensed by NSE. The processing involves exporting the raw web data to spreadsheets, then cleaning up, by removal of unnecessary data elements such as HTML tags and other graphics that cannot be converted to text. Just like the previous compilations, each stock data row has the 13 data columns (1) Date (2) Stock Code (3) Stock Name (4) 12-month Low price (5) 12-month High price (6) Day's Low price (7) Day's High price (8) Day's Final Price (9) Previous traded price (10) Change in price value (11) Change in price % (12) Volume traded (13) Adjusted price. An additional CSV file is provided to show market sector that each stock belongs to. The 3 column headings for this additional CSV are: (1) Market sector (2) Stock Code (3) Stock Name. With the addition of this new data compilation, researchers now have an even larger dataset (2007-2021) and even a bigger pool of stocks and their indices, since stocks keep being introduced (or even retired). Providing the market sector information also opens up additional opportunities for data analysis and usage in machine learning research. List of data files on this dataset: NSE_data_all_stocks_2021_upto_31dec2021.csv NSE_data_stock_market_sectors_2021.csv References: [1] Wanjawa, B. W. (2014). A Neural Network Model for Predicting Stock Market Prices at the Nairobi Securities Exchange (Dissertation, University of Nairobi). [2] Wanjawa, B. W., & Muchemi, L. (2014). ANN model to predict stock prices at stock exchange markets. arXiv preprint arXiv:1502.06434. [3] Wanjawa, Barack (2020), “Nairobi Securities Exchange Prices 2008-2012 for 6 selected stocks”, Mendeley Data, v3, [4] Wanjawa, Barack (2020), “Nairobi Securities Exchange All Stocks Prices 2007-2012”, Mendeley Data, v1, [5] Wanjawa, Barack (2021), “Nairobi Securities Exchange (NSE) All Stocks Prices 2013-2020”, Mendeley Data, V2, [6] Synergy Systems Ltd. (2020). MyStocks. Retrieved Dec 31, 2021, from



University of Nairobi College of Biological and Physical Sciences


Applied Sciences