Skip to content

Commit

Permalink
Bibliography for each page is created ✨
Browse files Browse the repository at this point in the history
  • Loading branch information
shayandavoodii committed Nov 7, 2023
1 parent d685a0e commit fc68704
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 15 deletions.
6 changes: 6 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ using DocumenterCitations

DocMeta.setdocmeta!(OnlinePortfolioSelection, :DocTestSetup, :(using OnlinePortfolioSelection); recursive=true)
bib = CitationBibliography(joinpath(@__DIR__, "src", "refs.bib"))
PROJECT_TOML = Pkg.TOML.parsefile(joinpath(@__DIR__, "..", "Project.toml"))
VERSION_ = PROJECT_TOML["version"]
NAME = PROJECT_TOML["name"]
GITHUB = "https://github.com/shayandavoodii/OnlinePortfolioSelection.jl"

makedocs(;
modules=[OnlinePortfolioSelection],
Expand All @@ -15,6 +19,7 @@ makedocs(;
canonical="https://shayandavoodii.github.io/OnlinePortfolioSelection.jl",
prettyurls = get(ENV, "CI", nothing) == "true",
assets=String["assets/citations.css"],
footer="[$NAME.jl]($GITHUB) v$VERSION_ docs powered by [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl).",
),
pages=Any[
"Home" => "index.md",
Expand All @@ -30,6 +35,7 @@ makedocs(;
],
"Performance Evaluation" => "performance_eval.md",
"Functions" => "funcs.md",
"References" => "refs.md",
],
)

