Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,7 +34,6 @@ if 'symbol_ownership_params' not in st.session_state:
|
|
| 34 |
def page1():
|
| 35 |
st.title("CIK and Name Combinations")
|
| 36 |
st.markdown("""
|
| 37 |
-
**Description:**
|
| 38 |
Fetch and display the list of Central Index Key (CIK). CIK is a unique identifier assigned by the SEC to entities that file disclosures.
|
| 39 |
""")
|
| 40 |
|
|
@@ -85,7 +84,6 @@ def fetch_cik_name_combinations():
|
|
| 85 |
def page2():
|
| 86 |
st.title("Portfolio Allocation Over Time")
|
| 87 |
st.markdown("""
|
| 88 |
-
**Description:**
|
| 89 |
Fetch and visualize portfolio allocation data over time for a specific CIK. Enter the CIK and specify a start date to analyze the portfolio's composition.
|
| 90 |
""")
|
| 91 |
|
|
@@ -187,8 +185,7 @@ def page2():
|
|
| 187 |
|
| 188 |
# Time-series plots for trends
|
| 189 |
st.subheader("Portfolio Allocation Trends by Symbol")
|
| 190 |
-
st.markdown("""
|
| 191 |
-
**Explanation:**
|
| 192 |
This chart shows the trends in portfolio allocation by individual symbols over time. The top N symbols by weight are displayed to highlight the most significant contributors to the portfolio.
|
| 193 |
""")
|
| 194 |
fig3 = plot_allocation_trends(allocation_data, "symbol", top_n)
|
|
@@ -196,7 +193,6 @@ def page2():
|
|
| 196 |
|
| 197 |
st.subheader("Portfolio Allocation Trends by Industry")
|
| 198 |
st.markdown("""
|
| 199 |
-
**Explanation:**
|
| 200 |
This chart illustrates the trends in portfolio allocation across different industries over time. The top N industries by weight are displayed to emphasize the major sectors in the portfolio.
|
| 201 |
""")
|
| 202 |
fig4 = plot_allocation_trends(allocation_data, "industryTitle", top_n)
|
|
@@ -206,15 +202,13 @@ def page2():
|
|
| 206 |
st.markdown("---")
|
| 207 |
st.subheader("Transposed Ticker Data")
|
| 208 |
st.markdown("""
|
| 209 |
-
**Explanation:**
|
| 210 |
This table presents the portfolio allocation weights and market values for each ticker across different dates. It provides a detailed view of how each stock's weight and market value have evolved over time.
|
| 211 |
""")
|
| 212 |
transposed_ticker_data = transpose_data(allocation_data, "symbol")
|
| 213 |
st.dataframe(transposed_ticker_data, use_container_width=True)
|
| 214 |
|
| 215 |
st.subheader("Transposed Industry Data")
|
| 216 |
-
st.markdown("""
|
| 217 |
-
**Explanation:**
|
| 218 |
This table displays the portfolio allocation weights and market values for each industry across different dates. It offers insights into the sector-wise distribution and changes in the portfolio.
|
| 219 |
""")
|
| 220 |
transposed_industry_data = transpose_data(allocation_data, "industryTitle")
|
|
@@ -438,7 +432,6 @@ def format_market_value(value):
|
|
| 438 |
def page3():
|
| 439 |
st.title("Investor Performance")
|
| 440 |
st.markdown("""
|
| 441 |
-
**Description:**
|
| 442 |
Fetch and visualize various performance metrics for a specific institutional investor identified by their CIK. Analyze portfolio value, market value changes, performance relative to benchmarks, turnover metrics, and more.
|
| 443 |
""")
|
| 444 |
|
|
@@ -538,7 +531,6 @@ def page3():
|
|
| 538 |
# Plotting
|
| 539 |
st.subheader("Portfolio Value and Change in Market Value (%)")
|
| 540 |
st.markdown("""
|
| 541 |
-
**Explanation:**
|
| 542 |
This chart displays the portfolio's total market value over time alongside the percentage change in market value. It helps in understanding the growth or decline of the portfolio's value.
|
| 543 |
""")
|
| 544 |
fig1 = plot_portfolio_value_and_change(data)
|
|
@@ -546,7 +538,6 @@ def page3():
|
|
| 546 |
|
| 547 |
st.subheader("Performance and Relative Performance to S&P 500")
|
| 548 |
st.markdown("""
|
| 549 |
-
**Explanation:**
|
| 550 |
This chart compares the portfolio's performance against the S&P 500 benchmark. It shows how well the portfolio is performing relative to the broader market.
|
| 551 |
""")
|
| 552 |
fig2 = plot_performance_and_relative(data)
|
|
@@ -554,7 +545,6 @@ def page3():
|
|
| 554 |
|
| 555 |
st.subheader("Portfolio Turnover Metrics")
|
| 556 |
st.markdown("""
|
| 557 |
-
**Explanation:**
|
| 558 |
This chart illustrates the portfolio's turnover rate, including buy and sell activities. Turnover metrics provide insight into the trading frequency and strategy.
|
| 559 |
""")
|
| 560 |
fig3 = plot_turnover_metrics(data)
|
|
@@ -562,7 +552,6 @@ def page3():
|
|
| 562 |
|
| 563 |
st.subheader("Cumulative Performance Over Time")
|
| 564 |
st.markdown("""
|
| 565 |
-
**Explanation:**
|
| 566 |
This chart shows the cumulative performance of the portfolio over different time horizons (1-year, 3-year, 5-year, and since inception). It highlights long-term growth trends.
|
| 567 |
""")
|
| 568 |
fig4 = plot_cumulative_performance(data)
|
|
@@ -570,7 +559,6 @@ def page3():
|
|
| 570 |
|
| 571 |
st.subheader("Holding Periods")
|
| 572 |
st.markdown("""
|
| 573 |
-
**Explanation:**
|
| 574 |
This chart depicts the average holding periods for the portfolio and its top holdings. Holding periods indicate the investment duration and strategy stability.
|
| 575 |
""")
|
| 576 |
fig5 = plot_holding_periods(data)
|
|
@@ -578,7 +566,6 @@ def page3():
|
|
| 578 |
|
| 579 |
st.subheader("Portfolio Activity")
|
| 580 |
st.markdown("""
|
| 581 |
-
**Explanation:**
|
| 582 |
This chart displays portfolio size changes and the number of securities added or removed. It provides an overview of portfolio expansion or contraction.
|
| 583 |
""")
|
| 584 |
fig6 = plot_portfolio_activity(data)
|
|
@@ -586,7 +573,6 @@ def page3():
|
|
| 586 |
|
| 587 |
st.subheader("Market Value and Securities Count")
|
| 588 |
st.markdown("""
|
| 589 |
-
**Explanation:**
|
| 590 |
This chart compares the portfolio's total market value against the number of securities held. It helps in understanding the diversification and valuation aspects of the portfolio.
|
| 591 |
""")
|
| 592 |
fig7 = plot_market_value_and_securities(data)
|
|
|
|
| 34 |
def page1():
|
| 35 |
st.title("CIK and Name Combinations")
|
| 36 |
st.markdown("""
|
|
|
|
| 37 |
Fetch and display the list of Central Index Key (CIK). CIK is a unique identifier assigned by the SEC to entities that file disclosures.
|
| 38 |
""")
|
| 39 |
|
|
|
|
| 84 |
def page2():
|
| 85 |
st.title("Portfolio Allocation Over Time")
|
| 86 |
st.markdown("""
|
|
|
|
| 87 |
Fetch and visualize portfolio allocation data over time for a specific CIK. Enter the CIK and specify a start date to analyze the portfolio's composition.
|
| 88 |
""")
|
| 89 |
|
|
|
|
| 185 |
|
| 186 |
# Time-series plots for trends
|
| 187 |
st.subheader("Portfolio Allocation Trends by Symbol")
|
| 188 |
+
st.markdown("""
|
|
|
|
| 189 |
This chart shows the trends in portfolio allocation by individual symbols over time. The top N symbols by weight are displayed to highlight the most significant contributors to the portfolio.
|
| 190 |
""")
|
| 191 |
fig3 = plot_allocation_trends(allocation_data, "symbol", top_n)
|
|
|
|
| 193 |
|
| 194 |
st.subheader("Portfolio Allocation Trends by Industry")
|
| 195 |
st.markdown("""
|
|
|
|
| 196 |
This chart illustrates the trends in portfolio allocation across different industries over time. The top N industries by weight are displayed to emphasize the major sectors in the portfolio.
|
| 197 |
""")
|
| 198 |
fig4 = plot_allocation_trends(allocation_data, "industryTitle", top_n)
|
|
|
|
| 202 |
st.markdown("---")
|
| 203 |
st.subheader("Transposed Ticker Data")
|
| 204 |
st.markdown("""
|
|
|
|
| 205 |
This table presents the portfolio allocation weights and market values for each ticker across different dates. It provides a detailed view of how each stock's weight and market value have evolved over time.
|
| 206 |
""")
|
| 207 |
transposed_ticker_data = transpose_data(allocation_data, "symbol")
|
| 208 |
st.dataframe(transposed_ticker_data, use_container_width=True)
|
| 209 |
|
| 210 |
st.subheader("Transposed Industry Data")
|
| 211 |
+
st.markdown("""
|
|
|
|
| 212 |
This table displays the portfolio allocation weights and market values for each industry across different dates. It offers insights into the sector-wise distribution and changes in the portfolio.
|
| 213 |
""")
|
| 214 |
transposed_industry_data = transpose_data(allocation_data, "industryTitle")
|
|
|
|
| 432 |
def page3():
|
| 433 |
st.title("Investor Performance")
|
| 434 |
st.markdown("""
|
|
|
|
| 435 |
Fetch and visualize various performance metrics for a specific institutional investor identified by their CIK. Analyze portfolio value, market value changes, performance relative to benchmarks, turnover metrics, and more.
|
| 436 |
""")
|
| 437 |
|
|
|
|
| 531 |
# Plotting
|
| 532 |
st.subheader("Portfolio Value and Change in Market Value (%)")
|
| 533 |
st.markdown("""
|
|
|
|
| 534 |
This chart displays the portfolio's total market value over time alongside the percentage change in market value. It helps in understanding the growth or decline of the portfolio's value.
|
| 535 |
""")
|
| 536 |
fig1 = plot_portfolio_value_and_change(data)
|
|
|
|
| 538 |
|
| 539 |
st.subheader("Performance and Relative Performance to S&P 500")
|
| 540 |
st.markdown("""
|
|
|
|
| 541 |
This chart compares the portfolio's performance against the S&P 500 benchmark. It shows how well the portfolio is performing relative to the broader market.
|
| 542 |
""")
|
| 543 |
fig2 = plot_performance_and_relative(data)
|
|
|
|
| 545 |
|
| 546 |
st.subheader("Portfolio Turnover Metrics")
|
| 547 |
st.markdown("""
|
|
|
|
| 548 |
This chart illustrates the portfolio's turnover rate, including buy and sell activities. Turnover metrics provide insight into the trading frequency and strategy.
|
| 549 |
""")
|
| 550 |
fig3 = plot_turnover_metrics(data)
|
|
|
|
| 552 |
|
| 553 |
st.subheader("Cumulative Performance Over Time")
|
| 554 |
st.markdown("""
|
|
|
|
| 555 |
This chart shows the cumulative performance of the portfolio over different time horizons (1-year, 3-year, 5-year, and since inception). It highlights long-term growth trends.
|
| 556 |
""")
|
| 557 |
fig4 = plot_cumulative_performance(data)
|
|
|
|
| 559 |
|
| 560 |
st.subheader("Holding Periods")
|
| 561 |
st.markdown("""
|
|
|
|
| 562 |
This chart depicts the average holding periods for the portfolio and its top holdings. Holding periods indicate the investment duration and strategy stability.
|
| 563 |
""")
|
| 564 |
fig5 = plot_holding_periods(data)
|
|
|
|
| 566 |
|
| 567 |
st.subheader("Portfolio Activity")
|
| 568 |
st.markdown("""
|
|
|
|
| 569 |
This chart displays portfolio size changes and the number of securities added or removed. It provides an overview of portfolio expansion or contraction.
|
| 570 |
""")
|
| 571 |
fig6 = plot_portfolio_activity(data)
|
|
|
|
| 573 |
|
| 574 |
st.subheader("Market Value and Securities Count")
|
| 575 |
st.markdown("""
|
|
|
|
| 576 |
This chart compares the portfolio's total market value against the number of securities held. It helps in understanding the diversification and valuation aspects of the portfolio.
|
| 577 |
""")
|
| 578 |
fig7 = plot_market_value_and_securities(data)
|