numfolio 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,111 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: numfolio
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Author-email: agdiiura <andreadiiura@gmail.com>
|
|
5
|
+
Description-Content-Type: text/markdown
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Dist: joblib>=1.3.2
|
|
8
|
+
Requires-Dist: pandas>=2.2.1
|
|
9
|
+
Requires-Dist: numpy>=1.22
|
|
10
|
+
Requires-Dist: scikit-learn>=1.5.0
|
|
11
|
+
Requires-Dist: scipy>=1.12.0
|
|
12
|
+
Requires-Dist: arch>=6.3.0
|
|
13
|
+
Requires-Dist: numba>0.59.0
|
|
14
|
+
Provides-Extra: build
|
|
15
|
+
Requires-Dist: ruff>=0.11.0; extra == "build"
|
|
16
|
+
Requires-Dist: colorama>=0.4.6; extra == "build"
|
|
17
|
+
Requires-Dist: coverage>=7.0; extra == "build"
|
|
18
|
+
Requires-Dist: isort>=6.0.0; extra == "build"
|
|
19
|
+
Requires-Dist: pre-commit>=4.0.0; extra == "build"
|
|
20
|
+
Requires-Dist: setuptools-git-versioning>=1.13.4; extra == "build"
|
|
21
|
+
Requires-Dist: unittest-xml-reporting>=3.2.0; extra == "build"
|
|
22
|
+
Provides-Extra: docs
|
|
23
|
+
Requires-Dist: mkdocs>=1.6.0; extra == "docs"
|
|
24
|
+
Requires-Dist: mkdocstrings[python]==0.26.2; extra == "docs"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# numfolio ⚡
|
|
28
|
+
Portfolio performance accelerated by Numba
|
|
29
|
+
|
|
30
|
+
A lightweight, flexible Python package for analyzing portfolio returns,
|
|
31
|
+
risk metrics, and correlations using modern statistical and machine learning methods.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 🚀 Features
|
|
36
|
+
|
|
37
|
+
✅ Bootstrapped metric estimation (e.g., Sharpe Ratio, Sortino Ratio)
|
|
38
|
+
|
|
39
|
+
✅ Automatic Scorecard Generation with time-based aggregation (Yearly, Quarterly, Monthly)
|
|
40
|
+
|
|
41
|
+
✅ Covariance and Correlation estimation with robust shrinkage methods
|
|
42
|
+
|
|
43
|
+
✅ Parallel computation for scalability
|
|
44
|
+
|
|
45
|
+
✅ Clean, consistent API inspired by scikit-learn & pandas
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 🔧 Installation
|
|
51
|
+
|
|
52
|
+
To install the package the simplest procedure is:
|
|
53
|
+
```bash
|
|
54
|
+
pip install numfolio
|
|
55
|
+
```
|
|
56
|
+
Now you can test the installation... In a python shell:
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
import numfolio as nf
|
|
60
|
+
|
|
61
|
+
nf.__version__
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Optional dependencies are `docs` for documentation and
|
|
65
|
+
`build` for development. To install optional
|
|
66
|
+
dependencies `pip install numfolio[docs,build]`.
|
|
67
|
+
|
|
68
|
+
## 📚 Example Usage
|
|
69
|
+
|
|
70
|
+
### 1. Compute Scorecard from PnL or Returns:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
import pandas as pd
|
|
74
|
+
from numfolio import get_scorecard
|
|
75
|
+
|
|
76
|
+
# Sample PnL data
|
|
77
|
+
dates = pd.date_range("2025-01-01", periods=60, freq="D")
|
|
78
|
+
pnl = pd.Series(range(100, 160), index=dates)
|
|
79
|
+
|
|
80
|
+
df = pd.DataFrame({"pnl": pnl})
|
|
81
|
+
|
|
82
|
+
scorecard = get_scorecard(df, freq="M")
|
|
83
|
+
print(scorecard)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 2. Estimate Bootstrapped Sharpe Ratio:
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
import numpy as np
|
|
90
|
+
from numfolio import bootstrap_metric
|
|
91
|
+
|
|
92
|
+
# Generate fake returns
|
|
93
|
+
returns = np.random.default_rng().normal(0, 1, 100)
|
|
94
|
+
|
|
95
|
+
bootstrapped = bootstrap_metric(returns, metric="sharpe_ratio", n_bootstraps=500)
|
|
96
|
+
print("Bootstrapped Sharpe Ratios:", bootstrapped[:5])
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 3. Estimate Correlation Matrix:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
import pandas as pd
|
|
103
|
+
import numpy as np
|
|
104
|
+
from numfolio import estimate_correlation
|
|
105
|
+
|
|
106
|
+
dates = pd.date_range("2025-01-01", periods=100, freq="D")
|
|
107
|
+
returns = pd.DataFrame(np.random.default_rng().normal(0, 1, (100, 3)), columns=["A", "B", "C"], index=dates)
|
|
108
|
+
|
|
109
|
+
correlation = estimate_correlation(returns, method="ledoit_wolf", n_bootstraps=200)
|
|
110
|
+
print(correlation)
|
|
111
|
+
```
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
numfolio-0.0.1.dist-info/licenses/LICENSE,sha256=H-tRTUYkf6FsB6gRbZclO0NAbh8-3hzJKr0lTAltPSU,1063
|
|
2
|
+
numfolio-0.0.1.dist-info/METADATA,sha256=pPHvMPDRMH5NBoS4o2HC2-fLQxITQsVBSdlzCaBs7BA,2951
|
|
3
|
+
numfolio-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
4
|
+
numfolio-0.0.1.dist-info/top_level.txt,sha256=S-k06nr433UVQykNfpWpfgtsvn6n47_ou53wfXhJsuc,9
|
|
5
|
+
numfolio-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Andrea
|
|
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
|
+
numfolio
|