Expand Down
9 changes: 8 additions & 1 deletion docs/src/Combined.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,11 @@ julia> metrics.Sn
1.0277067897356449
```

The result of `metrics.Sn` indicates that if we had invested in the given period, we would have gained ~2.8% profit. It is worht mentioning that each metric can be accessed individually by writing `results.` and pressing the `Tab` key. Note that one can individually investigate the performance of the algorithm regarding each metric. See [`sn`](@ref), [`ann_std`](@ref), [`apy`](@ref), [`ann_sharpe`](@ref), [`mdd`](@ref), and [`calmar`](@ref). See [Performance evaluation](@ref) section for more information.
The result of `metrics.Sn` indicates that if we had invested in the given period, we would have gained ~2.8% profit. It is worht mentioning that each metric can be accessed individually by writing `results.` and pressing the `Tab` key. Note that one can individually investigate the performance of the algorithm regarding each metric. See [`sn`](@ref), [`ann_std`](@ref), [`apy`](@ref), [`ann_sharpe`](@ref), [`mdd`](@ref), and [`calmar`](@ref). See [Performance evaluation](@ref) section for more information.

## References

```@bibliography
Pages = [@__FILE__]
Canonical = false
```
6 changes: 5 additions & 1 deletion docs/src/FL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Follow the Loser (FL)

The "Follow the Loser" (FL) strategy, introduced by Borodin and [Vincent (2004)](https://proceedings.neurips.cc/paper/2003/hash/8c9f32e03aeb2e3000825c8c875c4edd-Abstract.html), involves reallocating investment weight from a stock with a superior past performance to a stock with unfavorable performance. This approach is grounded in the belief that a stock exhibiting undesirable past performance may offer a favorable return in the future. Presently, this package includes the following FL strategies:
The "Follow the Loser" (FL) strategy, introduced by [borodin2003can](@citet), involves reallocating investment weight from a stock with a superior past performance to a stock with unfavorable performance. This approach is grounded in the belief that a stock exhibiting undesirable past performance may offer a favorable return in the future. Presently, this package includes the following FL strategies:

1. Reweighted Price Relative Tracking System for Automatic Portfolio Optimization
2. Anti-Correlation (Anticor)
Expand Down Expand Up @@ -345,5 +345,9 @@ In this case, the algorithm has a better performance in terms of the cumulative

It is worht mentioning that each metric can be accessed individually by writing `results.` and pressing the `Tab` key. Note that one can individually investigate the performance of the algorithm regarding each metric. See [`sn`](@ref), [`ann_std`](@ref), [`apy`](@ref), [`ann_sharpe`](@ref), [`mdd`](@ref), and [`calmar`](@ref). See [Performance evaluation](@ref) section for more information.

## References

```@bibliography
Pages = [@__FILE__]
Canonical = false
```
6 changes: 5 additions & 1 deletion docs/src/FW.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The Follow the Winner (FW) strategies operate on the principle that assets that

## Universal Portfolio

Universal Portfolio (UP) is a Follow the Winner (FW) strategy introduced by [COVER](@citet). This algorithm is designed to optimize the cumulative return of a portfolio over the investment horizon. UP's approach is centered on daily stock market performance and the distribution of wealth invested in individual stocks.
Universal Portfolio (UP) is a Follow the Winner (FW) strategy introduced by [COVER451321](@citet). This algorithm is designed to optimize the cumulative return of a portfolio over the investment horizon. UP's approach is centered on daily stock market performance and the distribution of wealth invested in individual stocks.

See [`up`](@ref).

Expand Down Expand Up @@ -204,5 +204,9 @@ julia> results.MER

It is worht mentioning that each metric can be accessed individually by writing `results.` and pressing the `Tab` key. Note that one can individually investigate the performance of the algorithm regarding each metric. See [`sn`](@ref), [`ann_std`](@ref), [`apy`](@ref), [`ann_sharpe`](@ref), [`mdd`](@ref), and [`calmar`](@ref). See [Performance evaluation](@ref) section for more information.

## References

```@bibliography
Pages = [@__FILE__]
Canonical = false
```
4 changes: 4 additions & 0 deletions docs/src/ML.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,9 @@ juila> metrics.Sn
The result indicates that if we had invested in the given period, we would have gained ~3.2% profit.
It is worht mentioning that each metric can be accessed individually by writing `results.` and pressing the `Tab` key. Note that one can individually investigate the performance of the algorithm regarding each metric. See [`sn`](@ref), [`ann_std`](@ref), [`apy`](@ref), [`ann_sharpe`](@ref), [`mdd`](@ref), and [`calmar`](@ref). See [Performance evaluation](@ref) section for more information.

## References

```@bibliography
Pages = [@__FILE__]
Canonical = false
```
11 changes: 9 additions & 2 deletions docs/src/PM.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Pattern-matching algorithms stand among the most popular strategies in the domai

## Correlation-driven Nonparametric Learning

Correlation-driven Nonparametric Learning (CORN) is a pattern-matching algorithm introduced by [borodin2003can](@citet). CORN employs correlation as the measure of similarity between different time windows. Within CORN, multiple experts are defined to generate portfolios. Each trading day involves a combination of expert portfolios to create the final portfolio. The distinction between CORN-K and CORN-U lies in their portfolio construction methods. CORN-K selects the K best experts, determined by their historical performance, to create the final portfolio. Conversely, CORN-U amalgamates all experts uniformly to construct the final portfolio. For further details, refer to [`cornu`](@ref) and [`cornk`](@ref).
Correlation-driven Nonparametric Learning (CORN) is a pattern-matching algorithm introduced by [10.1145/1961189.1961193](@citet). CORN employs correlation as the measure of similarity between different time windows. Within CORN, multiple experts are defined to generate portfolios. Each trading day involves a combination of expert portfolios to create the final portfolio. The distinction between CORN-K and CORN-U lies in their portfolio construction methods. CORN-K selects the K best experts, determined by their historical performance, to create the final portfolio. Conversely, CORN-U amalgamates all experts uniformly to construct the final portfolio. For further details, refer to [`cornu`](@ref) and [`cornk`](@ref).

### Run CORN-U

Expand Down Expand Up @@ -228,4 +228,11 @@ julia> sn(model.b, rel_price)
0.9817775041346212
```
The result indicates that the algorithm has lost ~1.8% of the initial wealth during the investment period. Further analysis of the algorithm can be done by using the [`ann_std`](@ref), [`apy`](@ref), [`ann_sharpe`](@ref), [`mdd`](@ref), and [`calmar`](@ref) functions. See [Performance evaluation](@ref) section for more information.
The result indicates that the algorithm has lost ~1.8% of the initial wealth during the investment period. Further analysis of the algorithm can be done by using the [`ann_std`](@ref), [`apy`](@ref), [`ann_sharpe`](@ref), [`mdd`](@ref), and [`calmar`](@ref) functions. See [Performance evaluation](@ref) section for more information.
## References
```@bibliography
Pages = [@__FILE__]
Canonical = false
```
11 changes: 9 additions & 2 deletions docs/src/benchmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ In the domain of online portfolio selection, certain strategies are considered b
3. Uniform Portfolio (1/N)

