allocation 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,89 @@
1
+ Metadata-Version: 2.4
2
+ Name: allocation
3
+ Version: 0.0.1
4
+ Summary: Online (streaming) portfolio construction: scikit-learn / skfolio-compatible estimators over a keyed dynamic universe
5
+ Author-email: Peter Cotton <peter.cotton@microprediction.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/microprediction/allocation
8
+ Requires-Python: >=3.9
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: numpy>=1.23
12
+ Requires-Dist: thurstone>=0.1.0
13
+ Provides-Extra: scale
14
+ Requires-Dist: scipy>=1.10; extra == "scale"
15
+ Provides-Extra: skfolio
16
+ Requires-Dist: skfolio>=0.5; extra == "skfolio"
17
+ Provides-Extra: test
18
+ Requires-Dist: pytest>=7.0; extra == "test"
19
+ Requires-Dist: scipy>=1.10; extra == "test"
20
+ Dynamic: license-file
21
+
22
+ # allocation
23
+
24
+ **Online (streaming) portfolio construction.** A home for portfolio methods as
25
+ scikit-learn / [skfolio](https://skfolio.org)-compatible estimators
26
+ (`fit` / `partial_fit` / `predict` / `weights_`), on top of a keyed
27
+ dynamic-universe layer so they survive reconstituting universes.
28
+
29
+ ```python
30
+ from allocation import ThurstonePortfolio
31
+
32
+ est = ThurstonePortfolio(calib="market", phi=1.0)
33
+ est.fit(returns) # returns: (n_obs, n_assets)
34
+ est.weights_ # long-only weights on the simplex
35
+
36
+ for batch in stream: # streaming / rebalancing
37
+ est.partial_fit(batch) # transports a fixed seed ensemble -> low turnover
38
+ w = est.weights_
39
+ ```
40
+
41
+ `score(X)` returns the portfolio's Sharpe ratio (skfolio's scoring convention),
42
+ and `to_portfolio(X)` wraps the fitted weights as a skfolio `Portfolio`
43
+ (`pip install allocation[skfolio]`) so the output drops into skfolio's metrics,
44
+ `Population`, and cross-validation.
45
+
46
+ ## Why a separate package
47
+
48
+ skfolio is the scikit-learn-native portfolio library, but it is *batch*: a
49
+ changing universe is handled by NaN/incomplete-data mechanics, not by carrying
50
+ per-asset state across streaming updates. `allocation` is the **online**
51
+ complement — estimators with `partial_fit`, a keyed dynamic universe (in the
52
+ spirit of [`precise`](https://github.com/microprediction/precise)), and turnover
53
+ control by construction — while staying API-compatible so each estimator can also
54
+ be contributed upstream to skfolio.
55
+
56
+ ## Methods
57
+
58
+ | Estimator | Status | Notes |
59
+ |-----------|--------|-------|
60
+ | `ThurstonePortfolio` | working | Ability tilt: weights are winning probabilities of a correlated race; calibrate to a benchmark under a reference correlation, tilt under the estimate; smooth common-seed transport for `partial_fit`. Built on [`thurstone`](https://github.com/microprediction/thurstone). |
61
+ | `SchurComplementary` | planned | Online version of the Schur-complementary construction (the batch version is in skfolio). |
62
+ | baselines | planned | Online equal / cap / minimum-variance / risk-parity for benchmarking. |
63
+
64
+ ## Design
65
+
66
+ ```
67
+ allocation/
68
+ base.py # BaseOnlinePortfolio: fit / partial_fit / predict / weights_
69
+ moments.py # EwmaCovariance (default); any partial_fit/covariance_ estimator plugs in
70
+ universe.py # keyed dynamic-universe state (planned)
71
+ thurstone.py # ThurstonePortfolio
72
+ _thurstone/ # calibration + transport engine
73
+ ```
74
+
75
+ Covariance is pluggable: the default is a light EWMA, but any online estimator
76
+ exposing `partial_fit` and `covariance_` (e.g. a `precise` skater) can be passed
77
+ via `covariance=`.
78
+
79
+ ## Status
80
+
81
+ Early. The Thurstone estimator and the streaming transport work and are tested;
82
+ the keyed dynamic-universe layer and the Schur estimator are next. The theory
83
+ behind the Thurstone method (feasibility, redundancy consistency, the implied
84
+ regularized objective, smoothness/turnover) is written up in the accompanying
85
+ paper.
86
+
87
+ ## License
88
+
89
+ MIT © Peter Cotton
@@ -0,0 +1,21 @@
1
+ allocation/__init__.py,sha256=Q9XQ7LrALdqdSkJl37HIT1Tz7D8zZdGRDReHFicJZTI,957
2
+ allocation/base.py,sha256=cMMhNGSO0koyD1SaBQY5D1dCF3KShEZQ9MsNAzBfFqM,5434
3
+ allocation/keyed.py,sha256=wZOgmP54CxlAvCKl2veUieP8Us1j-a5w8zAKK7aGw1g,8173
4
+ allocation/moments.py,sha256=rAYTvIgT66ay26OkOzCw7DIgiXDRI9EF78tTBCSHVjs,2048
5
+ allocation/schur.py,sha256=d3ttvaDTkuHGmS-RMtKH5-ppKpHClQF9Z3s1nW3h85g,3590
6
+ allocation/thurstone.py,sha256=vt5dL7In15XmTiMvWWW1kbA7I4eAiGsRiFkzyCYTBPc,5279
7
+ allocation/universe.py,sha256=_rGK-8zcUdRVOLWnXQ6HxaihH9UVqyDEjZ8BBFAJ_jI,1054
8
+ allocation/_schur/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ allocation/_schur/coupling.py,sha256=yQnK51QfG6PPnLhsRRi3i5AWubilovoDsCRP9WSn16o,7255
10
+ allocation/_schur/seriation.py,sha256=PsQ8qpFlqkTp8yPHixE0mtVzuRXJX56SYy-akTjNkBI,5030
11
+ allocation/_thurstone/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ allocation/_thurstone/ability.py,sha256=nAoHgmeqvNJaxWbEppzdnbAnhdkpY-PhitCizQaqo54,1723
13
+ allocation/_thurstone/calibrate.py,sha256=qK3qEyzwnOf5-c1ugMMD9Jh6nm0bgwikNYI9bEOtJK4,3896
14
+ allocation/_thurstone/covariance.py,sha256=qtz589ooaBLQMOycTwwrfPfAsmNXM3NWLDAySqnV1Y0,3314
15
+ allocation/_thurstone/diagonal.py,sha256=VlZIXKOKZs81qwNqUjedSROO_oY_BYCJny0TvtMSblU,881
16
+ allocation/_thurstone/transport.py,sha256=zv1e02GRS1VKxPA9dWxwXE2xrt9hiIYzdlmbtZ5oVd0,2147
17
+ allocation-0.0.1.dist-info/licenses/LICENSE,sha256=OFu-XioCnnfWLivPcMxVhVXK004RAljPS99iU1_ORdc,1069
18
+ allocation-0.0.1.dist-info/METADATA,sha256=VOfeV1SQx5HyOB7U2bzj_k5t785E_nkE7x_cF2j_Gkw,3720
19
+ allocation-0.0.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
20
+ allocation-0.0.1.dist-info/top_level.txt,sha256=zyirosJbERFtIONnZA9bow_2sGV_dQLgEAroxivxUH4,11
21
+ allocation-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Peter Cotton
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ allocation