finalytics 0.4.2__tar.gz → 0.5.0__tar.gz
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.
- {finalytics-0.4.2 → finalytics-0.5.0}/PKG-INFO +25 -25
- finalytics-0.5.0/README.md +135 -0
- {finalytics-0.4.2 → finalytics-0.5.0}/pyproject.toml +1 -1
- {finalytics-0.4.2 → finalytics-0.5.0}/python/Cargo.toml +3 -3
- {finalytics-0.4.2 → finalytics-0.5.0}/python/README.md +23 -24
- finalytics-0.5.0/python/docs/_publish.yml +4 -0
- finalytics-0.5.0/python/docs/_quarto.yml +21 -0
- finalytics-0.5.0/python/docs/index.qmd +61 -0
- finalytics-0.5.0/python/docs/portfolio.qmd +136 -0
- finalytics-0.5.0/python/docs/ticker.qmd +320 -0
- finalytics-0.5.0/python/docs/tickers.qmd +291 -0
- {finalytics-0.4.2 → finalytics-0.5.0}/python/src/ffi.rs +6 -6
- {finalytics-0.4.2 → finalytics-0.5.0}/python/src/lib.rs +7 -1
- {finalytics-0.4.2 → finalytics-0.5.0}/python/src/portfolio.rs +64 -22
- finalytics-0.5.0/python/src/technicals.rs +86 -0
- {finalytics-0.4.2 → finalytics-0.5.0}/python/src/ticker.rs +142 -33
- finalytics-0.5.0/python/src/tickers.rs +219 -0
- finalytics-0.5.0/python/test.py +44 -0
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/Cargo.toml +8 -6
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/src/analytics/fundamentals.rs +6 -1
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/src/analytics/mod.rs +0 -1
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/src/analytics/optimization.rs +16 -12
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/src/analytics/performance.rs +41 -77
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/src/analytics/statistics.rs +40 -0
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/src/analytics/technicals.rs +240 -112
- finalytics-0.5.0/rust/src/charts/frame.rs +88 -0
- {finalytics-0.4.2/finalytics/src/models → finalytics-0.5.0/rust/src/charts}/mod.rs +2 -1
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/src/charts/portfolio.rs +29 -18
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/src/charts/ticker.rs +94 -32
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/src/data/config.rs +15 -0
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/src/data/ticker.rs +84 -14
- finalytics-0.5.0/rust/src/lib.rs +115 -0
- finalytics-0.5.0/rust/src/models/mod.rs +3 -0
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/src/models/portfolio.rs +13 -12
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/src/models/ticker.rs +27 -25
- finalytics-0.5.0/rust/src/models/tickers.rs +695 -0
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/src/utils/chart_utils.rs +1 -0
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/src/utils/date_utils.rs +16 -1
- finalytics-0.5.0/rust/src/utils/web_utils.rs +118 -0
- finalytics-0.4.2/README.md +0 -160
- finalytics-0.4.2/finalytics/src/analytics/sentiment.rs +0 -116
- finalytics-0.4.2/finalytics/src/charts/mod.rs +0 -2
- finalytics-0.4.2/finalytics/src/lib.rs +0 -79
- finalytics-0.4.2/finalytics/src/utils/web_utils.rs +0 -88
- finalytics-0.4.2/python/conf.py +0 -28
- finalytics-0.4.2/python/index.rst +0 -198
- finalytics-0.4.2/python/test.py +0 -36
- {finalytics-0.4.2 → finalytics-0.5.0}/python/Cargo.lock +0 -0
- {finalytics-0.4.2 → finalytics-0.5.0}/python/build.sh +0 -0
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/src/analytics/stochastics.rs +0 -0
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/src/data/mod.rs +0 -0
- {finalytics-0.4.2/finalytics → finalytics-0.5.0/rust}/src/utils/mod.rs +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: finalytics
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
@@ -9,6 +9,7 @@ Requires-Dist: pyarrow ==14.0.0
|
|
|
9
9
|
Requires-Dist: plotly ==5.22.0
|
|
10
10
|
Requires-Dist: notebook >=5.3
|
|
11
11
|
Requires-Dist: ipywidgets >=7.5
|
|
12
|
+
Requires-Dist: numpy <2
|
|
12
13
|
Requires-Python: >=3.7
|
|
13
14
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
14
15
|
|
|
@@ -32,39 +33,38 @@ This is a python binding for [Finalytics Rust Library](https://github.com/Nnamdi
|
|
|
32
33
|
pip install finalytics
|
|
33
34
|
```
|
|
34
35
|
|
|
35
|
-
##
|
|
36
|
+
## Example
|
|
36
37
|
|
|
37
|
-
View
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
### Security Analysis
|
|
38
|
+
View the [documentation](https://nnamdi.quarto.pub/finalytics/) for more information.
|
|
41
39
|
|
|
42
40
|
```python
|
|
43
|
-
from finalytics import
|
|
41
|
+
from finalytics import Tickers
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
# Instantiate a Multiple Ticker Object
|
|
44
|
+
tickers = Tickers(symbols=["NVDA", "GOOG", "AAPL", "MSFT", "BTC-USD"],
|
|
45
|
+
start_date="2020-01-01",
|
|
46
|
+
end_date="2024-01-01",
|
|
47
|
+
interval="1d",
|
|
48
|
+
confidence_level=0.95,
|
|
49
|
+
risk_free_rate=0.02)
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
```
|
|
51
|
+
# Calculate the Performance Statistics of all the Tickers
|
|
52
|
+
print(tickers.performance_stats())
|
|
55
53
|
|
|
56
|
-
|
|
54
|
+
# Display the Security Analysis Charts
|
|
55
|
+
tickers.returns_chart().show()
|
|
56
|
+
tickers.returns_matrix().show()
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
# Perform Portfolio Optimization
|
|
59
|
+
portfolio = tickers.optimize()
|
|
60
|
+
print(portfolio.optimization_results())
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
# Display the Portfolio Optimization Charts
|
|
63
|
+
portfolio.optimization_chart().show()
|
|
64
|
+
portfolio.performance_chart().show()
|
|
65
|
+
portfolio.asset_returns_chart().show()
|
|
66
|
+
portfolio.performance_stats_table().show()
|
|
65
67
|
|
|
66
|
-
print(portfolio.get_optimization_results())
|
|
67
|
-
portfolio.portfolio_chart("performance").show()
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
[](https://crates.io/crates/finalytics)
|
|
4
|
+
[](https://docs.rs/finalytics/)
|
|
5
|
+

|
|
6
|
+
[](https://finalytics.rs/)
|
|
7
|
+
[](https://www.codefactor.io/repository/github/nnamdi-sys/finalytics)
|
|
8
|
+
|
|
9
|
+
**Finalytics** is a Rust library designed for retrieving financial data and performing security analysis and portfolio optimization.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Add the following to your `Cargo.toml` file:
|
|
14
|
+
|
|
15
|
+
```toml
|
|
16
|
+
[dependencies]
|
|
17
|
+
finalytics = "*"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or run the following command:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
cargo install finalytics
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Example
|
|
27
|
+
|
|
28
|
+
View the [documentation](https://docs.rs/finalytics/) for more information.
|
|
29
|
+
|
|
30
|
+
```rust
|
|
31
|
+
use std::error::Error;
|
|
32
|
+
use finalytics::prelude::*;
|
|
33
|
+
|
|
34
|
+
#[tokio::main]
|
|
35
|
+
async fn main() -> Result<(), Box<dyn Error>> {
|
|
36
|
+
|
|
37
|
+
// Instantiate a Multiple Ticker Object
|
|
38
|
+
let ticker_symbols = Vec::from(["NVDA", "GOOG", "AAPL", "MSFT", "BTC-USD"]);
|
|
39
|
+
|
|
40
|
+
let tickers = TickersBuilder::new()
|
|
41
|
+
.tickers(ticker_symbols)
|
|
42
|
+
.start_date("2020-01-01")
|
|
43
|
+
.end_date("2024-01-01")
|
|
44
|
+
.interval(Interval::OneDay)
|
|
45
|
+
.benchmark_symbol("^GSPC")
|
|
46
|
+
.confidence_level(0.95)
|
|
47
|
+
.risk_free_rate(0.02)
|
|
48
|
+
.build();
|
|
49
|
+
|
|
50
|
+
// Calculate the Performance Statistics of all the Tickers
|
|
51
|
+
let performance_stats = tickers.performance_stats().await?;
|
|
52
|
+
println!("{:?}", performance_stats);
|
|
53
|
+
|
|
54
|
+
// Display the Security Analysis Charts
|
|
55
|
+
tickers.returns_chart(None, None).await?.show();
|
|
56
|
+
tickers.returns_matrix(None, None).await?.show();
|
|
57
|
+
|
|
58
|
+
// Perform a Portfolio Optimization
|
|
59
|
+
let portfolio = tickers.optimize_portfolio(ObjectiveFunction::MaxSharpe).await?;
|
|
60
|
+
println!("{:?}", portfolio.performance_stats);
|
|
61
|
+
|
|
62
|
+
// Display the Portfolio Optimization Charts
|
|
63
|
+
portfolio.performance_stats_table(None, None)?.show();
|
|
64
|
+
portfolio.optimization_chart(None, None)?.show();
|
|
65
|
+
portfolio.performance_chart(None, None)?.show();
|
|
66
|
+
portfolio.asset_returns_chart(None, None)?.show();
|
|
67
|
+
|
|
68
|
+
Ok(())
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## Python Binding
|
|
74
|
+
|
|
75
|
+
[](https://pypi.org/project/finalytics/)
|
|
76
|
+

|
|
77
|
+
[](https://finalytics.rs/)
|
|
78
|
+
[](https://nnamdi.quarto.pub/finalytics/)
|
|
79
|
+

|
|
80
|
+

|
|
81
|
+

|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
## Installation
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pip install finalytics
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Example
|
|
91
|
+
|
|
92
|
+
View the [documentation](https://nnamdi.quarto.pub/finalytics/) for more information.
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
from finalytics import Tickers
|
|
96
|
+
|
|
97
|
+
# Instantiate a Multiple Ticker Object
|
|
98
|
+
tickers = Tickers(symbols=["NVDA", "GOOG", "AAPL", "MSFT", "BTC-USD"],
|
|
99
|
+
start_date="2020-01-01",
|
|
100
|
+
end_date="2024-01-01",
|
|
101
|
+
interval="1d",
|
|
102
|
+
confidence_level=0.95,
|
|
103
|
+
risk_free_rate=0.02)
|
|
104
|
+
|
|
105
|
+
# Calculate the Performance Statistics of all the Tickers
|
|
106
|
+
print(tickers.performance_stats())
|
|
107
|
+
|
|
108
|
+
# Display the Security Analysis Charts
|
|
109
|
+
tickers.returns_chart().show()
|
|
110
|
+
tickers.returns_matrix().show()
|
|
111
|
+
|
|
112
|
+
# Perform Portfolio Optimization
|
|
113
|
+
portfolio = tickers.optimize()
|
|
114
|
+
print(portfolio.optimization_results())
|
|
115
|
+
|
|
116
|
+
# Display the Portfolio Optimization Charts
|
|
117
|
+
portfolio.optimization_chart().show()
|
|
118
|
+
portfolio.performance_chart().show()
|
|
119
|
+
portfolio.asset_returns_chart().show()
|
|
120
|
+
portfolio.performance_stats_table().show()
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
## Sample Applications
|
|
126
|
+
|
|
127
|
+
<h3><a href="https://finalytics.rs/ticker">Ticker Charts Viewer</a></h3>
|
|
128
|
+
|
|
129
|
+
This sample application allows you to perform security analysis based on the Finalytics Library.
|
|
130
|
+
|
|
131
|
+
<h3><a href="https://finalytics.rs/portfolio">Portfolio Charts Viewer</a></h3>
|
|
132
|
+
|
|
133
|
+
This sample application enables you to perform portfolio optimization based on the Finalytics Library.
|
|
134
|
+
|
|
135
|
+
|
|
@@ -10,7 +10,7 @@ classifiers = [
|
|
|
10
10
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
11
11
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
12
12
|
]
|
|
13
|
-
dependencies = ["polars==0.19.12", "pyarrow==14.0.0", "plotly==5.22.0", "notebook>=5.3", "ipywidgets>=7.5"]
|
|
13
|
+
dependencies = ["polars==0.19.12", "pyarrow==14.0.0", "plotly==5.22.0", "notebook>=5.3", "ipywidgets>=7.5", "numpy<2"]
|
|
14
14
|
|
|
15
15
|
[tool]
|
|
16
16
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "finalytics-py"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.5.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
|
|
@@ -9,8 +9,8 @@ name = "finalytics"
|
|
|
9
9
|
crate-type = ["cdylib"]
|
|
10
10
|
|
|
11
11
|
[dependencies]
|
|
12
|
-
finalytics = { path = "../
|
|
12
|
+
finalytics = { path = "../rust", features = ["kaleido"] }
|
|
13
13
|
polars = "0.41.3"
|
|
14
14
|
tokio = { version = "1.32.0", features = ["full"] }
|
|
15
|
-
pyo3 = { version = "0.
|
|
15
|
+
pyo3 = { version = "0.22.2", features = ["extension-module", "generate-import-lib", "gil-refs"] }
|
|
16
16
|
plotly = "0.9.0"
|
|
@@ -18,39 +18,38 @@ This is a python binding for [Finalytics Rust Library](https://github.com/Nnamdi
|
|
|
18
18
|
pip install finalytics
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## Example
|
|
22
22
|
|
|
23
|
-
View
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
### Security Analysis
|
|
23
|
+
View the [documentation](https://nnamdi.quarto.pub/finalytics/) for more information.
|
|
27
24
|
|
|
28
25
|
```python
|
|
29
|
-
from finalytics import
|
|
26
|
+
from finalytics import Tickers
|
|
30
27
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
# Instantiate a Multiple Ticker Object
|
|
29
|
+
tickers = Tickers(symbols=["NVDA", "GOOG", "AAPL", "MSFT", "BTC-USD"],
|
|
30
|
+
start_date="2020-01-01",
|
|
31
|
+
end_date="2024-01-01",
|
|
32
|
+
interval="1d",
|
|
33
|
+
confidence_level=0.95,
|
|
34
|
+
risk_free_rate=0.02)
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
```
|
|
36
|
+
# Calculate the Performance Statistics of all the Tickers
|
|
37
|
+
print(tickers.performance_stats())
|
|
41
38
|
|
|
42
|
-
|
|
39
|
+
# Display the Security Analysis Charts
|
|
40
|
+
tickers.returns_chart().show()
|
|
41
|
+
tickers.returns_matrix().show()
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
# Perform Portfolio Optimization
|
|
44
|
+
portfolio = tickers.optimize()
|
|
45
|
+
print(portfolio.optimization_results())
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
# Display the Portfolio Optimization Charts
|
|
48
|
+
portfolio.optimization_chart().show()
|
|
49
|
+
portfolio.performance_chart().show()
|
|
50
|
+
portfolio.asset_returns_chart().show()
|
|
51
|
+
portfolio.performance_stats_table().show()
|
|
51
52
|
|
|
52
|
-
print(portfolio.get_optimization_results())
|
|
53
|
-
portfolio.portfolio_chart("performance").show()
|
|
54
53
|
```
|
|
55
54
|
|
|
56
55
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
project:
|
|
2
|
+
type: website
|
|
3
|
+
|
|
4
|
+
website:
|
|
5
|
+
title: "Finalytics"
|
|
6
|
+
sidebar:
|
|
7
|
+
tools:
|
|
8
|
+
- icon: github
|
|
9
|
+
href: https://github.com/Nnamdi-sys/finalytics/tree/main
|
|
10
|
+
style: "docked"
|
|
11
|
+
search: true
|
|
12
|
+
contents:
|
|
13
|
+
- text: "Introduction"
|
|
14
|
+
href: index.qmd
|
|
15
|
+
- text: "Ticker Module"
|
|
16
|
+
href: ticker.qmd
|
|
17
|
+
- text: "Tickers Module"
|
|
18
|
+
href: tickers.qmd
|
|
19
|
+
- text: "Portfolio Module"
|
|
20
|
+
href: portfolio.qmd
|
|
21
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/finalytics/)
|
|
4
|
+

|
|
5
|
+
[](https://finalytics.rs/)
|
|
6
|
+
[](https://nnamdi.quarto.pub/finalytics/)
|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# Welcome to the Finalytics Documentation
|
|
13
|
+
|
|
14
|
+
This is a python binding for [Finalytics Rust Library](https://github.com/Nnamdi-sys/finalytics) designed for retrieving financial data and performing security analysis and portfolio optimization.
|
|
15
|
+
|
|
16
|
+
### Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install finalytics
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Documentation
|
|
23
|
+
|
|
24
|
+
- [Ticker Module](ticker.qmd)
|
|
25
|
+
- [Tickers Module](tickers.qmd)
|
|
26
|
+
- [Portfolio Module](portfolio.qmd)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Example
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from finalytics import Tickers
|
|
33
|
+
|
|
34
|
+
# Instantiate a Multiple Ticker Object
|
|
35
|
+
tickers = Tickers(symbols=["NVDA", "GOOG", "AAPL", "MSFT", "BTC-USD"],
|
|
36
|
+
start_date="2020-01-01",
|
|
37
|
+
end_date="2024-01-01",
|
|
38
|
+
interval="1d",
|
|
39
|
+
confidence_level=0.95,
|
|
40
|
+
risk_free_rate=0.02)
|
|
41
|
+
|
|
42
|
+
# Calculate the Performance Statistics of all the Tickers
|
|
43
|
+
print(tickers.performance_stats())
|
|
44
|
+
|
|
45
|
+
# Display the Security Analysis Charts
|
|
46
|
+
tickers.returns_chart().show()
|
|
47
|
+
tickers.returns_matrix().show()
|
|
48
|
+
|
|
49
|
+
# Perform Portfolio Optimization
|
|
50
|
+
portfolio = tickers.optimize()
|
|
51
|
+
print(portfolio.optimization_results())
|
|
52
|
+
|
|
53
|
+
# Display the Portfolio Optimization Charts
|
|
54
|
+
portfolio.optimization_chart().show()
|
|
55
|
+
portfolio.performance_chart().show()
|
|
56
|
+
portfolio.asset_returns_chart().show()
|
|
57
|
+
portfolio.performance_stats_table().show()
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Portfolio Module Documentation
|
|
3
|
+
format:
|
|
4
|
+
html:
|
|
5
|
+
page-layout: full
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
### Portfolio
|
|
9
|
+
|
|
10
|
+
A class representing a Portfolio object.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<details>
|
|
14
|
+
<summary>`__new__`</summary>
|
|
15
|
+
|
|
16
|
+
Create a new Portfolio object.
|
|
17
|
+
|
|
18
|
+
**Parameters:**
|
|
19
|
+
|
|
20
|
+
- `ticker_symbols` (List[str]): List of ticker symbols in the portfolio.
|
|
21
|
+
- `benchmark_symbol` (str): The ticker symbol of the benchmark.
|
|
22
|
+
- `start_date` (str): The start date for historical data.
|
|
23
|
+
- `end_date` (str): The end date for historical data.
|
|
24
|
+
- `interval` (str): The interval for historical data.
|
|
25
|
+
- `confidence_level` (float): The confidence level for risk calculations.
|
|
26
|
+
- `risk_free_rate` (float): The risk-free rate for calculations.
|
|
27
|
+
- `objective_function` (Optional[str]): The objective function for optimization.
|
|
28
|
+
- `constraints` (Optional[List[Tuple[float, float]]]): Constraints for optimization.
|
|
29
|
+
|
|
30
|
+
**Returns:**
|
|
31
|
+
|
|
32
|
+
- `Portfolio`: A Portfolio object.
|
|
33
|
+
|
|
34
|
+
**Example:**
|
|
35
|
+
|
|
36
|
+
```{python}
|
|
37
|
+
from finalytics import Portfolio
|
|
38
|
+
|
|
39
|
+
portfolio = Portfolio(ticker_symbols=["AAPL", "GOOG", "MSFT", "NVDA", "BTC-USD"],
|
|
40
|
+
benchmark_symbol="^GSPC",
|
|
41
|
+
start_date="2020-01-01",
|
|
42
|
+
end_date="2024-01-01",
|
|
43
|
+
interval="1d",
|
|
44
|
+
confidence_level=0.95,
|
|
45
|
+
risk_free_rate=0.02,
|
|
46
|
+
objective_function="max_sharpe",
|
|
47
|
+
constraints=[(0, 1), (0, 1), (0, 1), (0, 1), (0,1)])
|
|
48
|
+
```
|
|
49
|
+
</details>
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
<details>
|
|
53
|
+
<summary>`optimization_results`</summary>
|
|
54
|
+
|
|
55
|
+
Get the optimization results for the portfolio.
|
|
56
|
+
|
|
57
|
+
**Returns:**
|
|
58
|
+
|
|
59
|
+
- `dict`: Dictionary containing the portfolio optimization results.
|
|
60
|
+
|
|
61
|
+
**Example:**
|
|
62
|
+
|
|
63
|
+
```{python}
|
|
64
|
+
optimization_results = portfolio.optimization_results()
|
|
65
|
+
print(optimization_results)
|
|
66
|
+
```
|
|
67
|
+
</details>
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
<details>
|
|
71
|
+
<summary>`performance_stats_table`</summary>
|
|
72
|
+
|
|
73
|
+
Display the performance stats table plot for the portfolio.
|
|
74
|
+
|
|
75
|
+
**Parameters:**
|
|
76
|
+
|
|
77
|
+
- `height` (Optional[int]): Optional height of the plot in pixels, defaults to None.
|
|
78
|
+
- `width` (Optional[int]): Optional width of the plot in pixels, defaults to None.
|
|
79
|
+
|
|
80
|
+
**Returns:**
|
|
81
|
+
|
|
82
|
+
- `Plot`: Plot object containing the performance stats table.
|
|
83
|
+
|
|
84
|
+
**Example:**
|
|
85
|
+
|
|
86
|
+
```{python}
|
|
87
|
+
performance_stats = portfolio.performance_stats_table()
|
|
88
|
+
performance_stats.show()
|
|
89
|
+
```
|
|
90
|
+
</details>
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
<details>
|
|
94
|
+
<summary>`optimization_chart`</summary>
|
|
95
|
+
|
|
96
|
+
Display the efficient frontier and allocation chart for the portfolio.
|
|
97
|
+
|
|
98
|
+
**Parameters:**
|
|
99
|
+
|
|
100
|
+
- `height` (Optional[int]): Optional height of the plot in pixels, defaults to None.
|
|
101
|
+
- `width` (Optional[int]): Optional width of the plot in pixels, defaults to None.
|
|
102
|
+
|
|
103
|
+
**Returns:**
|
|
104
|
+
|
|
105
|
+
- `Plot`: Plot object containing the portfolio optimization chart.
|
|
106
|
+
|
|
107
|
+
**Example:**
|
|
108
|
+
|
|
109
|
+
```{python}
|
|
110
|
+
optimization_chart = portfolio.optimization_chart()
|
|
111
|
+
optimization_chart.show()
|
|
112
|
+
```
|
|
113
|
+
</details>
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
<details>
|
|
117
|
+
<summary>`performance_chart`</summary>
|
|
118
|
+
|
|
119
|
+
Display the performance chart for the portfolio.
|
|
120
|
+
|
|
121
|
+
**Parameters:**
|
|
122
|
+
|
|
123
|
+
- `height` (Optional[int]): Optional height of the plot in pixels, defaults to None.
|
|
124
|
+
- `width` (Optional[int]): Optional width of the plot in pixels, defaults to None.
|
|
125
|
+
|
|
126
|
+
**Returns:**
|
|
127
|
+
|
|
128
|
+
- `Plot`: Plot object containing the performance chart.
|
|
129
|
+
|
|
130
|
+
**Example:**
|
|
131
|
+
|
|
132
|
+
```{python}
|
|
133
|
+
performance_chart = portfolio.performance_chart()
|
|
134
|
+
performance_chart.show()
|
|
135
|
+
```
|
|
136
|
+
</details>
|