## CRP
Let's run the algorithm [COVER](@cite) on the real market data. Assume the data (named as `prices`) is collected as noted in the [Fetch Data](@ref) section.
Let's run the algorithm [COVER451321](@cite) on the real market data. Assume the data (named as `prices`) is collected as noted in the [Fetch Data](@ref) section.

```julia
juila> using OnlinePortfolioSelection
Expand Down Expand Up @@ -162,4 +162,11 @@ julia> sn(m_uni.b, rel_price)

The result reveals that if investment had been made during the specified period, a loss of approximately 3.9% of the capital would have been incurred. It's noteworthy that [`sn`](@ref) automatically accounts for the last 10 relative prices in this context.

Additionally, this package offers functions for assessing the algorithm's performance. For further details, refer to the [Performance evaluation](@ref) section.
Additionally, this package offers functions for assessing the algorithm's performance. For further details, refer to the [Performance evaluation](@ref) section.

## References

```@bibliography
Pages = [@__FILE__]
Canonical = false
```
4 changes: 4 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,9 @@ julia> comp_algs = DataFrame(

The comparison analysis, via `comp_algs`, highlights that CORN-K outperforms the other algorithms in terms of annualized percentage yield (APY), annualized Sharpe ratio, Calmar ratio, and maximum drawdown (MDD). However, it's essential to note that the annualized standard deviation of CORN-K surpasses that of the other algorithms within this dataset. These individual metrics can be computed separately by using corresponding functions such as [`sn`](@ref), [`apy`](@ref), [`ann_sharpe`](@ref), [`ann_std`](@ref), [`calmar`](@ref), and [`mdd`](@ref). For further insights and details, please refer to the [Performance evaluation](@ref).

## References

```@bibliography
Pages = [@__FILE__]
Canonical = false
```
11 changes: 9 additions & 2 deletions docs/src/performance_eval.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ MER = {1 \over n}\sum\nolimits_{t = 1}^n {{R_t} - } {1 \over n}\sum\nolimits_{t
```

