{"id":18349893,"url":"https://github.com/diptomondal007/bdstockexchange","last_synced_at":"2025-04-06T09:32:27.562Z","repository":{"id":57534052,"uuid":"280368952","full_name":"diptomondal007/bdstockexchange","owner":"diptomondal007","description":"A go library to crawl and get the latest and historical data of two stock exchanges of Bangladesh.","archived":false,"fork":false,"pushed_at":"2021-05-03T10:48:58.000Z","size":58,"stargazers_count":23,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-21T03:21:04.464Z","etag":null,"topics":["bdstockexchange","chittagong-stock-exchange","dhaka-stock-exchange","golang","market","share","stock","stock-data","stock-data-library","stock-market"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/diptomondal007.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-17T08:22:21.000Z","updated_at":"2024-05-12T09:44:35.000Z","dependencies_parsed_at":"2022-09-26T18:21:26.524Z","dependency_job_id":null,"html_url":"https://github.com/diptomondal007/bdstockexchange","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diptomondal007%2Fbdstockexchange","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diptomondal007%2Fbdstockexchange/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diptomondal007%2Fbdstockexchange/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diptomondal007%2Fbdstockexchange/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diptomondal007","download_url":"https://codeload.github.com/diptomondal007/bdstockexchange/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223246358,"owners_count":17112853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bdstockexchange","chittagong-stock-exchange","dhaka-stock-exchange","golang","market","share","stock","stock-data","stock-data-library","stock-market"],"created_at":"2024-11-05T21:24:25.151Z","updated_at":"2024-11-05T21:24:25.918Z","avatar_url":"https://github.com/diptomondal007.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## bdstockexchange\nA Go library to fetch latest stock prices from Dhaka and Chittagong Stock Exchange (DSE \u0026 CSE).\n\n[![Build Status](https://travis-ci.com/diptomondal007/bdstockexchange.svg?branch=master)](https://travis-ci.com/github/diptomondal007/bdstockexchange)\n[![Coverage Status](https://coveralls.io/repos/github/diptomondal007/bdstockexchange/badge.svg?branch=master)](https://coveralls.io/github/diptomondal007/bdstockexchange?branch=master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/diptomondal007/bdstockexchange)](https://goreportcard.com/report/github.com/diptomondal007/bdstockexchange)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/diptomondal007/bdstockexchange?tab=doc)](https://pkg.go.dev/github.com/diptomondal007/bdstockexchange?tab=doc)\n\n## Import\n```go\nimport \"github.com/diptomondal007/bdstockexchange\"\n```\n## Install\n```\ngo get -u github.com/diptomondal007/bdstockexchange\n```\n\n## Usage\n\n```go\nconst (\n\t// ASC constant to sort result array in ascending order\n\tASC sortOrder = iota\n\t// DESC constant to sort result array in descending order\n\tDESC\n)\n```\n\n```go\nconst (\n\t// SortByTradingCode to sort the result by Company's Trade code\n\tSortByTradingCode sortBy = iota\n\t// SortByLTP to sort the result by the Last Trade Price\n\tSortByLTP\n\t// SortByOpeningPrice to sort the result by the Opening Price of that day\n\tSortByOpeningPrice\n\t// SortByHighPrice to sort the result by the Highest Price of the day\n\tSortByHighPrice\n\t// SortByLowPrice to sort the result by Lowest price of the day\n\tSortByLowPrice\n\t// SortByYCP to sort the result by Yesterday's Closing Price\n\tSortByYCP\n\t// SortByNumberOfTrades to sort the result by The Number of shares are traded on that day\n\tSortByNumberOfTrades\n\t// SortByValue to sort the result by the Value of the Company. The Value is in Million BDT.\n\tSortByValue\n\t// SortByVolumeOfShare to sort the result by the Number of shares of the company\n\tSortByVolumeOfShare\n\t// SortByPercentageChange ...\n\tSortByPercentageChange\n\t// SortByPriceChange to sort the result by the Change of Price of the Share\n\tSortByPriceChange\n)\n```\n\n#### type CSE\n\n```go\ntype CSE struct {\n}\n```\n\nCSE is a struct to access cse related methods\n\n#### func  NewCSE\n\n```go\nfunc NewCSE() *CSE\n```\nNewCSE returns new CSE object\n\n#### func (*CSE) GetAllListedCompanies\n\n```go\nfunc (c *CSE) GetAllListedCompanies() ([]*Company, error)\n```\nGetAllListedCompanies returns all the companies listed in cse or error in case\nof any error\n\n#### func (*CSE) GetAllListedCompaniesByCategory\n\n```go\nfunc (c *CSE) GetAllListedCompaniesByCategory() ([]*CompanyListingByCategory, error)\n```\nGetAllListedCompaniesByCategory returns the listing of the companies by their\ncategory or an error in case of any error\n\n#### func (*CSE) GetAllListedCompaniesByIndustry\n\n```go\nfunc (c *CSE) GetAllListedCompaniesByIndustry() ([]*CompanyListingByIndustry, error)\n```\nGetAllListedCompaniesByIndustry returns list of companies with their industry\ntype or error in case of any error\n\n#### func (*CSE) GetAllWeeklyReports\n\n```go\nfunc (c *CSE) GetAllWeeklyReports(year int) (*WeeklyReports, error)\n```\nGetAllWeeklyReports returns weekly reports pdf link for the input Year. the Year\nshould be between current Year and 2018\n\n#### func (*CSE) GetLatestPrices\n\n```go\nfunc (c *CSE) GetLatestPrices(by sortBy, order sortOrder) ([]*CSEShare, error)\n```\nGetLatestPrices returns the array of latest share prices or error in case of any\nerror It takes by which field the array should be sorted ex: SortByTradingCode\nand sort order ex: ASC It will return an error for if user tries to sort with a\nnon existing file in the CSEShare model or invalid category name or invalid sort\norder\n\n#### func (*CSE) GetMarketStatus\n\n```go\nfunc (d *CSE) GetMarketStatus() (*CseMarketStatus, error)\n```\nGetMarketStatus returns the CseMarketStatus with is open/close\n\n#### func (*CSE) GetMarketSummary\n\n```go\nfunc (c *CSE) GetMarketSummary() (*Summary, error)\n```\nGetMarketSummary returns the summary with highest records till now and the\nhistorical market summary data\n\n#### func (*CSE) GetPriceEarningRatio\n\n```go\nfunc (c *CSE) GetPriceEarningRatio(day, month, year string) (*PriceEarningRatios, error)\n```\nGetPriceEarningRatio returns the price earning ratio data for listed companies\nas per input date. It takes day, month and Year as input ex : (03, 07, 2020)\nwhere 03 is the day and 07 is the month and 2020 is the Year. Don't forget to\ninclude 0 before single digit day or month\n\n#### type CSEShare\n\n```go\ntype CSEShare struct {\n\tSL          int\n\tTradingCode string\n\tLTP         float64\n\tOpen        float64\n\tHigh        float64\n\tLow         float64\n\tYCP         float64\n\tTrade       int64\n\tValueInMN   float64\n\tVolume      int64\n}\n```\n\nCSEShare is a model for a single company's latest price data provided by the cse\nwebsite\n\n#### type Company\n\n```go\ntype Company struct {\n\tCompanyName string\n\tTradingCode string\n}\n```\n\n\n#### type CompanyListingByCategory\n\n```go\ntype CompanyListingByCategory struct {\n\tCategory string\n\tList     []*Company\n}\n```\n\n\n#### type CompanyListingByIndustry\n\n```go\ntype CompanyListingByIndustry struct {\n\tIndustryType string\n\tList         []*Company\n}\n```\n\n\n#### type CseMarketStatus\n\n```go\ntype CseMarketStatus struct {\n\tIsOpen bool\n}\n```\n\nCseMarketStatus holds the data for if market is open/close\n\n#### type DSE\n\n```go\ntype DSE struct {\n}\n```\n\nDSE is a struct to access dse related methods\n\n#### func  NewDSE\n\n```go\nfunc NewDSE() *DSE\n```\nNewDSE returns new DSE object\n\n#### func (*DSE) GetLatestPrices\n\n```go\nfunc (d *DSE) GetLatestPrices(by sortBy, order sortOrder) ([]*DSEShare, error)\n```\nGetLatestPrices returns the array of latest share prices or error in case of any\nerror It takes by which field the array should be sorted ex: SortByTradingCode\nand sort order ex: ASC It will return an error for if user tries to sort with a\nnon existing file in the DSEShare model or invalid category name or invalid sort\norder\n\n#### func (*DSE) GetLatestPricesByCategory\n\n```go\nfunc (d *DSE) GetLatestPricesByCategory(categoryName string, by sortBy, order sortOrder) ([]*DSEShare, error)\n```\nGetLatestPricesByCategory returns the array of latest share prices of the input\ncategory or error in case of any error It takes a category name, by which field\nthe array should be sorted ex: SortByTradingCode and sort order ex: ASC It will\nreturn an error for if user tries to sort with a non existing file in the\nDSEShare model or invalid category name or invalid sort order\n\n#### func (*DSE) GetLatestPricesSortedByPercentageChange\n\n```go\nfunc (d *DSE) GetLatestPricesSortedByPercentageChange() ([]*LatestPricesWithPercentage, error)\n```\nGetLatestPricesSortedByPercentageChange ...\n\n#### func (*DSE) GetMarketStatus\n\n```go\nfunc (d *DSE) GetMarketStatus() (*DseMarketStatus, error)\n```\nGetMarketStatus returns the DseMarketStatus with is open/close and last market\nupdate date time\n\n#### type DSEShare\n\n```go\ntype DSEShare struct {\n\tID          int     `json:\"id\"`\n\tTradingCode string  `json:\"trading_code\"`\n\tLTP         float64 `json:\"ltp\"`\n\tHigh        float64 `json:\"high\"`\n\tLow         float64 `json:\"low\"`\n\tCloseP      float64 `json:\"close_p\"`\n\tYCP         float64 `json:\"ycp\"`\n\tChange      float64 `json:\"change\"`\n\tTrade       int64   `json:\"trade\"`\n\tValueInMN   float64 `json:\"value\"`\n\tVolume      int64   `json:\"volume\"`\n}\n```\n\nDSEShare is a model for a single company's latest price data provided by the dse\nwebsite\n\n#### type DseMarketStatus\n\n```go\ntype DseMarketStatus struct {\n\tIsOpen        bool\n\tLastUpdatedOn struct {\n\t\tDate string\n\t\tTime string\n\t}\n}\n```\n\nDseMarketStatus holds the data for if market is open/close and when was last\nupdated\n\n#### type LatestPricesWithPercentage\n\n```go\ntype LatestPricesWithPercentage struct {\n\tID               int     `json:\"id\"`\n\tTradingCode      string  `json:\"trading_code\"`\n\tLTP              float64 `json:\"ltp\"`\n\tHigh             float64 `json:\"high\"`\n\tLow              float64 `json:\"low\"`\n\tCloseP           float64 `json:\"close_p\"`\n\tYCP              float64 `json:\"ycp\"`\n\tPercentageChange float64 `json:\"percentage_change\"`\n\tTrade            int64   `json:\"trade\"`\n\tValueInMN        float64 `json:\"value\"`\n\tVolume           int64   `json:\"volume\"`\n}\n```\n\nLatestPricesWithPercentage ...\n\n#### type PriceEarningRatio\n\n```go\ntype PriceEarningRatio struct {\n\tSL            string\n\tTradingCode   string\n\tFinancialYear struct {\n\t\tFrom string\n\t\tTo   string\n\t}\n\tEPSAsPerUpdatedUnAuditedAccounts struct {\n\t\tQuarter1 float64\n\t\tHalfYear float64\n\t\tQuarter3 float64\n\t}\n\tAnnualizedEPS                     float64\n\tEPSBasedOnLastAuditedAccounts     float64\n\tClosePrice                        float64\n\tPERatioBasedOnAnnualizedEPS       float64\n\tPERatioBasedOnLastAuditedAccounts float64\n}\n```\n\nPriceEarningRatio holds the data for a price earning ratio in selected date\n\n#### type PriceEarningRatios\n\n```go\ntype PriceEarningRatios struct {\n\tDate                   string\n\tPriceEarningRatioArray []*PriceEarningRatio\n}\n```\n\n\n#### type Summary\n\n```go\ntype Summary struct {\n\tHighestRecords      []*record\n\tHistoricalSummaries []*market\n}\n```\n\nSummary holds the historical market summaries array and the record trading or\nhighest records data\n\n#### type WeeklyReports\n\n```go\ntype WeeklyReports struct {\n\tYear    int\n\tReports []*report\n}\n```\n\nWeeklyReports holds the weekly reports for a Year\n\n\n## Example\n#### GetLatestPrices\n```go\npackage main\n\nimport (\n\t\"github.com/diptomondal007/bdstockexchange\"\n\t\"log\"\n)\n\nfunc main(){\n\tdse := bdstockexchange.NewDSE()\n\tarr, err := dse.GetLatestPrices(bdstockexchange.SortByHighPrice, bdstockexchange.ASC)\n\tif err != nil{\n\t\t// Do something with the error\n\t\tlog.Println(err)\n\t}\n\tlog.Println(arr[0].TradingCode)\n}\n```\n\n#### GetLatestPricesByCategory\n```go\npackage main\n\nimport (\n\t\"github.com/diptomondal007/bdstockexchange\"\n\t\"log\"\n)\n\nfunc main(){\n\tdse := bdstockexchange.NewDSE()\n\tarr, err := dse.GetLatestPricesByCategory(\"A\" ,bdstockexchange.SortByHighPrice, bdstockexchange.ASC)\n\tif err != nil{\n\t\t// Do something with the error\n\t\tlog.Println(err)\n\t}\n\tlog.Println(arr[0].TradingCode)\n}\n```\n\n#### GetMarketSummary\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/diptomondal007/bdstockexchange\"\n)\n\nfunc main() {\n\tdse := bdstockexchange.NewDSE()\n\tms, err := dse.GetMarketSummary()\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tlog.Println(ms.DseX.DSEXIndex)\n}\n```\n\n## License\n\nbdstockexchange is released under the Apache 2.0 license. See [LICENSE.txt](https://github.com/diptomondal007/bdstockexchange/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiptomondal007%2Fbdstockexchange","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiptomondal007%2Fbdstockexchange","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiptomondal007%2Fbdstockexchange/lists"}