Skip to content

Commit 66ea467

Browse files
Add files via upload
1 parent 48108dd commit 66ea467

File tree

3 files changed

+82
-3
lines changed

3 files changed

+82
-3
lines changed

OptContentManager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def importantDefinitions():
3333
**Understanding the Process:**
3434
- We calculate returns and risks for various asset weightings, plotting them on a scatter plot. Through **optimization**, we identify the 'Efficient Frontier' — the best return for a given risk level. From this, we derive the **Maximum Sharpe Ratio** portfolio, which offers the highest return per unit of risk. Learn more about the Efficient Frontier [here](https://www.investopedia.com/terms/e/efficientfrontier.asp).
3535
- The library used for the optimization is [PyPortfolioOpt](https://pyportfolioopt.readthedocs.io/en/latest/)
36-
36+
3737
**📈 Maximum Sharpe Ratio Portfolio:**
3838
- This portfolio provides the best risk-adjusted return. For instance, a Sharpe ratio of 1.5 means 1.5 units of gain for each unit of risk. It's ideal for those seeking maximum growth with controlled risk.
3939
@@ -91,4 +91,4 @@ def exampleWalkthrough():
9191
**Blended Strategy:**
9292
- While each portfolio targets specific risk preferences, a blended approach may appeal to investors looking for a balance between growth and safety.
9393
By combining elements of both the Maximum Sharpe Ratio and Minimum Volatility portfolios, investors can tailor their exposure to match their individual risk tolerance and investment goals.
94-
"""
94+
"""

app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@
183183
plt.grid(True)
184184
st.pyplot(fig)
185185

186+
st.write("Tool Created by Alan")
187+
186188

187189

188190

@@ -259,6 +261,7 @@
259261
st.write("### Portfolio and Benchmark Ending Values")
260262
st.write(f"**Final Portfolio Balance:** ${portfolio_history.iloc[-1]:,.2f}")
261263
st.write(f"**Final Benchmark Balance:** ${benchmark_history.iloc[-1]:,.2f}")
262-
264+
st.write("Tool Created by Alan ")
263265
except IndexError as e:
264266
st.error(f"An error occurred: {e}")
267+

test.ipynb

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 4,
6+
"metadata": {},
7+
"outputs": [
8+
{
9+
"name": "stdout",
10+
"output_type": "stream",
11+
"text": [
12+
"Library Versions:\n",
13+
"Streamlit: 1.36.0\n",
14+
"Pandas: 2.0.3\n",
15+
"Numpy: 1.23.5\n",
16+
"yfinance: 0.2.27\n",
17+
"Matplotlib: 3.7.2\n",
18+
"PyPortfolioOpt: 1.5.5\n",
19+
"datetime: Built-in module, version not applicable.\n"
20+
]
21+
}
22+
],
23+
"source": [
24+
"import streamlit as st\n",
25+
"import pandas as pd\n",
26+
"import numpy as np\n",
27+
"import yfinance as yf\n",
28+
"import matplotlib\n",
29+
"import matplotlib.pyplot as plt\n",
30+
"import pypfopt\n",
31+
"\n",
32+
"def print_library_versions():\n",
33+
" print(\"Library Versions:\")\n",
34+
" print(f\"Streamlit: {st.__version__}\")\n",
35+
" print(f\"Pandas: {pd.__version__}\")\n",
36+
" print(f\"Numpy: {np.__version__}\")\n",
37+
" print(f\"yfinance: {yf.__version__}\")\n",
38+
" print(f\"Matplotlib: {matplotlib.__version__}\")\n",
39+
" print(f\"PyPortfolioOpt: {pypfopt.__version__}\")\n",
40+
" print(f\"datetime: Built-in module, version not applicable.\")\n",
41+
"\n",
42+
"if __name__ == \"__main__\":\n",
43+
" print_library_versions()\n"
44+
]
45+
},
46+
{
47+
"cell_type": "code",
48+
"execution_count": null,
49+
"metadata": {},
50+
"outputs": [],
51+
"source": []
52+
}
53+
],
54+
"metadata": {
55+
"kernelspec": {
56+
"display_name": "backtest_dev",
57+
"language": "python",
58+
"name": "python3"
59+
},
60+
"language_info": {
61+
"codemirror_mode": {
62+
"name": "ipython",
63+
"version": 3
64+
},
65+
"file_extension": ".py",
66+
"mimetype": "text/x-python",
67+
"name": "python",
68+
"nbconvert_exporter": "python",
69+
"pygments_lexer": "ipython3",
70+
"version": "3.9.17"
71+
},
72+
"orig_nbformat": 4
73+
},
74+
"nbformat": 4,
75+
"nbformat_minor": 2
76+
}

0 commit comments

Comments
 (0)