psx-data-reader
with psx-data-reader, you can scrape the data of Pakistan stock exchange. psx-data-reader is super easy to use and handles everything for you. Just specify which company's stock data you want and how much you want, and the rest is done for you.
Overview
The psx-data-reader was written with fast use in mind. It provides the following key features
- can scrape all historical data till current date
- can scrape data for of multiple companies in a single line of code
- returns a
Pandas DataFramefor the scraped data - for better download speed, It does not request the complete data in a single network request rather it makes chunks of data to be downloaded and uses threads to open requests for different chunks of data, hence results in better speed
In the following paragraphs, I am going to describe how you can get and use Scrapeasy for your own projects.
Installation
To get psx-data-reader, either fork this github repo or simply use Pypi via pip.
$ pip install psx-data-reader
Usage
First, import stocks and tickers from psx
from psx import stocks, tickers
to get the information of all the companies in Pakistan stock Exchange....
tickers = tickers()
to scrape the data of Silk Bank Limited we have pass its ticker (symbol) to the stocks method with proper start and end date. and it will return a DataFrame with the scraped data
data = stocks("SILK", start=datetime.date(2020, 1, 1), end=datetime.date.today())
we can also download the data of multiple companies in a single call to stocks method by passing a list or tuple of symbols
data = stocks(["SILK", "PACE"], start=datetime.date(2020, 1, 1), end=datetime.date.today())
and now the returned DataFrame object will have a hierarchical index on rows.
Author Info
Metadata
Release files for psx-data-reader 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| psx-data-reader-0.0.6.tar.gz | 6.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| psx_data_reader-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.2 kB
Release files / psx-data-reader-0.0.6.tar.gz
| Download URL | psx-data-reader-0.0.6.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4044bc9fc3defeeff33f0ffba2f378f54ea5c94388b141115776d2601bd52f94
|
|
BLAKE2b-256 checksum How to use checksums |
4c4c6c289ba0a4e57a1d8d878505250e33ecaf53131925859cd6d34026137484
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|
Release files / psx_data_reader-0.0.6-py3-none-any.whl
| Download URL | psx_data_reader-0.0.6-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42e1c06b670097131bbb73b2bccdd18d8816cfc51e0ec97c67e52b98812c26c6
|
|
BLAKE2b-256 checksum How to use checksums |
2b0adcc71661fc9f23e145e4a5d5cfb56e8e8ebbf027336ad60de6d6b809eb61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|