Skip to main content

A Python library for downloading stock market data of Dhaka Stock Exchange(DSE) and Chittagong Stock Exchange(CSE).

Project description

Description

This is a Python library based on beautifulsoup4, pandas & mplfinance.
You may use it to download price history and fundamental information of companies from Dhaka Stock Exchange and Chittagong Stock Exchange.
This can assist you to create further analyses based on fundamental and price history data.
Also create Candlestick charts to analyse the price history of stocks using this easy-to-use wrapper for mplfinance.

Installation

pip install stocksurferbd

Usage

Downloading historical price data of a single stock-

from stocksurferbd import PriceData

loader = PriceData()

loader.save_history_data(symbol='ACI', file_name='ACI_history.xlsx', market='DSE')

The above code will create a file named- ACI_history.xlsx. It'll contain historical price data for ACI Limited in Dhaka Stock Exchange (DSE).

There are 3 parameters for this method-

  1. symbol : Provide stock symbol of the company as string.
  2. file_name : Provide the name of the history data file as string.
  3. market: Provide the market name as string from which you want to download the data. Probable values are 'CSE' and 'DSE'

Downloading current market price data of all listed companies in DSE/CSE-

from stocksurferbd import PriceData

loader = PriceData()

loader.save_current_data(file_name='current_data.xlsx', market='DSE')

The above code will create a file named- current_history.xlsx in the current folder. It'll contain current price data for all symbols.

There are 2 parameters for this method-

  1. file_name : Provide the name of the current price data file as string.
  2. market: Provide the market name as string from which you want to download the data. Probable values ar 'CSE' and 'DSE'

Downloading fundamental data for a list of companies available in DSE-

from stocksurferbd import FundamentalData
loader = FundamentalData()

loader.save_company_data('ACI', path='company_info')

The above code will create two files named ACI_company_data.xlsx & ACI_financial_data.xlsx in the company_info folder relative to current directory. The file named ACI_company_data.xlsx contains the fundamental data of ACI Limited for the current year and ACI_financial_data.xlsx contains year-wise fundamental data according to DSE website.

There are 2 parameters save_company_data() this method-

  1. symbol : Provide stock symbol of the company as string.
  2. path : Provide the name of the directory as string to save the company data.

Create Candlestick charts for analyzing price history-

from stocksurferbd import CandlestickPlot

cd_plot = CandlestickPlot(csv_path='ACI_history.xlsx', symbol='ACI')
cd_plot.show_plot(
    data_n=120,
    resample=True,
    step='3D'
)

The above code will create a Candlestick plot like the ones provided by Stock broker trading panels.


There are 2 parameters __init__() method of CandlestickPlot class-

  1. csv_path : Provide the path of history csv file as string to generate plot
  2. symbol : Provide stock symbol of the company as string.


There are also 3 parameters show_plot() method-

  1. data_n : Provide an integer value. It sets the count of how many recent data points needs to be plotted.
  2. resample : Provide boolean True or False. Set True if you want to plot daily data aggregated by multiple days.
  3. step: Only Active when resample=True. Valid values are in the form- '3D' and '7D' for 3 days plots and weekly plots respectively.

The following are some example images of Candlestick plots-

Candlestick Plot

Candlestick Plot 3days

If you want to contribute

Any contribution would be highly appreciated. Kindly go through the guidelines for contributing.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stocksurferbd-0.1.3.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

stocksurferbd-0.1.3-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file stocksurferbd-0.1.3.tar.gz.

File metadata

  • Download URL: stocksurferbd-0.1.3.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.10

File hashes

Hashes for stocksurferbd-0.1.3.tar.gz
Algorithm Hash digest
SHA256 cc6db459013be0a78b5a06bf90c37aa19f5a6b80cabb6255237294a53e8057a7
MD5 d103abd383024a02f3682ef18b20cdd5
BLAKE2b-256 0f56ff801004fcc6629002e8e6649dcf2098e26a8a1f9235283e9f32df7e6f84

See more details on using hashes here.

File details

Details for the file stocksurferbd-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for stocksurferbd-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 942b7992c05a28b0b0954aa2249e6e6260532050a571fd2d51fdf9660f87c38e
MD5 501cb7470a529a09b1518e2670aff96e
BLAKE2b-256 797a53fc8276a0204e5fe45c274c3fd1314facd5cb87595b0b6f11a01e5097e7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page