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.

stocksurferbd Python Library Documentation

stocksurferbd is a Python package built using beautifulsoup4, pandas, and mplfinance that helps you collect and analyze stock market data from the Dhaka Stock Exchange (DSE) and Chittagong Stock Exchange (CSE). It enables users to download historical prices, fundamental data, and visualize price movements using candlestick charts.

Product USP

The package provides a simple and programmatic interface for gathering both real-time and historical stock data from Bangladeshi stock markets. It’s especially useful for investors, data scientists, and finance researchers who want to automate their workflow and analyze stocks in Python without relying on expensive or manual data extraction methods.

Key features include:

  • Download historical price data for any listed company in DSE or CSE
  • Fetch real-time market data for all listed companies
  • Access and save fundamental data (company info, year-wise financials)
  • Generate professional-grade candlestick charts using mplfinance

My Contributions

I created the entire stocksurferbd package as a personal initiative to make Bangladeshi stock market data accessible for retail investors and analysts. Here are the highlights of my contributions:

  • Scraped, cleaned, and structured data from the official DSE and CSE websites using BeautifulSoup
  • Built a robust API wrapper for downloading and saving data in Excel format
  • Implemented candlestick plotting logic using mplfinance to visualize trends
  • Designed easy-to-use interfaces for both beginners and experienced Python users
  • Published the library to PyPI and ensured ease of installation via pip install stocksurferbd

Sample Usage


# Downloading historical price data
from stocksurferbd import PriceData

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

This will create an Excel file with historical price data for ACI Ltd from DSE.


# Downloading fundamental data
from stocksurferbd import FundamentalData

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

This will create two Excel files for ACI: one for current fundamental data and one for year-wise financials.


# Generating candlestick chart
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')

This will generate a 3-day resampled candlestick chart for the most recent 120 data points.