Spaces:
Sleeping
Sleeping
eaglelandsonce
commited on
Commit
•
c149a37
1
Parent(s):
501c47a
Update app.py
Browse files
app.py
CHANGED
@@ -608,10 +608,10 @@ def output_results(start_date, end_date, tickers_string):
|
|
608 |
return fig_cum_returns_optimized, weights_df, fig_efficient_frontier, fig_corr, \
|
609 |
expected_annual_return, annual_volatility, sharpe_ratio, fig_indiv_prices, fig_cum_returns
|
610 |
|
611 |
-
|
612 |
-
ticker_string_growth = "AAPL,AMZN,TSLA,NVDA,GOOGL,MSFT,NFLX,V,MA,CRM"
|
613 |
-
ticker_string_balanced = "AAPL,JPM,JNJ,PG,KO,MSFT,PFE,VZ,MMM,WMT"
|
614 |
-
ticker_string_agressive = "TSLA,AMZN,NVDA,GOOGL,SHOP,SQ,MRNA,ZM,SNOW,PTON"
|
615 |
|
616 |
|
617 |
# Interface =============================================
|
@@ -625,7 +625,7 @@ with gr.Blocks() as demo:
|
|
625 |
with gr.Column(scale=1):
|
626 |
gr.Image(value="resources/robot1.jpg")
|
627 |
with gr.Column(scale=5):
|
628 |
-
gr.Textbox(value = portfolios_output, label="Generated Portfolios Example (
|
629 |
|
630 |
|
631 |
with gr.Tab("Step 2: Optimize Portfolio"):
|
@@ -640,7 +640,7 @@ with gr.Blocks() as demo:
|
|
640 |
end_date = gr.Textbox(datetime.datetime.now().date(), label="End Date")
|
641 |
with gr.Row():
|
642 |
gr.HTML("<h1>Example Portfolios</h1>")
|
643 |
-
btn1 = gr.Button("
|
644 |
btn2 = gr.Button("Growth")
|
645 |
btn3 = gr.Button("Balanced")
|
646 |
btn4 = gr.Button("Agressive")
|
@@ -678,7 +678,7 @@ with gr.Blocks() as demo:
|
|
678 |
outputs=[fig_cum_returns_optimized, weights_df, fig_efficient_frontier, fig_corr, \
|
679 |
expected_annual_return, annual_volatility, sharpe_ratio, fig_indiv_prices, fig_cum_returns])
|
680 |
|
681 |
-
btn1.click(fn=output_results, inputs=[start_date, end_date,
|
682 |
outputs=[fig_cum_returns_optimized, weights_df, fig_efficient_frontier, fig_corr, \
|
683 |
expected_annual_return, annual_volatility, sharpe_ratio, fig_indiv_prices, fig_cum_returns])
|
684 |
|
|
|
608 |
return fig_cum_returns_optimized, weights_df, fig_efficient_frontier, fig_corr, \
|
609 |
expected_annual_return, annual_volatility, sharpe_ratio, fig_indiv_prices, fig_cum_returns
|
610 |
|
611 |
+
ticker_string_conservative = gr.Textbox("KO,PG,JNJ,VZ,PFE,MCD,WMT,MMM,SO,DUK")
|
612 |
+
ticker_string_growth = gr.Textbox("AAPL,AMZN,TSLA,NVDA,GOOGL,MSFT,NFLX,V,MA,CRM")
|
613 |
+
ticker_string_balanced = gr.Textbox("AAPL,JPM,JNJ,PG,KO,MSFT,PFE,VZ,MMM,WMT")
|
614 |
+
ticker_string_agressive = gr.Textbox("TSLA,AMZN,NVDA,GOOGL,SHOP,SQ,MRNA,ZM,SNOW,PTON")
|
615 |
|
616 |
|
617 |
# Interface =============================================
|
|
|
625 |
with gr.Column(scale=1):
|
626 |
gr.Image(value="resources/robot1.jpg")
|
627 |
with gr.Column(scale=5):
|
628 |
+
gr.Textbox(value = portfolios_output, label="Generated Portfolios Example (Conservative, Growth, Balanced, & Agressive)", lines=40, interactive=False )
|
629 |
|
630 |
|
631 |
with gr.Tab("Step 2: Optimize Portfolio"):
|
|
|
640 |
end_date = gr.Textbox(datetime.datetime.now().date(), label="End Date")
|
641 |
with gr.Row():
|
642 |
gr.HTML("<h1>Example Portfolios</h1>")
|
643 |
+
btn1 = gr.Button("Conservative")
|
644 |
btn2 = gr.Button("Growth")
|
645 |
btn3 = gr.Button("Balanced")
|
646 |
btn4 = gr.Button("Agressive")
|
|
|
678 |
outputs=[fig_cum_returns_optimized, weights_df, fig_efficient_frontier, fig_corr, \
|
679 |
expected_annual_return, annual_volatility, sharpe_ratio, fig_indiv_prices, fig_cum_returns])
|
680 |
|
681 |
+
btn1.click(fn=output_results, inputs=[start_date, end_date, ticker_string_conservative],
|
682 |
outputs=[fig_cum_returns_optimized, weights_df, fig_efficient_frontier, fig_corr, \
|
683 |
expected_annual_return, annual_volatility, sharpe_ratio, fig_indiv_prices, fig_cum_returns])
|
684 |
|