eaglelandsonce commited on
Commit
035899a
1 Parent(s): a5038fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +123 -5
app.py CHANGED
@@ -53,6 +53,124 @@ STEP2_TITLE = """<h1 align="center">Create a Financial OutLook Report of Your Po
53
  STEP3_TITLE = """<h1 align="center">Optimize Your Portfolio to Maximize Return</h1>"""
54
 
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  # LangChain function for company analysis
57
 
58
  def company_analysis(api_key: str, company_name: str) -> dict:
@@ -413,9 +531,6 @@ def crewai_process(research_topic):
413
 
414
 
415
 
416
-
417
-
418
-
419
  # Portfolio Analysis +++++++++++++++++++++++++++++++++++
420
 
421
  def plot_cum_returns(data, title):
@@ -497,12 +612,15 @@ def output_results(start_date, end_date, tickers_string):
497
  # Interface =============================================
498
 
499
 
500
-
501
  with gr.Blocks() as demo:
502
 
503
  with gr.Tab("Step 1: Portfolio Generator"):
504
  gr.HTML(STEP1_TITLE)
505
-
 
 
 
 
506
 
507
 
508
  with gr.Tab("Step 2: Financial Outlook"):
 
53
  STEP3_TITLE = """<h1 align="center">Optimize Your Portfolio to Maximize Return</h1>"""
54
 
55
 
56
+ portfolios_output = """
57
+ Creating a Conservative Portfolio
58
+
59
+ Title: Steady and Secure: A Conservative Portfolio Approach
60
+
61
+ Introduction:
62
+ In the world of investments, a conservative portfolio is akin to a steady ship in turbulent seas. It's designed for those who seek stability over high risks, focusing on preserving capital and generating regular income. This approach is particularly appealing to retirees or those nearing retirement, who prioritize safeguarding their wealth over aggressive growth.
63
+
64
+ Rational for Selection of Each Stock:
65
+
66
+ Coca-Cola (KO): A classic example of stability and consistent dividend payout, Coca-Cola's global brand strength makes it a reliable choice for conservative investors.
67
+ Procter & Gamble (PG): Known for its wide range of consumer products, PG offers consistent performance and a strong history of dividend payments.
68
+ Johnson & Johnson (JNJ): A leader in healthcare, JNJ's diversified portfolio and strong financials offer low volatility and dependable dividends.
69
+ Verizon Communications (VZ): As a telecom giant, Verizon provides essential services, ensuring steady demand and reliable dividends.
70
+ Pfizer (PFE): A pharmaceutical stalwart, Pfizer offers a blend of stability and moderate growth, backed by a solid dividend history.
71
+ McDonald's (MCD): A global fast-food leader, McDonald’s demonstrates resilient performance and steady dividends, even in economic downturns.
72
+ Walmart (WMT): The retail giant's consistent performance and dividend history make it a stable choice for conservative portfolios.
73
+ 3M (MMM): Known for its innovation and diversified product line, 3M offers stability and a long history of dividend growth.
74
+ The Southern Company (SO): As a utility company, SO provides essential services, leading to consistent demand and steady dividends.
75
+ Duke Energy (DUK): Another utility company, Duke Energy's focus on essential services ensures stable revenues and dividends.
76
+ Conclusion:
77
+ This conservative portfolio is built on the bedrock of stability, resilience, and regular income. It's tailored for investors who prioritize capital preservation and steady income over high-risk, high-reward strategies.
78
+
79
+ Portfolio Tickers: KO, PG, JNJ, VZ, PFE, MCD, WMT, MMM, SO, DUK
80
+
81
+ Creating a Growth Portfolio
82
+
83
+ Title: Nurturing Wealth: A Growth-Oriented Portfolio Strategy
84
+
85
+ Introduction:
86
+
87
+ For the investor with an eye on the future and a stomach for some risk, a growth portfolio is the way to go. This strategy is ideal for those aiming for long-term capital appreciation. It typically includes stocks of companies with significant growth potential, such as those in technology, healthcare, and renewable energy sectors.
88
+
89
+ Rational for Selection of Each Stock:
90
+
91
+ Apple Inc. (AAPL): A leader in technology, Apple's continuous innovation and strong market presence make it a prime candidate for growth.
92
+ Amazon.com Inc. (AMZN): With its ever-expanding business and dominance in e-commerce and cloud computing, Amazon is poised for sustained growth.
93
+ Tesla Inc. (TSLA): At the forefront of the electric vehicle revolution, Tesla's growth potential in a transforming auto industry is substantial.
94
+ NVIDIA Corporation (NVDA): A key player in the gaming and AI sectors, NVIDIA's cutting-edge technology positions it for strong growth.
95
+ Alphabet Inc. (GOOGL): Google's parent company, with its diverse range of rapidly growing businesses, is a staple in any growth portfolio.
96
+ Microsoft Corporation (MSFT): A tech giant with consistent growth in cloud computing and software, Microsoft is a robust choice for growth.
97
+ Netflix, Inc. (NFLX): As a leader in streaming media, Netflix's ongoing global expansion and content creation suggest significant growth potential.
98
+ Visa Inc. (V): With the increasing shift to digital payments, Visa's global network positions it well for growth in fintech.
99
+ Mastercard Incorporated (MA): Similar to Visa, Mastercard's role in the growing digital payment sector offers strong growth prospects.
100
+ Salesforce.com, Inc. (CRM): As a leader in cloud-based customer relationship management software, Salesforce is well-positioned for growth in the digital transformation of businesses.
101
+ Conclusion:
102
+ This growth portfolio is designed for the long-term investor who seeks capital appreciation and is comfortable with higher risk. It leverages the potential of market leaders and innovators across various sectors, setting the stage for significant growth over time.
103
+
104
+ Portfolio Tickers: AAPL, AMZN, TSLA, NVDA, GOOGL, MSFT, NFLX, V, MA, CRM
105
+
106
+ Creating a Balanced Portfolio
107
+
108
+ Title: Harmonizing Growth and Stability: The Balanced Portfolio
109
+
110
+ Introduction:
111
+ A balanced portfolio is the middle ground in investment strategy, blending the growth potential of stocks with the stability of bonds and other income-generating assets. This approach aims to moderate risk while still offering opportunities for capital appreciation and income. It's well-suited for investors who desire a mix of growth and income with a moderate risk profile.
112
+
113
+ Rational for Selection of Each Stock:
114
+
115
+ Apple Inc. (AAPL): As a tech giant with a solid track record, Apple offers both growth potential and relative stability, a perfect fit for a balanced portfolio.
116
+ JPMorgan Chase & Co. (JPM): A leading financial institution, JPMorgan brings stability and potential for capital appreciation, along with steady dividends.
117
+ Johnson & Johnson (JNJ): A diversified healthcare company, JNJ offers stability and consistent dividends, making it a reliable choice for balanced investing.
118
+ Procter & Gamble (PG): With a wide array of consumer products, PG is known for its stability and consistent dividend payouts.
119
+ The Coca-Cola Company (KO): A global beverage leader, Coca-Cola provides steady income through dividends, along with potential for moderate growth.
120
+ Microsoft Corporation (MSFT): A blend of growth and stability, Microsoft's strong financials and innovative edge make it a balanced choice.
121
+ Pfizer Inc. (PFE): In the healthcare sector, Pfizer offers a combination of stability, dividend income, and potential growth.
122
+ Verizon Communications Inc. (VZ): As a telecom giant, Verizon provides stable dividends and operates in a relatively stable industry.
123
+ 3M Company (MMM): Known for its diversified industrial products, 3M offers a balance of stability and growth potential.
124
+ Walmart Inc. (WMT): The retail giant's consistent performance and defensive nature in economic downturns make it a balanced choice.
125
+ Conclusion:
126
+ This balanced portfolio is carefully crafted to provide a blend of stability and growth. It's an ideal choice for investors seeking a diversified approach, with a mix of reliable income and potential for capital appreciation.
127
+
128
+ Portfolio Tickers: AAPL, JPM, JNJ, PG, KO, MSFT, PFE, VZ, MMM, WMT
129
+
130
+ Creating an Aggressive Portfolio
131
+
132
+ Title: Pursuit of High Returns: An Aggressive Portfolio Strategy
133
+
134
+ Introduction:
135
+ The aggressive portfolio is designed for the investor who is willing to embrace high risk in pursuit of high returns. This strategy often involves investing in high-growth stocks, emerging market securities, and innovative sectors. It's most suitable for investors with a long-term horizon and a high tolerance for market volatility.
136
+
137
+ Rational for Selection of Each Stock:
138
+
139
+ Tesla, Inc. (TSLA): A leader in the electric vehicle industry, Tesla represents high growth potential in the evolving automotive sector.
140
+ Amazon.com, Inc. (AMZN): Amazon's continuous expansion into new markets and technologies positions it for aggressive growth.
141
+ NVIDIA Corporation (NVDA): With its leading role in AI and gaming, NVIDIA is poised for significant growth in high-tech sectors.
142
+ Alphabet Inc. (GOOGL): The parent company of Google, Alphabet has diverse and rapidly growing business segments, making it a strong candidate for aggressive growth.
143
+ Shopify Inc. (SHOP): As an e-commerce platform, Shopify has high growth potential in the expanding online retail space.
144
+ Square, Inc. (SQ): Operating in the fintech space, Square's innovative payment solutions position it for aggressive growth.
145
+ Moderna, Inc. (MRNA): A biotech company with a focus on mRNA technology, Moderna has high growth potential in the healthcare sector.
146
+ Zoom Video Communications, Inc. (ZM): A leader in remote communication solutions, Zoom has the potential for aggressive growth in the evolving workplace.
147
+ Snowflake Inc. (SNOW): A cloud computing company, Snowflake's innovative data platform positions it for high growth in the tech sector.
148
+ Peloton Interactive, Inc. (PTON): In the fitness technology space, Peloton's innovative business model offers high growth potential.
149
+ Conclusion:
150
+ This aggressive portfolio is tailored for those seeking exponential growth and who are comfortable with high levels of risk. It leverages the potential of companies in rapidly growing industries and innovative sectors, making it suitable for long-term, risk-tolerant investors.
151
+
152
+ Portfolio Tickers: TSLA, AMZN, NVDA, GOOGL, SHOP, SQ, MRNA, ZM, SNOW, PTON
153
+
154
+ Summary of Portfolio Strategies
155
+
156
+ Overview:
157
+ In this comprehensive investment guide, we explored four distinct portfolio strategies, each tailored to different investor profiles and risk tolerances. From the steady and secure conservative approach to the high-risk, high-reward aggressive strategy, these portfolios offer a range of options for investors with varying objectives and time horizons.
158
+
159
+ Summary of Each Portfolio:
160
+
161
+ Conservative Portfolio: Focused on stability and income generation, this portfolio includes stocks like KO, PG, and JNJ. Ideal for risk-averse investors, especially those nearing retirement, it emphasizes capital preservation and steady dividend income.
162
+
163
+ Growth Portfolio: Targeting long-term capital appreciation, this portfolio features companies like AAPL, AMZN, and TSLA. Suited for investors with a longer horizon and higher risk tolerance, it focuses on stocks with significant growth potential.
164
+
165
+ Balanced Portfolio: Aiming for a middle-ground approach, this portfolio includes a mix of stable and growth-oriented stocks like AAPL, JPM, and MSFT. It's designed for investors seeking both income and moderate capital appreciation, with a diversified risk profile.
166
+
167
+ Aggressive Portfolio: Geared towards maximum growth, this strategy includes high-growth stocks like TSLA, NVDA, and GOOGL. Suitable for investors with a high risk tolerance and a long-term investment horizon, it focuses on sectors with high potential for rapid growth.
168
+
169
+ Conclusion:
170
+ These tailored portfolios offer a range of investment strategies to suit different investor needs. Whether prioritizing income and stability or seeking aggressive growth, each portfolio is constructed with a specific investment goal and risk tolerance in mind.
171
+ """
172
+
173
+
174
  # LangChain function for company analysis
175
 
176
  def company_analysis(api_key: str, company_name: str) -> dict:
 
531
 
532
 
533
 
 
 
 
534
  # Portfolio Analysis +++++++++++++++++++++++++++++++++++
535
 
536
  def plot_cum_returns(data, title):
 
612
  # Interface =============================================
613
 
614
 
 
615
  with gr.Blocks() as demo:
616
 
617
  with gr.Tab("Step 1: Portfolio Generator"):
618
  gr.HTML(STEP1_TITLE)
619
+ with gr.Row():
620
+ with gr.Column(scale=1):
621
+ gr.Image(value="resources/trag2.jpg")
622
+ with gr.Column(scale=5):
623
+ gr.Textbox(value = portfolios_output, label="Generated Portfolios Example", lines=40, interactive=False )
624
 
625
 
626
  with gr.Tab("Step 2: Financial Outlook"):