{"id":34598621,"url":"https://github.com/eguidotti/bidask","last_synced_at":"2025-12-24T12:03:56.468Z","repository":{"id":41243554,"uuid":"490046911","full_name":"eguidotti/bidask","owner":"eguidotti","description":"Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices","archived":false,"fork":false,"pushed_at":"2025-10-13T11:21:35.000Z","size":2673,"stargazers_count":121,"open_issues_count":1,"forks_count":32,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-19T19:13:44.487Z","etag":null,"topics":["finance"],"latest_commit_sha":null,"homepage":"https://doi.org/10.1016/j.jfineco.2024.103916","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eguidotti.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-08T20:22:40.000Z","updated_at":"2025-11-07T06:04:26.000Z","dependencies_parsed_at":"2024-06-14T20:30:39.779Z","dependency_job_id":"293e9be7-178f-4157-ab67-b129d51542dc","html_url":"https://github.com/eguidotti/bidask","commit_stats":{"total_commits":113,"total_committers":4,"mean_commits":28.25,"dds":0.06194690265486724,"last_synced_commit":"4ed762b785ade84a5ee6949eaed2d6151f4a2270"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eguidotti/bidask","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eguidotti%2Fbidask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eguidotti%2Fbidask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eguidotti%2Fbidask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eguidotti%2Fbidask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eguidotti","download_url":"https://codeload.github.com/eguidotti/bidask/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eguidotti%2Fbidask/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28002250,"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","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["finance"],"created_at":"2025-12-24T12:03:44.640Z","updated_at":"2025-12-24T12:03:56.459Z","avatar_url":"https://github.com/eguidotti.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices\n\nThis [repository](https://github.com/eguidotti/bidask/) implements the efficient estimator of the effective bid-ask spread from open, high, low, and close prices described in:\n\n\u003e Ardia, D., Guidotti, E., Kroencke, T.A. (2024). Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices. *Journal of Financial Economics*, 161, 103916. [doi: 10.1016/j.jfineco.2024.103916](https://doi.org/10.1016/j.jfineco.2024.103916)\n\nThe estimator is available in:\n\n[C++](https://github.com/eguidotti/bidask/tree/main/c++) | [Julia](https://github.com/eguidotti/bidask/tree/main/julia) | [MATLAB](https://github.com/eguidotti/bidask/tree/main/matlab) | [Python](https://github.com/eguidotti/bidask/tree/main/python) | [R](https://github.com/eguidotti/bidask/tree/main/r) | [SAS](https://github.com/eguidotti/bidask/tree/main/sas)\n\nYou can also check the [pseudocode](https://github.com/eguidotti/bidask/tree/main/pseudocode) to implement the estimator in any programming language. If you implement the estimator in a new programming language and want your implementation included in the repository, please open a [pull request](https://github.com/eguidotti/bidask/pulls).\n\n## Open data\n\nThe following datasets are available to download:\n\n| Download                                       | Dataset                                              | Description                                                  |\n| ---------------------------------------------- | ---------------------------------------------------- | ------------------------------------------------------------ |\n| [download](https://doi.org/10.7910/DVN/YAY4H6) | Bid-Ask Spread Estimates for U.S. Stocks in CRSP     | Contains monthly estimates of the effective bid-ask spread for each stock in the CRSP U.S. Stock database |\n| [download](https://doi.org/10.7910/DVN/9AVA2B) | Bid-Ask Spread Estimates for Crypto Pairs in Binance | Contains monthly estimates of the effective bid-ask spread for crypto pairs listed in Binance |\n\n## FAQ \n\n\u003e Each transaction price may generally include a different bid-ask spread, but the estimator only returns a single estimate given a sample of open, high, low, and close prices. What is the estimator computing exactly?\n\n- The estimator estimates the root mean square effective spread within the sample period.\n\n\u003e What is the minimum number of observations required by the estimator?\n\n- The estimator requires at least 3 observations.\n\n\u003e What is the recommended number of observations to use? \n\n- There is no one-size-fits-all solution.  For instance, using a few daily prices would provide estimates closer to the spread in those days but with potentially large estimation uncertainty. Using one year of daily prices would provide more precise estimates, but for the average (more precisely, root mean square) spread in the whole year. For more information, see https://github.com/eguidotti/bidask/issues/2\n\n\u003e Does the estimator work with intraday data?\n\n- Yes, the estimator can be used with intraday data. \n\n\u003e What is the recommended frequency to use? \n\n- Generally, the higher the frequency, the better (e.g., minute prices are preferable to hourly and daily prices). However, this depends on the underlying asset's trading frequency. For instance, weekly prices should be considered for assets that trade, on average, less than once per day. More generally, the frequency should be chosen so that the average number of trades per period is at least two. The estimation variance may increase significantly below this limit. \n\n\u003e Does the estimator work with tick data?\n\n- The estimator does not natively support tick data. However, it is possible to aggregate tick data into open, high, low, and close prices and apply the estimator.\n\n\u003e How to handle non-positive estimates?\n\n- By default, the estimator returns the absolute value of the estimates. This is generally a good option if you are interested in point estimates, but may create a small-sample bias if the estimates are used for averaging or regression studies. To reduce this source of bias, you can compute signed estimates with the argument `sign=True` and reset negative values to zero. Keeping negative values is not recommended because more negative estimates are typically associated with larger spreads empirically. For more information, see https://github.com/eguidotti/bidask/issues/3\n\n\u003e Does the estimator work with missing values?\n\n- Yes, the estimator works with missing values out-of-the-box. It is recommended to keep missing values and use a regular time grid instead of dropping missing values and using an irregular time grid. For more information, see https://github.com/eguidotti/bidask/issues/16\n\n\u003e Do the functions `edge` and `edge_rolling` produce the same results?\n\n- The function `edge_rolling` is a version of `edge` optimized for fast calculations over rolling windows. The two functions produce the same estimates when there are no missing values. If missing values are present, the two functions may provide slightly different estimates due to how missing values are handled, but both estimates are consistent.\n\n## Replication code\n\nAll code to replicate the paper is available [here](https://doi.org/10.7910/DVN/G8DPBM). The code meets the requirements of the [cascad](https://www.cascad.tech/certification/145-efficient-estimation-of-bid-ask-spreads-from-open-high-low-and-close-prices/) reproducibility policy for a rating of RRR.\n\n## Related works\n\nYou can browse publications related to the paper [here](https://scholar.google.com/scholar?cites=2115798896240699437).\n\n## Terms of use\n\nAll code is released under the [MIT](https://github.com/eguidotti/bidask?tab=MIT-1-ov-file#readme) license. All data are released under the [CC BY 4.0](http://creativecommons.org/licenses/by/4.0) license. When using any data or code from this repository, please cite the reference indicated below.\n\n## Cite as\n\n\u003e Ardia, D., Guidotti, E., Kroencke, T.A. (2024). Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices. *Journal of Financial Economics*, 161, 103916. [doi: 10.1016/j.jfineco.2024.103916](https://doi.org/10.1016/j.jfineco.2024.103916)\n\nA BibTex  entry for LaTeX users is:\n\n```bibtex\n@article{edge,\n  title = {Efficient estimation of bid–ask spreads from open, high, low, and close prices},\n  journal = {Journal of Financial Economics},\n  volume = {161},\n  pages = {103916},\n  year = {2024},\n  doi = {https://doi.org/10.1016/j.jfineco.2024.103916},\n  author = {David Ardia and Emanuele Guidotti and Tim A. Kroencke},\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feguidotti%2Fbidask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feguidotti%2Fbidask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feguidotti%2Fbidask/lists"}