You are on page 1of 1

Create a class or function that can be imported into another program, preferably this should be

done with requests, and bs4, or, pandas pd.read_html functionality (for pd.read_html some sites
return forbidden 403, but with the requests library just modify the user agent). The code should
do the following which does the following.

For each company in the saudi stock exchange scrape the following information as shown in the
data frame on the lower left pane of the below figure. The results should be inserted into a
pandas dataframe with the following columns and this should be the return value of the
requested class or function main call.

● Open (Opening price for that day).


● High (Highest price for that day).
● Lowest (Lowest price for that day).
● Close (Closing price for that day).
● Volume.

The following parameters need to be adjusted: exchange_interval, example ‘1d’ for one day
historial collection, that means every day of the beginning of the search, something like a step of
1 day, so that if the programmer wants to have historical context of one out of every five days it
can be adjusted via this parameter. The date range will always be the maximum that the
scrapper can find, so maybe begin with records from 19xx if available of course, not all info is
available that far back like in the figure.

Here are some sources for scraping the requested data, but some might not contain most of it.
https://www.investing.com/equities/saudi-arabia
https://simplywall.st/markets/sa
https://english.mubasher.info/markets/TDWL

You might also like