Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/Aqua.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Aqua

on:
push:
branches:
- main
tags: ["*"]
workflow_dispatch:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
with:
version: '1'
- uses: actions/checkout@v5
- name: Aqua
shell: julia --color=yes {0}
run: |
using Pkg
Pkg.add(PackageSpec(name="Aqua"))
Pkg.develop(PackageSpec(path=pwd()))
using PortfolioOptimisers, Aqua
Aqua.test_ambiguities(PortfolioOptimisers)
Aqua.test_unbound_args(PortfolioOptimisers)
Aqua.test_undefined_exports(PortfolioOptimisers)
Aqua.test_project_extras(PortfolioOptimisers)
Aqua.test_stale_deps(PortfolioOptimisers)
Aqua.test_piracies(PortfolioOptimisers)
Aqua.test_persistent_tasks(PortfolioOptimisers)
Aqua.test_deps_compat(PortfolioOptimisers)
85 changes: 54 additions & 31 deletions .github/workflows/Lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,63 @@ concurrency:

jobs:

lint:
name: Linting
# lint:
# name: Linting
# runs-on: ubuntu-latest
# steps:
# - name: Clone
# uses: actions/checkout@v5
# - name: Setup Julia
# uses: julia-actions/setup-julia@v2
# with:
# version: "1"
# - name: Use Julia cache
# uses: julia-actions/cache@v2
# - name: Build package (required for ExplicitImports)
# uses: julia-actions/julia-buildpkg@v1
# - name: Install Julia packages
# run: julia -e 'using Pkg; pkg"add ExplicitImports, JuliaFormatter"'
# - name: Hack for setup-python cache # https://github.com/actions/setup-python/issues/807
# run: touch requirements.txt
# - name: Setup Python
# uses: actions/setup-python@v6
# with:
# cache: "pip"
# python-version: "3.11"
# - name: Hack for setup-python cache # https://github.com/actions/setup-python/issues/807
# run: rm requirements.txt
# - name: Cache pre-commit
# uses: actions/cache@v4
# with:
# path: ~/.cache/pre-commit
# key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
# - name: Install pre-commit
# run: pip install pre-commit
# - name: Run pre-commit
# run: SKIP=no-commit-to-branch pre-commit run -a
build:
name: Format check
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v5
- name: Setup Julia
uses: julia-actions/setup-julia@v2
- uses: julia-actions/setup-julia@latest
with:
version: "1"
- name: Use Julia cache
uses: julia-actions/cache@v2
- name: Build package (required for ExplicitImports)
uses: julia-actions/julia-buildpkg@v1
- name: Install Julia packages
run: julia -e 'using Pkg; pkg"add ExplicitImports, JuliaFormatter"'
- name: Hack for setup-python cache # https://github.com/actions/setup-python/issues/807
run: touch requirements.txt
- name: Setup Python
uses: actions/setup-python@v6
with:
cache: "pip"
python-version: "3.11"
- name: Hack for setup-python cache # https://github.com/actions/setup-python/issues/807
run: rm requirements.txt
- name: Cache pre-commit
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: SKIP=no-commit-to-branch pre-commit run -a
version: '1'
- uses: actions/checkout@v4
- name: Format check
shell: julia --color=yes {0}
run: |
using Pkg
# If you update the version, also update the style guide docs.
Pkg.add(PackageSpec(name="JuliaFormatter", version="2"))
using JuliaFormatter
format("."; verbose = true)
out = String(read(Cmd(`git diff`)))
if isempty(out)
exit(0)
end
@error "Some files have not been formatted !!!"
write(stdout, out)
exit(1)
link-checker:
name: Link checker
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PortfolioOptimisers"
uuid = "e0036ec9-05e5-505d-a6a9-07af41c94861"
authors = ["Daniel Celis Garza <daniel.celis.garza@gmail.com>"]
version = "0.1.0"
version = "0.2.0"

