BVCscrap
BVCscrap is a Python library to retrieve data from LeBoursier.ma, which provides data retrieval from up to 74 stocks. BVCscrap allows the user to download historical and intraday data from all the shares traded at Casablanca Stock Exchange.
Requirements
In order to use BVCscrap you should download the following packages: requests, beautifulsoup4, lxml, json, and datetime.
The outputs of this library are DataFrames, so Pandas should be installed
Installation
pip install BVCscrap
import BVCscrap as load
Usage
To use this libary there is a notation to respect: names of stocks.
Get the notation
import BVCscrap as load
load.notation()
['Addoha',
'AFMA',
'Afric Indus',
'Afriquia Gaz',
'Agma',
'Alliances',
'Aluminium Maroc',
'ATLANTASANAD',
'Attijariwafa',
Data of one single stock
To get data from date 0 (The data is provided from Septembre 2016)
import BVCscrap as load
data=load.loadata('BCP')
data.tail()
Value Low High Variation(%) Volume
date
22/09/2021 271.00 269.60 271.00 0.00 52908
23/09/2021 272.60 271.00 273.00 0.59 37230
24/09/2021 276.00 271.00 278.00 1.25 162109
27/09/2021 275.00 272.05 276.95 -0.36 51533
28/09/2021 276.05 272.70 276.05 0.38 17676
You can get data between two periods :
data=load.loadata('CIH',start='2018-01-01',end='2019-01-01')
data
Value Low High Variation (%) Volume
date
02/01/2018 278.0 278.00 279.5 -2.80 312
03/01/2018 278.0 278.00 279.5 0.00 312
... ... ... ... ... ...
28/12/2018 294.0 294.00 301.0 -2.00 211865
31/12/2018 300.0 300.00 300.0 2.04 12
Data of many stocks
import BVCscrap as load
load.loadmany('BCP','CIH')
data.tail()
BCP CIH
22/09/2021 271.00 301.0
23/09/2021 272.60 305.0
24/09/2021 276.00 313.0
27/09/2021 275.00 310.0
28/09/2021 276.05 305.8
You can use start and end arguments :
load.loadmany('BCP','CIH',start='2018-01-01',end='2019-01-01')
data.tail()
BCP CIH
date
02/01/2018 293.0 278.0
03/01/2018 289.9 278.0
04/01/2018 285.3 280.8
05/01/2018 283.0 280.8
08/01/2018 285.4 280.8
... ... ...
25/12/2018 279.0 294.2
26/12/2018 277.0 296.0
27/12/2018 279.9 300.0
28/12/2018 280.0 294.0
31/12/2018 280.0 300.0
Intraday data
import BVCscrap as load
data=load.getIntraday('MASI')
data
Value
09:30 12899.66
09:31 12900.10
09:32 12900.60
09:34 12900.45
09:35 12901.24
... ...
15:12 12975.64
15:14 12976.79
15:17 12976.69
15:18 12978.58
15:30 13019.20
Getting Help
If you are working in Jupyter notebook/lab, you can see the docstring of our functions by using Shift+Tab. An example is shown below
"""
Load Data
Inputs:
Input | Type | Description
=================================================================================
name |string | You must respect the notation. To see the notation see BVCscrap.notation
start |string "YYYY-MM-DD" | starting date Must respect the notation
end |string "YYYY-MM-DD" | Must respect the notation
Outputs:
Output | Type | Description
=================================================================================
| pandas.DataFrame (4 columns) | close high low open vol
"""
Metadata
Release files for BVCscrap 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| BVCscrap-0.1.3.tar.gz | 6.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| BVCscrap-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.8 kB
Release files / BVCscrap-0.1.3.tar.gz
| Download URL | BVCscrap-0.1.3.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d1a61f0036b78776d6a080f767cb0a54cb5e31003e910fc01fa365b57d24466
|
|
BLAKE2b-256 checksum How to use checksums |
4a82063ec5fba7f2f9efafe36e9645d94fa848488834c38ae88a821202561619
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.5
|
Release files / BVCscrap-0.1.3-py3-none-any.whl
| Download URL | BVCscrap-0.1.3-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6917612d69146a8e6cea1da89321327627c343c066c7c8a2fbecae894d3de723
|
|
BLAKE2b-256 checksum How to use checksums |
5c42c2f7abdf4c19a8eab534d4eb46be32286d3ee9083c7de59bf61fef4502c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.5
|
Security for BVCscrap 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.