# Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices
Implements an efficient estimator of bid-ask spreads from open, high, low, and close prices.
## Installation
Install this package with:
```bash
pip install bidask
```
## Usage
Import the estimator:
```python
from bidask import edge
```
Arguments:
```python
edge(open, high, low, close, sign=False)
```
| field | description |
| ------- | ------------------------------------------- |
| `open` | Array-like vector of open prices |
| `high` | Array-like vector of high prices |
| `low` | Array-like vector of low prices |
| `close` | Array-like vector of close prices |
| `sign` | Whether signed estimates should be returned |
The input prices must be sorted in ascending order of the timestamp.
The output value is the spread estimate. A value of 0.01 corresponds to a spread of 1%.
## Example
```python
import pandas as pd
from bidask import edge
df = pd.read_csv("https://raw.githubusercontent.com/eguidotti/bidask/main/pseudocode/ohlc.csv")
edge(df.Open, df.High, df.Low, df.Close)
```
## Cite as
> 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)
A BibTex entry for LaTeX users is:
```bibtex
@article{edge,
title = {Efficient estimation of bid–ask spreads from open, high, low, and close prices},
journal = {Journal of Financial Economics},
volume = {161},
pages = {103916},
year = {2024},
doi = {https://doi.org/10.1016/j.jfineco.2024.103916},
author = {David Ardia and Emanuele Guidotti and Tim A. Kroencke},
}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/eguidotti/bidask",
"name": "bidask",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Emanuele Guidotti",
"author_email": "emanuele.guidotti@usi.ch",
"download_url": "https://files.pythonhosted.org/packages/d0/61/51646ce3d8d72a3e4be7209d505ed6e271a9066b3f6c8d75ceb3be701644/bidask-2.0.1.tar.gz",
"platform": null,
"description": "# Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices\n\nImplements an efficient estimator of bid-ask spreads from open, high, low, and close prices.\n\n\n## Installation\n\nInstall this package with:\n\n```bash\npip install bidask\n```\n\n## Usage\n\nImport the estimator:\n\n```python\nfrom bidask import edge\n```\n\nArguments:\n\n```python\nedge(open, high, low, close, sign=False)\n```\n\n| field | description |\n| ------- | ------------------------------------------- |\n| `open` | Array-like vector of open prices |\n| `high` | Array-like vector of high prices |\n| `low` | Array-like vector of low prices |\n| `close` | Array-like vector of close prices |\n| `sign` | Whether signed estimates should be returned |\n\nThe input prices must be sorted in ascending order of the timestamp. \n\nThe output value is the spread estimate. A value of 0.01 corresponds to a spread of 1%.\n\n## Example\n\n```python\nimport pandas as pd\nfrom bidask import edge\n\ndf = pd.read_csv(\"https://raw.githubusercontent.com/eguidotti/bidask/main/pseudocode/ohlc.csv\")\nedge(df.Open, df.High, df.Low, df.Close)\n```\n\n## Cite as\n\n> 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\u2013ask 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```\n\n",
"bugtrack_url": null,
"license": "GPL-3.0-or-later",
"summary": "Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices",
"version": "2.0.1",
"project_urls": {
"Homepage": "https://github.com/eguidotti/bidask",
"Repository": "https://github.com/eguidotti/bidask"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1560a4b842748c8b2e55cbbf78453256ddd13aa413edeb65c593b8b1fe5dd81c",
"md5": "d077262e349363a699c858c1bb4e7b29",
"sha256": "2a00f3f9d68692e3077d9baf2b17108654a3b08739a7abc3cdd1d643ade8badc"
},
"downloads": -1,
"filename": "bidask-2.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d077262e349363a699c858c1bb4e7b29",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.6",
"size": 2942,
"upload_time": "2024-08-18T18:10:03",
"upload_time_iso_8601": "2024-08-18T18:10:03.628495Z",
"url": "https://files.pythonhosted.org/packages/15/60/a4b842748c8b2e55cbbf78453256ddd13aa413edeb65c593b8b1fe5dd81c/bidask-2.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d06151646ce3d8d72a3e4be7209d505ed6e271a9066b3f6c8d75ceb3be701644",
"md5": "0ef0860d9c38a09c0d8192f75324b62a",
"sha256": "ab892fe3e2e4694eaf399d6b431fada7497a9b635590a203424826abc9773655"
},
"downloads": -1,
"filename": "bidask-2.0.1.tar.gz",
"has_sig": false,
"md5_digest": "0ef0860d9c38a09c0d8192f75324b62a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.6",
"size": 2320,
"upload_time": "2024-08-18T18:10:05",
"upload_time_iso_8601": "2024-08-18T18:10:05.161083Z",
"url": "https://files.pythonhosted.org/packages/d0/61/51646ce3d8d72a3e4be7209d505ed6e271a9066b3f6c8d75ceb3be701644/bidask-2.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-18 18:10:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "eguidotti",
"github_project": "bidask",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "bidask"
}