[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)
[![All Contributors](https://img.shields.io/github/all-contributors/dcelisgarza/PortfolioOptimisers.jl?labelColor=5e1ec7&color=c0ffee&style=flat-square)](#contributors)
[![BestieTemplate](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/JuliaBesties/BestieTemplate.jl/main/docs/src/assets/badge.json)](https://github.com/JuliaBesties/BestieTemplate.jl)
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)

## How to Cite

Expand Down
19 changes: 19 additions & 0 deletions docs/src/api/13_Prior/01_BasePrior.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Base Prior

```@docs
LowOrderPrior
HighOrderPrior
prior(pr::PortfolioOptimisers.AbstractPriorEstimator, rd::ReturnsResult; kwargs...)
prior(pr::PortfolioOptimisers.AbstractPriorResult, args...; kwargs...)
clusterise(cle::ClusteringEstimator, pr::PortfolioOptimisers.AbstractPriorResult; kwargs...)
PortfolioOptimisers.AbstractPriorEstimator
PortfolioOptimisers.AbstractLowOrderPriorEstimator
PortfolioOptimisers.AbstractLowOrderPriorEstimator_A
PortfolioOptimisers.AbstractLowOrderPriorEstimator_F
PortfolioOptimisers.AbstractLowOrderPriorEstimator_AF
PortfolioOptimisers.AbstractLowOrderPriorEstimator_A_AF
PortfolioOptimisers.AbstractLowOrderPriorEstimator_F_AF
PortfolioOptimisers.AbstractLowOrderPriorEstimator_A_F_AF
PortfolioOptimisers.AbstractHighOrderPriorEstimator
PortfolioOptimisers.AbstractPriorResult
```
7 changes: 7 additions & 0 deletions docs/src/api/13_Prior/02_EmpiricalPrior.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Empirical Prior

```@docs
EmpiricalPrior
prior(pe::EmpiricalPrior{<:Any, <:Any, Nothing}, X::AbstractMatrix, args...; dims::Int = 1,
kwargs...)
```
7 changes: 7 additions & 0 deletions docs/src/api/13_Prior/03_FactorPrior.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Factor Prior

```@docs
FactorPrior
prior(pe::FactorPrior, X::AbstractMatrix, F::AbstractMatrix; dims::Int = 1,
kwargs...)
```
9 changes: 9 additions & 0 deletions docs/src/api/13_Prior/04_HighOrderPrior.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# High Order Prior

```@docs
HighOrderPriorEstimator
prior(pe::HighOrderPriorEstimator, X::AbstractMatrix,
F::Union{Nothing, <:AbstractMatrix} = nothing; dims::Int = 1, kwargs...)
PortfolioOptimisers.block_vec_pq
PortfolioOptimisers.dup_elim_sum_matrices
```
2 changes: 1 addition & 1 deletion docs/src/api/13_Prior/10_EntropyPoolingPrior.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Prior
# Entropy Pooling

```@docs
PortfolioOptimisers.replace_prior_views
Expand Down
5 changes: 0 additions & 5 deletions docs/src/api/13_Prior/1_BasePrior.md

This file was deleted.

4 changes: 2 additions & 2 deletions examples/1_Getting_Started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
{
"output_type": "execute_result",
"data": {
"text/plain": "MeanRisk\n opt | JuMPOptimiser\n | pe | EmpiricalPrior\n | | ce | PortfolioOptimisersCovariance\n | | | ce | Covariance\n | | | | me | SimpleExpectedReturns\n | | | | | w | nothing\n | | | | ce | GeneralWeightedCovariance\n | | | | | ce | SimpleCovariance: SimpleCovariance(true)\n | | | | | w | nothing\n | | | | alg | Full()\n | | | mp | DefaultMatrixProcessing\n | | | | pdm | Posdef\n | | | | | alg | UnionAll: NearestCorrelationMatrix.Newton\n | | | | denoise | nothing\n | | | | detone | nothing\n | | | | alg | nothing\n | | me | SimpleExpectedReturns\n | | | w | nothing\n | | horizon | nothing\n | slv | Solver\n | | name | Symbol: :clarabel1\n | | solver | UnionAll: Clarabel.MOIwrapper.Optimizer\n | | settings | Dict{String, Bool}: Dict{String, Bool}(\"verbose\" => 0)\n | | check_sol | @NamedTuple{allow_local::Bool, allow_almost::Bool}: (allow_local = true, allow_almost = true)\n | | add_bridges | Bool: true\n | wb | WeightBounds\n | | lb | Float64: 0.0\n | | ub | Float64: 1.0\n | bgt | Float64: 1.0\n | sbgt | nothing\n | lt | nothing\n | st | nothing\n | lcs | nothing\n | lcm | nothing\n | cent | nothing\n | gcard | nothing\n | sgcard | nothing\n | smtx | nothing\n | sgmtx | nothing\n | slt | nothing\n | sst | nothing\n | sglt | nothing\n | sgst | nothing\n | sets | nothing\n | nplg | nothing\n | cplg | nothing\n | tn | nothing\n | te | nothing\n | fees | nothing\n | ret | ArithmeticReturn\n | | ucs | nothing\n | | lb | nothing\n | sce | SumScalariser: SumScalariser()\n | ccnt | nothing\n | cobj | nothing\n | sc | Int64: 1\n | so | Int64: 1\n | card | nothing\n | scard | nothing\n | nea | nothing\n | l1 | nothing\n | l2 | nothing\n | ss | nothing\n | strict | Bool: false\n r | Variance\n | settings | RiskMeasureSettings\n | | scale | Float64: 1.0\n | | ub | nothing\n | | rke | Bool: true\n | sigma | nothing\n | rc | nothing\n | alg | SOCRiskExpr()\n obj | MinimumRisk()\n wi | nothing\n fallback | nothing\n"
"text/plain": "MeanRisk\n opt | JuMPOptimiser\n | pe | EmpiricalPrior\n | | ce | PortfolioOptimisersCovariance\n | | | ce | Covariance\n | | | | me | SimpleExpectedReturns\n | | | | | w | nothing\n | | | | ce | GeneralWeightedCovariance\n | | | | | ce | SimpleCovariance: SimpleCovariance(true)\n | | | | | w | nothing\n | | | | alg | Full()\n | | | mp | DefaultMatrixProcessing\n | | | | pdm | Posdef\n | | | | | alg | UnionAll: NearestCorrelationMatrix.Newton\n | | | | denoise | nothing\n | | | | detone | nothing\n | | | | alg | nothing\n | | me | SimpleExpectedReturns\n | | | w | nothing\n | | horizon | nothing\n | slv | Solver\n | | name | Symbol: :clarabel1\n | | solver | UnionAll: Clarabel.MOIwrapper.Optimizer\n | | settings | Dict{String, Bool}: Dict{String, Bool}(\"verbose\" => 0)\n | | check_sol | @NamedTuple{allow_local::Bool, allow_almost::Bool}: (allow_local = true, allow_almost = true)\n | | add_bridges | Bool: true\n | wb | WeightBounds\n | | lb | Float64: 0.0\n | | ub | Float64: 1.0\n | bgt | Float64: 1.0\n | sbgt | nothing\n | lt | nothing\n | st | nothing\n | lcs | nothing\n | lcm | nothing\n | cent | nothing\n | gcard | nothing\n | sgcard | nothing\n | smtx | nothing\n | sgmtx | nothing\n | slt | nothing\n | sst | nothing\n | sglt | nothing\n | sgst | nothing\n | sets | nothing\n | plg | nothing\n | tn | nothing\n | te | nothing\n | fees | nothing\n | ret | ArithmeticReturn\n | | ucs | nothing\n | | lb | nothing\n | sce | SumScalariser: SumScalariser()\n | ccnt | nothing\n | cobj | nothing\n | sc | Int64: 1\n | so | Int64: 1\n | card | nothing\n | scard | nothing\n | nea | nothing\n | l1 | nothing\n | l2 | nothing\n | ss | nothing\n | strict | Bool: false\n r | Variance\n | settings | RiskMeasureSettings\n | | scale | Float64: 1.0\n | | ub | nothing\n | | rke | Bool: true\n | sigma | nothing\n | rc | nothing\n | alg | SOCRiskExpr()\n obj | MinimumRisk()\n wi | nothing\n fallback | nothing\n"
},
"metadata": {},
"execution_count": 7
Expand Down Expand Up @@ -217,7 +217,7 @@
{
"output_type": "execute_result",
"data": {
"text/plain": "JuMPOptimisation\n oe | DataType: MeanRisk\n pa | ProcessedJuMPOptimiserAttributes\n | pr | LowOrderPrior\n | | X | 252×20 Matrix{Float64}\n | | mu | 20-element Vector{Float64}\n | | sigma | 20×20 Matrix{Float64}\n | | chol | nothing\n | | w | nothing\n | | ens | nothing\n | | kld | nothing\n | | ow | nothing\n | | rr | nothing\n | | f_mu | nothing\n | | f_sigma | nothing\n | | f_w | nothing\n | wb | WeightBounds\n | | lb | 20-element StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}\n | | ub | 20-element StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}\n | lt | nothing\n | st | nothing\n | lcs | nothing\n | cent | nothing\n | gcard | nothing\n | sgcard | nothing\n | smtx | nothing\n | sgmtx | nothing\n | slt | nothing\n | sst | nothing\n | sglt | nothing\n | sgst | nothing\n | nplg | nothing\n | cplg | nothing\n | tn | nothing\n | fees | nothing\n | ret | ArithmeticReturn\n | | ucs | nothing\n | | lb | nothing\n retcode | OptimisationSuccess\n | res | Dict{Any, Any}: Dict{Any, Any}()\n sol | PortfolioOptimisers.JuMPOptimisationSolution\n | w | 20-element Vector{Float64}\n model | A JuMP Model\n | ├ solver: Clarabel\n | ├ objective_sense: MIN_SENSE\n | │ └ objective_function_type: JuMP.QuadExpr\n | ├ num_variables: 21\n | ├ num_constraints: 4\n | │ ├ JuMP.AffExpr in MOI.EqualTo{Float64}: 1\n | │ ├ Vector{JuMP.AffExpr} in MOI.Nonnegatives: 1\n | │ ├ Vector{JuMP.AffExpr} in MOI.Nonpositives: 1\n | │ └ Vector{JuMP.AffExpr} in MOI.SecondOrderCone: 1\n | └ Names registered in the model\n | └ :G, :bgt, :dev_1, :dev_1_soc, :k, :lw, :obj_expr, :ret, :risk, :risk_vec, :sc, :so, :variance_flag, :variance_risk_1, :w, :w_lb, :w_ub\n"
"text/plain": "JuMPOptimisation\n oe | DataType: MeanRisk\n pa | ProcessedJuMPOptimiserAttributes\n | pr | LowOrderPrior\n | | X | 252×20 Matrix{Float64}\n | | mu | 20-element Vector{Float64}\n | | sigma | 20×20 Matrix{Float64}\n | | chol | nothing\n | | w | nothing\n | | ens | nothing\n | | kld | nothing\n | | ow | nothing\n | | rr | nothing\n | | f_mu | nothing\n | | f_sigma | nothing\n | | f_w | nothing\n | wb | WeightBounds\n | | lb | 20-element StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}\n | | ub | 20-element StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}\n | lt | nothing\n | st | nothing\n | lcs | nothing\n | cent | nothing\n | gcard | nothing\n | sgcard | nothing\n | smtx | nothing\n | sgmtx | nothing\n | slt | nothing\n | sst | nothing\n | sglt | nothing\n | sgst | nothing\n | plg | nothing\n | tn | nothing\n | fees | nothing\n | ret | ArithmeticReturn\n | | ucs | nothing\n | | lb | nothing\n retcode | OptimisationSuccess\n | res | Dict{Any, Any}: Dict{Any, Any}()\n sol | PortfolioOptimisers.JuMPOptimisationSolution\n | w | 20-element Vector{Float64}\n model | A JuMP Model\n | ├ solver: Clarabel\n | ├ objective_sense: MIN_SENSE\n | │ └ objective_function_type: JuMP.QuadExpr\n | ├ num_variables: 21\n | ├ num_constraints: 4\n | │ ├ JuMP.AffExpr in MOI.EqualTo{Float64}: 1\n | │ ├ Vector{JuMP.AffExpr} in MOI.Nonnegatives: 1\n | │ ├ Vector{JuMP.AffExpr} in MOI.Nonpositives: 1\n | │ └ Vector{JuMP.AffExpr} in MOI.SecondOrderCone: 1\n | └ Names registered in the model\n | └ :G, :bgt, :dev_1, :dev_1_soc, :k, :lw, :obj_expr, :ret, :risk, :risk_vec, :sc, :so, :variance_flag, :variance_risk_1, :w, :w_lb, :w_ub\n"
},
"metadata": {},
"execution_count": 8
Expand Down
Loading
Loading