Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,3 @@
|
|
| 1 |
-
# Full screen issue things to try
|
| 2 |
-
# Set a Fixed Aspect Ratio Manually:
|
| 3 |
-
# CSS Adjustments:style="height: inherit"
|
| 4 |
-
# Use responsive: true
|
| 5 |
-
# Height Adjustment on Resize: resize function in JavaScript that recalculates and adjusts the container height dynamically when switching to full screen
|
| 6 |
-
|
| 7 |
import streamlit as st
|
| 8 |
import pandas_datareader.data as web
|
| 9 |
import yfinance as yf
|
|
@@ -17,38 +11,49 @@ st.set_page_config(layout="wide")
|
|
| 17 |
st.title("Key Economic Recession Indicators")
|
| 18 |
st.markdown("""
|
| 19 |
This tool allows you to visualize and analyze various recession indicators over time.
|
| 20 |
-
The shaded areas in the charts represent historical recession periods.
|
| 21 |
-
Use the checkboxes in the sidebar to choose the indicators you'd like to explore.
|
| 22 |
""")
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
# Sidebar for chart selection
|
| 25 |
st.sidebar.header("Select Indicators")
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
|
|
|
| 45 |
|
| 46 |
# Define start and end dates
|
| 47 |
start_date = datetime.datetime(1920, 1, 1)
|
| 48 |
end_date = datetime.datetime.today()
|
| 49 |
extended_end_date = end_date + datetime.timedelta(days=120)
|
| 50 |
|
| 51 |
-
# Define recession periods
|
| 52 |
crash_periods = {
|
| 53 |
'1929-08-01': '1933-03-01',
|
| 54 |
'1937-05-01': '1938-06-01',
|
|
@@ -245,4 +250,4 @@ hide_streamlit_style = """
|
|
| 245 |
footer {visibility: hidden;}
|
| 246 |
</style>
|
| 247 |
"""
|
| 248 |
-
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas_datareader.data as web
|
| 3 |
import yfinance as yf
|
|
|
|
| 11 |
st.title("Key Economic Recession Indicators")
|
| 12 |
st.markdown("""
|
| 13 |
This tool allows you to visualize and analyze various recession indicators over time.
|
| 14 |
+
- The shaded areas in the charts represent historical recession periods.
|
| 15 |
+
- Use the checkboxes in the sidebar to choose the indicators you'd like to explore.
|
| 16 |
""")
|
| 17 |
|
| 18 |
+
# Sidebar for "How to Use" instructions inside an expander, closed by default
|
| 19 |
+
with st.sidebar.expander("How to Use", expanded=False):
|
| 20 |
+
st.write("""
|
| 21 |
+
**How to use this app:**
|
| 22 |
+
1. Select the indicators you want to visualize from the sidebar.
|
| 23 |
+
2. Click "Run Analysis" to generate the plots.
|
| 24 |
+
3. The plots will show historical data for the selected indicators, with recession periods shaded in gray.
|
| 25 |
+
4. Hover over the charts to see detailed information for each data point.
|
| 26 |
+
""")
|
| 27 |
+
|
| 28 |
# Sidebar for chart selection
|
| 29 |
st.sidebar.header("Select Indicators")
|
| 30 |
+
with st.sidebar.expander("Indicators", expanded=True):
|
| 31 |
+
indicators = {
|
| 32 |
+
'Sahm Recession Indicator': 'SAHMREALTIME',
|
| 33 |
+
'U.S. Recession Probabilities': 'Recession_Probabilities',
|
| 34 |
+
'Yield Spread (10Y - 2Y)': 'Yield_Spread',
|
| 35 |
+
'Stock Market (S&P 500)': 'SP500',
|
| 36 |
+
'VIX': 'VIX',
|
| 37 |
+
'Treasury Rates': ('GS10', 'DGS2', 'DGS1MO', 'TB3MS'),
|
| 38 |
+
'Federal Funds Rate': 'FEDFUNDS',
|
| 39 |
+
'Unemployment Rate': 'UNRATE',
|
| 40 |
+
'Nonfarm Payrolls': 'PAYEMS',
|
| 41 |
+
'Jobless Claims': 'ICSA',
|
| 42 |
+
'Retail Sales': 'RSXFS',
|
| 43 |
+
'Industrial Production': ('INDPRO', 'INDPRO_PCT'),
|
| 44 |
+
'Housing Starts': 'HOUST',
|
| 45 |
+
'Consumer Confidence': 'UMCSENT',
|
| 46 |
+
'Inflation (CPI)': ('CPIAUCSL', 'CPIAUCSL_PCT')
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
selected_indicators = {key: st.checkbox(key, value=True) for key in indicators.keys()}
|
| 50 |
|
| 51 |
# Define start and end dates
|
| 52 |
start_date = datetime.datetime(1920, 1, 1)
|
| 53 |
end_date = datetime.datetime.today()
|
| 54 |
extended_end_date = end_date + datetime.timedelta(days=120)
|
| 55 |
|
| 56 |
+
# Define recession periods
|
| 57 |
crash_periods = {
|
| 58 |
'1929-08-01': '1933-03-01',
|
| 59 |
'1937-05-01': '1938-06-01',
|
|
|
|
| 250 |
footer {visibility: hidden;}
|
| 251 |
</style>
|
| 252 |
"""
|
| 253 |
+
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
|