Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
left-nullspace authored Jul 22, 2024
1 parent 48108dd commit 66ea467
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 3 deletions.
4 changes: 2 additions & 2 deletions OptContentManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def importantDefinitions():
**Understanding the Process:**
- 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).
- The library used for the optimization is [PyPortfolioOpt](https://pyportfolioopt.readthedocs.io/en/latest/)
**📈 Maximum Sharpe Ratio Portfolio:**
- 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.
Expand Down Expand Up @@ -91,4 +91,4 @@ def exampleWalkthrough():
**Blended Strategy:**
- While each portfolio targets specific risk preferences, a blended approach may appeal to investors looking for a balance between growth and safety.
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.
"""
"""
5 changes: 4 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@
plt.grid(True)
st.pyplot(fig)

st.write("Tool Created by Alan")




Expand Down Expand Up @@ -259,6 +261,7 @@
st.write("### Portfolio and Benchmark Ending Values")
st.write(f"**Final Portfolio Balance:** ${portfolio_history.iloc[-1]:,.2f}")
st.write(f"**Final Benchmark Balance:** ${benchmark_history.iloc[-1]:,.2f}")

st.write("Tool Created by Alan ")
except IndexError as e:
st.error(f"An error occurred: {e}")

76 changes: 76 additions & 0 deletions test.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Library Versions:\n",
"Streamlit: 1.36.0\n",
"Pandas: 2.0.3\n",
"Numpy: 1.23.5\n",
"yfinance: 0.2.27\n",
"Matplotlib: 3.7.2\n",
"PyPortfolioOpt: 1.5.5\n",
"datetime: Built-in module, version not applicable.\n"
]
}
],
"source": [
"import streamlit as st\n",
"import pandas as pd\n",
"import numpy as np\n",
"import yfinance as yf\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"import pypfopt\n",
"\n",
"def print_library_versions():\n",
" print(\"Library Versions:\")\n",
" print(f\"Streamlit: {st.__version__}\")\n",
" print(f\"Pandas: {pd.__version__}\")\n",
" print(f\"Numpy: {np.__version__}\")\n",
" print(f\"yfinance: {yf.__version__}\")\n",
" print(f\"Matplotlib: {matplotlib.__version__}\")\n",
" print(f\"PyPortfolioOpt: {pypfopt.__version__}\")\n",
" print(f\"datetime: Built-in module, version not applicable.\")\n",
"\n",
"if __name__ == \"__main__\":\n",
" print_library_versions()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "backtest_dev",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.17"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit 66ea467

Please sign in to comment.