Skip to content

Commit

Permalink
Update citation
Browse files Browse the repository at this point in the history
  • Loading branch information
Emanuele Guidotti committed Aug 14, 2024
1 parent c75196b commit 146e2f6
Show file tree
Hide file tree
Showing 25 changed files with 166 additions and 123 deletions.
60 changes: 43 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,57 @@
# Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices

This repository implements an efficient estimator of bid-ask spreads from open, high, low, and close
prices as described in [Ardia, Guidotti, & Kroencke (2021)](https://www.ssrn.com/abstract=3892335).
This [repository](https://github.com/eguidotti/bidask/) implements an efficient estimator of the effective bid-ask spread from open, high, low, and close prices as described in:

Available in:
> 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)
- [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)
The estimator is available in:

You can also check the [pseudocode](https://github.com/eguidotti/bidask/tree/main/pseudocode) to implement the estimator in any programming language.
[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)

You can also check the [pseudocode](https://github.com/eguidotti/bidask/tree/main/pseudocode) to implement the estimator in any programming language.

## Contribute

If you implement the estimator in a new programming language and want your implementation to be included in this repository, please open a [pull request](https://github.com/eguidotti/bidask/pulls).

## Open data

The following datasets are available to download:

| Download | Dataset | Description |
| ---------------------------------------------- | ---------------------------------------------------- | ------------------------------------------------------------ |
| [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 |
| [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 |

## Replication code

All 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.

## Related works

You can browse publications related to the paper [here](https://scholar.google.com/scholar?cites=2115798896240699437).

## Terms of use

All code is released under the [GPL-3.0](https://github.com/eguidotti/bidask/?tab=GPL-3.0-1-ov-file#GPL-3.0-1-ov-file) license. All data are released under the [CC BY 4.0](http://creativecommons.org/licenses/by/4.0) license. Please:

- cite the [paper](https://doi.org/10.1016/j.jfineco.2024.103916) when using any data or code from this repository
- place the URL https://github.com/eguidotti/bidask in a footnote to help others find this repository

## Cite as

*Ardia, David and Guidotti, Emanuele and Kroencke, Tim Alexander, "Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices". Available at SSRN: https://ssrn.com/abstract=3892335*
> 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
@unpublished{edge2021,
author = {Ardia, David and Guidotti, Emanuele and Kroencke, Tim},
title = {Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices},
year = {2021},
note = {Available at SSRN}
url = {https://ssrn.com/abstract=3892335}
@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},
}
```
20 changes: 11 additions & 9 deletions c++/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# 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 as described in [Ardia, Guidotti, & Kroencke (2021)](https://www.ssrn.com/abstract=3892335).
Implements an efficient estimator of bid-ask spreads from open, high, low, and close prices.

## Installation

Expand Down Expand Up @@ -29,16 +28,19 @@ The output value is the spread estimate. A value of 0.01 corresponds to a spread
## Cite as
*Ardia, David and Guidotti, Emanuele and Kroencke, Tim Alexander, "Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices". Available at SSRN: https://ssrn.com/abstract=3892335*
> 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
@unpublished{edge2021,
author = {Ardia, David and Guidotti, Emanuele and Kroencke, Tim},
title = {Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices},
year = {2021},
note = {Available at SSRN}
url = {https://ssrn.com/abstract=3892335}
@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},
}
```

2 changes: 1 addition & 1 deletion c++/edge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ double mean(const std::vector<T> &x){
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
as described in Ardia, Guidotti, & Kroencke (2021) -> https://www.ssrn.com/abstract=3892335
as described in Ardia, Guidotti, & Kroencke (2024) -> https://doi.org/10.1016/j.jfineco.2024.103916
Prices must be sorted in ascending order of the timestamp.
Expand Down
20 changes: 11 additions & 9 deletions julia/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# 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 as described in [Ardia, Guidotti, & Kroencke (2021)](https://www.ssrn.com/abstract=3892335).
Implements an efficient estimator of bid-ask spreads from open, high, low, and close prices.

## Installation

Expand Down Expand Up @@ -50,16 +49,19 @@ edge(df.:Open, df.:High, df.:Low, df.:Close)

## Cite as

*Ardia, David and Guidotti, Emanuele and Kroencke, Tim Alexander, "Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices". Available at SSRN: https://ssrn.com/abstract=3892335*
> 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
@unpublished{edge2021,
author = {Ardia, David and Guidotti, Emanuele and Kroencke, Tim},
title = {Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices},
year = {2021},
note = {Available at SSRN}
url = {https://ssrn.com/abstract=3892335}
@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},
}
```

2 changes: 1 addition & 1 deletion julia/src/BidAsk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using Statistics
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
as described in Ardia, Guidotti, & Kroencke (2021) -> https://www.ssrn.com/abstract=3892335
as described in Ardia, Guidotti, & Kroencke (2024) -> https://doi.org/10.1016/j.jfineco.2024.103916
Prices must be sorted in ascending order of the timestamp.
Expand Down
20 changes: 11 additions & 9 deletions matlab/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# 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 as described in [Ardia, Guidotti, & Kroencke (2021)](https://www.ssrn.com/abstract=3892335).
Implements an efficient estimator of bid-ask spreads from open, high, low, and close prices.

## Installation

Expand Down Expand Up @@ -44,16 +43,19 @@ edge(df(:,1), df(:,2), df(:,3), df(:,4))

## Cite as

*Ardia, David and Guidotti, Emanuele and Kroencke, Tim Alexander, "Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices". Available at SSRN: https://ssrn.com/abstract=3892335*
> 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
@unpublished{edge2021,
author = {Ardia, David and Guidotti, Emanuele and Kroencke, Tim},
title = {Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices},
year = {2021},
note = {Available at SSRN}
url = {https://ssrn.com/abstract=3892335}
@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},
}
```

2 changes: 1 addition & 1 deletion matlab/edge.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% 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
% as described in Ardia, Guidotti, & Kroencke (2021) -> https://www.ssrn.com/abstract=3892335
% as described in Ardia, Guidotti, & Kroencke (2024) -> https://doi.org/10.1016/j.jfineco.2024.103916
%
% Prices must be sorted in ascending order of the timestamp.
%
Expand Down
6 changes: 3 additions & 3 deletions pseudocode/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pseudocode

This file provides the pseudocode to simplify implementations of [EDGE](https://www.ssrn.com/abstract=3892335) in any programming language.
This file provides the pseudocode to simplify implementations of the estimator in any programming language.

### Input

Expand Down Expand Up @@ -76,7 +76,7 @@ return s

### Testing

To test your implementation, import the data available [here](https://raw.githubusercontent.com/eguidotti/bidask/main/pseudocode/ohlc.csv). The file contains sample OHLC simulated price data to simplify testing. The data have been generated by simulating a price process as described in Ardia, Guidotti, & Kroencke (2021) with 390 trades per day and a 1% probability to observe a trade. The simulation uses a constant spread of 1%. By running the estimation, you should obtain a spread estimate of **0.0101849034905478**. If you obtain a different results, you may use the following table to check and debug the intermediate steps.
To test your implementation, import the data available [here](https://raw.githubusercontent.com/eguidotti/bidask/main/pseudocode/ohlc.csv). The file contains sample OHLC simulated price data to simplify testing. The data have been generated by simulating a price process as described in [Ardia, Guidotti, & Kroencke (2024)](https://doi.org/10.1016/j.jfineco.2024.103916) with 390 trades per day and a 1% probability to observe a trade. The simulation uses a constant spread of 1%. By running the estimation, you should obtain a spread estimate of **0.0101849034905478**. If you obtain a different results, you may use the following table to check and debug the intermediate steps.

| variable | value |
| -------- | ------------ |
Expand All @@ -91,4 +91,4 @@ To test your implementation, import the data available [here](https://raw.github

### Contribute

Have you implemented EDGE in a new programming language? If you want your implementation to be included in this repository, please open a [pull request](https://github.com/eguidotti/bidask/pulls)
Have you implemented the estimator in a new programming language? If you want your implementation to be included in this repository, please open a [pull request](https://github.com/eguidotti/bidask/pulls)
20 changes: 11 additions & 9 deletions python/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# 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 as described in [Ardia, Guidotti, & Kroencke (2021)](https://www.ssrn.com/abstract=3892335).
Implements an efficient estimator of bid-ask spreads from open, high, low, and close prices.


## Installation
Expand Down Expand Up @@ -50,16 +49,19 @@ edge(df.Open, df.High, df.Low, df.Close)

## Cite as

*Ardia, David and Guidotti, Emanuele and Kroencke, Tim Alexander, "Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices". Available at SSRN: https://ssrn.com/abstract=3892335*
> 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
@unpublished{edge2021,
author = {Ardia, David and Guidotti, Emanuele and Kroencke, Tim},
title = {Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices},
year = {2021},
note = {Available at SSRN}
url = {https://ssrn.com/abstract=3892335}
@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},
}
```

2 changes: 1 addition & 1 deletion python/bidask/edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def edge(open: np.array, high: np.array, low: np.array, close: np.array, sign: b
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
as described in Ardia, Guidotti, & Kroencke (2021) -> https://www.ssrn.com/abstract=3892335
as described in Ardia, Guidotti, & Kroencke (2024) -> https://doi.org/10.1016/j.jfineco.2024.103916
Prices must be sorted in ascending order of the timestamp.
Expand Down
3 changes: 1 addition & 2 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
[tool.poetry]
name = "bidask"
version = "2.0.0"
version = "2.0.1"
license = "GPL-3.0-or-later"
description = "Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices"
authors = ["Emanuele Guidotti <emanuele.guidotti@usi.ch>"]
readme = "README.md"
repository = "https://github.com/eguidotti/bidask"
homepage = "https://eguidotti.com/publication/efficient-estimation-of-bid-ask-spreads-from-open-high-low-and-close-prices/"

[tool.poetry.dependencies]
python = "^3.6"
Expand Down
1 change: 0 additions & 1 deletion r/.Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
^\.Rproj\.user$
^doc$
^Meta$
vignettes
7 changes: 5 additions & 2 deletions r/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Package: bidask
Type: Package
Title: Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices
Version: 2.0.4
Version: 2.0.5
Authors@R: c(
person(given = "Emanuele", family = "Guidotti", email = "emanuele.guidotti@usi.ch", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-8961-6623")),
person(given = "David", family = "Ardia", role = c("ctb"), comment = c(ORCID = "0000-0003-2823-782X")),
person(given = "Tim", family = "Kroencke", role = c("ctb"), comment = c(ORCID = "0000-0001-8700-356X"))
)
Description: Implements an efficient estimator of bid-ask spreads from open, high, low, and close prices
as described in Ardia, Guidotti, & Kroencke (2021) <https://www.ssrn.com/abstract=3892335>.
as described in Ardia, Guidotti, & Kroencke (2024) <doi:10.1016/j.jfineco.2024.103916>.
It also provides an implementation of the estimators described in
Roll (1984) <doi:10.1111/j.1540-6261.1984.tb03897.x>,
Corwin & Schultz (2012) <doi:10.1111/j.1540-6261.2012.01729.x>,
Expand All @@ -23,5 +23,8 @@ Suggests:
dplyr,
crypto2,
quantmod,
knitr,
rmarkdown,
testthat (>= 3.0.0)
Config/testthat/edition: 3
VignetteBuilder: knitr
8 changes: 4 additions & 4 deletions r/R/edge.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ EDGE <- function(x, width = nrow(x), sign, na.rm){
#'
#' Implements an efficient estimator of bid-ask spreads
#' from open, high, low, and close prices as described in
#' \href{https://www.ssrn.com/abstract=3892335}{Ardia, Guidotti, & Kroencke (2021)}.
#' \href{https://doi.org/10.1016/j.jfineco.2024.103916}{Ardia, Guidotti, & Kroencke (2024)}.
#'
#' @details
#' Prices must be sorted in ascending order of the timestamp.
Expand All @@ -116,12 +116,12 @@ EDGE <- function(x, width = nrow(x), sign, na.rm){
#' @return The spread estimate. A value of 0.01 corresponds to a spread of 1\%.
#'
#' @note
#' Please cite \href{https://www.ssrn.com/abstract=3892335}{Ardia, Guidotti, & Kroencke (2021)}
#' Please cite \href{https://doi.org/10.1016/j.jfineco.2024.103916}{Ardia, Guidotti, & Kroencke (2024)}
#' when using this package in publication.
#'
#' @references
#' Ardia, D., Guidotti E., & Kroencke T. A. (2021). Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices.
#' Available at SSRN: \url{https://www.ssrn.com/abstract=3892335}
#' Ardia, D., Guidotti E., & Kroencke T. A. (2024). Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices.
#' \doi{10.1016/j.jfineco.2024.103916}
#'
#' @examples
#' # simulate open, high, low, and close prices with spread 1%
Expand Down
6 changes: 3 additions & 3 deletions r/R/sim.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
#' @return Simulated open, high, low, and close prices.
#'
#' @note
#' Please cite \href{https://www.ssrn.com/abstract=3892335}{Ardia, Guidotti, & Kroencke (2021)}
#' Please cite \href{https://doi.org/10.1016/j.jfineco.2024.103916}{Ardia, Guidotti, & Kroencke (2024)}
#' when using this package in publication.
#'
#' @references
#' Ardia, D., Guidotti E., & Kroencke T. A. (2021). Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices.
#' Available at SSRN: \url{https://www.ssrn.com/abstract=3892335}
#' Ardia, D., Guidotti E., & Kroencke T. A. (2024). Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices.
#' \doi{10.1016/j.jfineco.2024.103916}
#'
#' @export
#'
Expand Down
Loading

0 comments on commit 146e2f6

Please sign in to comment.