where $R$ and ${R_t^*}$ represent the daily returns of a portfolio and the market strategy at the $t$th trading day, respectively. For a given OPS method, accounting for transaction costs, ${{R_t}}$ is calculated by ${R_t} = \left( {\mathbf{x}_t\mathbf{b}_t} \right) \times \left( {1 - {\nu \over 2} \times \sum\nolimits_{i = 1}^d {\left| {{b_{t,i}} - {{\tilde b}_{t,i}}} \right|} } \right) - 1$. The market strategy initially allocates capital equally among all assets and remains unchanged. ${R_t^*}$ is defined as:
$R_t^* = \mathbf{x}_t \cdot \mathbf{b}^* - 1$ and ${\mathbf{b}^*} = {\left( {{1 \over d},{1 \over d}, \ldots ,{1 \over d}} \right)^ \top }$, where $d$ is the number of assets, and $n$ is the number of trading days. This metric can be calculated using the [`mer`](@ref) function. (see [[1](https://doi.org/10.1016/j.patcog.2023.109872)] for more details.)
$R_t^* = \mathbf{x}_t \cdot \mathbf{b}^* - 1$ and ${\mathbf{b}^*} = {\left( {{1 \over d},{1 \over d}, \ldots ,{1 \over d}} \right)^ \top }$, where $d$ is the number of assets, and $n$ is the number of trading days. This metric can be calculated using the [`mer`](@ref) function. (see [XI2023109872](@cite) for more details.)

- Annualized Return (APY)

Expand Down Expand Up @@ -203,4 +203,11 @@ Annualized Standard Deviation: 0.312367085936459
Calmar Ratio: 11.026402121997583
```

As shown, the results are consistent with the results obtained using the [`OPSMetrics`](@ref) function.
As shown, the results are consistent with the results obtained using the [`OPSMetrics`](@ref) function.

## References

```@bibliography
Pages = [@__FILE__]
Canonical = false
```
26 changes: 20 additions & 6 deletions docs/src/refs.bib
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@article{borodin2003can,
title={Can we learn to beat the best stock},
author={Borodin, Allan and El-Yaniv, Ran and Gogan, Vincent},
journal={Advances in Neural Information Processing Systems},
volume={16},
year={2003}
title={Can we learn to beat the best stock},
author={Borodin, Allan and El-Yaniv, Ran and Gogan, Vincent},
journal={Advances in Neural Information Processing Systems},
volume={16},
year={2003}
}

@article{https://doi.org/10.1111/j.1467-9965.2006.00274.x,
Expand Down Expand Up @@ -198,7 +198,7 @@ @ARTICLE{8411138
doi={10.1109/TSMC.2018.2852651}
}

@article{COVER,
@article{COVER451321,
author = {Cover, Thomas M.},
title = {Universal Portfolios},
journal = {Mathematical Finance},
Expand All @@ -220,4 +220,18 @@ @misc{li2013online
eprint={1212.2129},
archivePrefix={arXiv},
primaryClass={q-fin.CP}
}

@article{XI2023109872,
title = {Online portfolio selection with predictive instantaneous risk assessment},
journal = {Pattern Recognition},
volume = {144},
pages = {109872},
year = {2023},
issn = {0031-3203},
doi = {https://doi.org/10.1016/j.patcog.2023.109872},
url = {https://www.sciencedirect.com/science/article/pii/S0031320323005708},
author = {Wenzhi Xi and Zhanfeng Li and Xinyuan Song and Hanwen Ning},
keywords = {Portfolio optimization, Online learning, High-dimensional covariance matrix, Ensemble learning, High-dimensional short-term data},
abstract = {Online portfolio selection (OPS) has received increasing attention from machine learning and quantitative finance communities. Despite their effectiveness, the pioneering OPS methods have several key limitations. First, price predictions are usually based on predetermined trends, which is inadequate for a fast-changing market patterns. Second, each asset is treated individually, ignoring the pervading relevance among the assets. Third, the risk terms are usually missing or inappropriate in optimizations. This paper proposes a novel OPS method, namely, the online low-dimension ensemble method, to overcome the limitations. Motivated by the stylized facts for the co-movements of assets, the financial market is regarded as a high-dimensional dynamical system (HDS), and a large number of low-dimensional subsystems (LDSs) are randomly generated from the HDS to extract the correlation information among the assets. The assets’ price predictions are first made using these LDSs and then aggregated to formulate the final prediction using ensemble learning techniques. Thanks to the particular merits brought by our predicting scheme, we also develop a novel high-dimensional covariance matrix estimation/prediction method for short-term data, efficiently assessing the instantaneous risk of the projected portfolios. Compared with state-of-the-art methods, our approach obtains more accurate predictions as the correlation information is fully exploited. With the predictive instantaneous risk assessment, a more appropriate optimization problem is proposed, substantially improving the OPS setting and leading to significantly better investment performance. Therefore, this study develops a flexible and promising approach to learning fast-changing market patterns and demonstrates that the high-dimensional feature of the market is a crucial information source for financial modeling with short-term data rather than a barrier in the conventional sense. Extensive experiments on real-world datasets are conducted to illustrate our method further.}
}
5 changes: 5 additions & 0 deletions docs/src/refs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# References

<!-- ```@bibliography
``` -->

0 comments on commit fc68704

Please sign in to comment.