Skip to main content

A utility for crawling historical and Real-time Quotes of DSE(Dhaka Stock Exchange)

Project description

#Bdshare

StyleCI Documentation Status PyPI

A utility for crawling historical and Real-time data from stock exchanges of Bangladesh. At present this utility can collect data from Dhaka stock exchange.

Contents

Quickstart

Installation

$ pip install bdshare

or upgrade

$ pip install -U bdshare

Example Use

Get DSE last or current trading data

from bdshare import get_current_trade_data

df = get_current_trade_data()
print(df.to_string())
from bdshare import get_current_trade_data

df = get_current_trade_data('GP') # get specific instrument data
print(df.to_string())

Get historical data

from bdshare import get_hist_data

df = get_hist_data('2022-03-01','2022-03-02') # get all instrument data
print(df.to_string())

or

from bdshare import get_hist_data

df = get_hist_data('2022-03-01','2022-03-02','ACI') # get specific instrument data
print(df.to_string())

Get OHLCV historical data

from bdshare import get_basic_hist_data

df = get_basic_hist_data('2022-03-01','2022-03-02') # get all instrument data
print(df.to_string())

or

import datetime as dt
from bdshare import get_basic_hist_data

start = dt.datetime.now().date() - dt.timedelta(days=2 * 365)
end = dt.datetime.now().date()
df = get_basic_hist_data(start, end, 'GP') # get specific instrument data
print(df.to_string())

Get DSE Index data

from bdshare import get_market_inf

df = get_market_inf() # get last 30 days market data
print(df.to_string())
from bdshare import get_market_inf_more_data

df = get_market_inf_more_data('2022-03-01','2022-03-02') # get historical market data
print(df.to_string())

Get DSE Market Depth data

from bdshare import get_market_depth_data

df = get_market_depth_data('ACI') # get current buy and sell data
print(df.to_string())

Save data to csv file

import datetime as dt
from bdshare import get_basic_hist_data, Store

start = dt.datetime.now().date() - dt.timedelta(days=2 * 365)
end = dt.datetime.now().date()
df = get_basic_hist_data(start, end) # get all instrument data
Store(df).save()

List of functions

Trading data

Function Params Description
get_current_trade_data() symbol:str get last stock price
get_dsex_data() symbol:str get dseX share price
get_current_trading_code() get last stock codes
get_hist_data() start:str, end:str get historical stock price
get_basic_hist_data() start:str, end:str, code:str get historical stock price
get_close_price_data() start:str, end:str, code:str get stock close price
get_last_trade_price_data()

Trading news

Function Params Description
get_agm_news() get stock agm declarations
get_all_news() start:str, end:str, code:str get dse news

Market data

Function Params Description
get_market_inf() get stock market information
get_latest_pe() get last stock P/E
get_market_inf_more_data() start:str, end:str get historical stock price
get_market_depth_data() index:str get_market_depth_data('ACI')

TODO's and Road Map:

  • refine logic for parameters
  • Demo example;
  • DSE daily data and historical data crawling
  • DSE news,p/e crawling
  • Add DSEX Index data support
  • Create tests
  • Store dat to csv
  • DSE market depth data
  • Add docker support in demo example

Documentation

Complete documentation can be found at Readthedocs .

Contributing to this project

Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing.

Change log

[1.1.4] - 2025-09-16

Added

  • Enhanced error handling and robustness across all functions
  • Improved parameter handling for news functions
  • Better file path resolution for utility functions
  • Comprehensive fallback mechanisms for network issues

Changed

  • Fixed get_all_news() function to support date range parameters as documented
  • Enhanced market info functions with better error handling
  • Improved Store utility with proper file saving mechanism
  • Fixed Tickers utility with correct file path resolution

Fixed

  • All major function issues identified in testing (18/18 functions now working)
  • Parameter signature mismatches in news functions
  • HTML parsing errors in market data functions
  • File saving issues in Store utility
  • Missing tickers.json file dependency

[1.1.2] - 2024-12-31

Added

  • n/a

Changed

  • update tests

Fixed

  • n/a

[1.1.1] - 2024-12-31

Added

  • n/a

Changed

  • update runner

Fixed

  • n/a

[1.1.0] - 2024-12-31

Added

  • new function for getting company info

Changed

  • n/a

Fixed

  • n/a

[1.0.4] - 2024-12-30

Added

  • n/a

Changed

  • changed lint

Fixed

  • fixed typo

[1.0.3] - 2024-07-29

Added

  • n/a

Changed

  • n/a

Fixed

  • check fix for latest P/E url [#6]

[1.0.2] - 2024-07-29

Added

  • n/a

Changed

  • n/a

Fixed

  • fixed latest P/E url [#6]

[1.0.0] - 2024-03-04

Added

  • Updated docs

Changed

  • n/a

[0.7.2] - 2024-03-04

Added

  • Updated docs

Changed

  • n/a

[0.7.1] - 2024-03-04

Added

  • n/a

Changed

  • fixed market depth data api

[0.7.0] - 2024-03-04

Added

  • n/a

Changed

  • n/a

[0.6.0] - 2024-03-03

Added

  • n/a

Changed

  • n/a

[0.5.1] - 2024-02-29

Added

  • n/a

Changed

  • n/a

[0.5.0] - 2024-02-29

Added

  • fixed store datafrave to csv file method

Changed

  • n/a

[0.4.0] - 2023-03-12

Added

  • n/a

Changed

  • changed package manager

[0.3.2] - 2022-10-10

Added

  • n/a

Changed

  • n/a

[0.3.1] - 2022-06-15

Added

  • n/a

Changed

  • n/a

[0.2.1] - 2021-08-01

Added

Changed

  • get_current_trading_code()

[0.2.0] - 2021-06-01

Added

  • added get_market_depth_data
  • added get_dsex_data
  • added 'dse.com.bd' as redundant

Changed

  • Changed documentation
  • changed get_agm_news
  • changed get_all_news

[0.1.4] - 2020-08-22

Added

  • added get_market_inf_more_data

Changed

  • Changed documentation

[0.1.3] - 2020-08-20

Added

  • html5lib
  • added get params

Changed

  • post request to get

[0.1.2] - 2020-05-21

Added

  • modified index declaration

[0.1.1] - 2020-05-20

Added

  • modified index declaration

[0.1.0] - 2020-04-08

Added

  • added git tag
  • VERSION.txt

Changed

  • setup.py
  • HISTORY.md to CHANGELOG.md

[0.0.1] - 2020-04-06

Added

  • get_hist_data(), get_current_trade_data()
  • HISTORY.md

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

bdshare-1.1.4.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bdshare-1.1.4-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file bdshare-1.1.4.tar.gz.

File metadata

  • Download URL: bdshare-1.1.4.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bdshare-1.1.4.tar.gz
Algorithm Hash digest
SHA256 e6ed7834c146a0165e5fd755c2eb09ae89845fed93fa7d5911c3e25b6ba170b3
MD5 c9b3fbfffb5c296a1ad9de8ff6e2463a
BLAKE2b-256 8003c01dadfd1d0d7badf08f3fd1e93c7b192b61b1634ed9911c62c7ddb51107

See more details on using hashes here.

File details

Details for the file bdshare-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: bdshare-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bdshare-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 016d827c11b73268e6aff335401626e022ff72cf4f5e961600cfa887a2675021
MD5 2f585cd1fd0bbedf55359fc03269becf
BLAKE2b-256 7331f4e965585ccfa057ba724d0ecd970ad363e20a76e836f8178b0f0d473a66

See more details on using hashes here.

Supported by

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