Git Product home page Git Product logo

bdshare's Introduction

#Bdshare

Documentation Status PyPI StyleCI

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

$ pip install bdshare

or upgrade

$ pip install -U bdshare

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

from bdshare import get_basic_hist_data

df = get_basic_hist_data('2022-03-01','2022-03-02','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

from bdshare import get_basic_hist_data, Store

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

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')
  • 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.

bdshare's People

Contributors

rochi88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bdshare's Issues

Unable to import

Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "", line 36, in
File "", line 34, in
File "/tmp/pip-install-9acher1p/bdshare_548cd89fc4094f6b8529e85e116222a6/setup.py", line 8, in
with open('CHANGELOG.md') as history_file:
FileNotFoundError: [Errno 2] No such file or directory: 'CHANGELOG.md'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.

pe funtion not working

pe funtion not working

from bdshare import get_latest_pe
import pandas as pd

def test_get_latest_pe():
try:
# Fetch the latest P/E data
pe_data = get_latest_pe()

    if pe_data is None:
        print("No data received from get_latest_pe()")
        return
    
    # Display the fetched data
    print("Latest P/E Data:")
    print(pe_data)
    
    # Optionally, save the data to a CSV file
    df = pd.DataFrame(pe_data)
    df.to_csv("latest_pe_data.csv", index=False)
    print("Data saved to latest_pe_data.csv")
    
except Exception as e:
    print(f"An unexpected error occurred: {e}")

Run the test

test_get_latest_pe()
used this code to test on google colab
shows error msg An unexpected error occurred: 'NoneType' object has no attribute 'find_all'

Unable to install bdshare using pip

I receive this error in my terminal when I input the command to install:

mehedino@Mehedis-MacBook-Air ~ % pip install bdshare
Collecting bdshare
Using cached bdshare-0.3.1.tar.gz (9.5 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/private/var/folders/xm/8ry6wwvs46j571rz9wjfrmyh0000gn/T/pip-install-w8uyijj8/bdshare_d15ac9ca74284ed092dc03a6ce97d804/setup.py", line 8, in
with open('CHANGELOG.md') as history_file:
FileNotFoundError: [Errno 2] No such file or directory: 'CHANGELOG.md'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.