├── .streamlit └── config.toml ├── README.md ├── econterm.py └── requirements.txt /.streamlit/config.toml: -------------------------------------------------------------------------------- 1 | [theme] 2 | primaryColor="#f50000" 3 | backgroundColor="#000000" 4 | secondaryBackgroundColor="#f50000" 5 | textColor="#FAFAFA" 6 | font="monospace" 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Economic Terminal of Macro Datasets [![Open in Streamlit](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://macroquant.streamlit.app/) 2 | # Purpose 3 | - Leverage an API to source different Information 4 | - Create a web app to view data sourced by the Fed 5 | 6 | ## View the Economy from 6 Angles: 7 | ## 1. **Overall Economic Activity**: 8 | - Total GDP: 9 | - Consumption (C) 10 | - Investment (I) 11 | - Government Expenditure and Investment (G) 12 | - Net Exports (nX) 13 | - Housing Market: 14 | - New and Existing Home Sales 15 | - FHFA House Price 16 | - Manufacturing Sector 17 | - ISM Manufacturing 18 | - ISM Services 19 | - Industrial Production 20 | - US National Balance Sheet 21 | - US Debt 22 | - US Deficit 23 | - US Debt/ GDP 24 | - Credit Market 25 | - Chicago Fed NFCI 26 | ## 2. **Labor Market**: 27 | - Unemployment Rates 28 | -(U3 and U6) 29 | - Labor Force Participation Rate (LFPR): 30 | - Shown Across *Age* and *Race* Demographics 31 | - Initial and Continuing Jobless Claims 32 | - KC Fed Labor Market Conditions 33 | - Momentum and Overall Activity 34 | ## 3. **Fed's Tools and Inflation**: 35 | - Interest Rates 36 | - Fed's Funds Rate 37 | - EFFR (Lending Rates between Banks) 38 | - Discount Rate (Fed's Borrowing Rate) 39 | - Reserves 40 | - IR on Required Reserves 41 | - IR on Excess Reserves 42 | - Fed's Tools 43 | - Open Market Operations 44 | - Yield Curves 45 | - 10yr Treasury Yield 46 | - 2yr Treasury Yield 47 | - Spread 10yr/2yr 48 | - Fed's Balance Sheet 49 | - Fed Balance Sheet 50 | - Inflation 51 | - Inflation Target 52 | - Consumer Price Index (CPI) 53 | - Producer Price Index (PPI) 54 | - Real Personal Consumption Expenditure (PCE) 55 | - Real Disposable Income 56 | ## 4. **Volatility**: 57 | - CBOE Volatility Index 58 | - CBOE Gold ETF Volatility Index 59 | - CBOE Crude Oil ETF Volatility Index 60 | ## 4. **Commodities**: 61 | - Crude Oil Prices: West Texas Intermediate (WTI) - Cushing, Oklahoma 62 | - Henry Hub Natural Gas Spot Price 63 | - US Regular All Formulations Gas Price 64 | - Average Price: Eggs, Grade A, Large (Cost per Dozen) in U.S. City Average 65 | - Average Price: Chicken Breast, Boneless (Cost per Pound) in U.S. City Average 66 | - Average Price: Ground Beef, 100% Beef (Cost per Pound) in U.S. City Average 67 | ### Data was sourced from the St.Louis FRED's API ![](http://www.aehe.es/wp-content/uploads/2018/06/FRED_logo-300x169.jpg) 68 | -------------------------------------------------------------------------------- /econterm.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import streamlit as st 3 | from fredapi import Fred 4 | 5 | KEY = '9cbe93cd8132301fd46ad5e755944df0' 6 | fred = Fred(api_key=KEY) 7 | 8 | econ_dictionary = { 9 | # GDP 10 | 'GDPC1': ['Real GDP $B'], 'A939RC0Q052SBEA': ['GDP/Capita'], 11 | 'PCECC96':['TOTAL $B'],'DGDSRX1Q020SBEA':['Goods $B'],'PCESVC96':['Services $B'], 12 | 'GPDIC1': ['TOTAL $B'], 'PNFIC1': ['Nonresidential $B'], 'PRFIC1': ['Residential $B'], 'CBIC1': ['Change in Private Inventory'], 13 | 'GCEC1': ['TOTAL $B'], 'FGCEC1': ['Federal $B'], 'SLCEC1': ['State/Local $B'], 14 | 'NETEXC': ['NET Exports $B'], 'EXPGSC1': ['Exports $B'], 'IMPGSC1': ['Imports $B'], 15 | ##Housing Market 16 | 'NHSUSSPT': ['Total New Houses Sold (1,000s of Units)'],'EXHOSLUSM495S': ['Existing Houses Sold (1,000s of Units)'], 'MNMFS': ['Months on Maarket'], 'USSTHPI': ['House Price Index'], 17 | # Manufacturing Market 18 | 'IPMAN': ['Industrial Production Manufacturing Index'], 'IPG331S': ['Durable Goods - Primary Metals'], 19 | 'IPG334S': ['Durable Goods - Computer and Electronic Products'], 'IPG3361T3S': ['Durable Goods - Motor Vehicles and Parts'], 20 | 'IPG337S': ['Durable Goods - Furniture and related products'], 'IPG315A6S': ['Non-Durable Goods - Apparel and Leather Goods'], 21 | 'GFDEBTN': ['Public Debt $M'], 'GFDEGDQ188S': ['Public Debt/Gross GDP Ratio'], 'MTSDS133FMS': ['Federal Surplus or Deficit'], 'FYFSGDA188S': ['Federal Surplus or Deficit as Ratio of GDP'], 22 | 'NFCI': ['NFCI'], 23 | #Volatility 24 | 'VIXCLS': [' VIX'], 'GVZCLS': [' CBOE Gold ETF Volatility'], 'OVXCLS': ['CBOE Crude Oil ETF Volatility Index'], 25 | #Recession Risks 26 | 'T10Y3M': [' 10-Year Treasury Constant Maturity Minus 3-Month Treasury Constant Maturity'], 'RECPROUSM156N':['Smoothed U.S. Recession Probabilities'], 'SAHMREALTIME':['Real-time Sahm Rule Recession Indicator'], 'JHGDPBRINDX':['GDP-Based Recession Indicator Index'], 27 | 'T10Y2Y': ['10-Year Treasury Constant Maturity Minus 2-Year Treasury Constant Maturity'], 28 | #Commodities 29 | 'DCOILWTICO':[' Crude Oil Prices: West Texas Intermediate (WTI) - Cushing, Oklahoma'],'DHHNGSP':['Henry Hub Natural Gas Spot Price'], 'GASREGW':['US Regular All Formulations Gas Price'], 'APU0000708111':['Average Price: Eggs, Grade A, Large (Cost per Dozen) in U.S. City Average'], 30 | 'APU0000FF1101':['Average Price: Chicken Breast, Boneless (Cost per Pound) in U.S. City Average'], 'APU0000703112':['Average Price: Ground Beef, 100% Beef (Cost per Pound) in U.S. City Average'], 'APU000072610':['Average Price: Electricity per Kilowatt-Hour in U.S. City Average'], 31 | 'PCOPPUSDM':['Global price of Copper"'], 'PALUMUSDM':['Global price of Aluminum'], 'PNICKUSDM':['Global price of Nickel'], 'APU0000701111':['Average Price: Flour, White, All Purpose (Cost per Pound) in U.S. City Average '], 32 | # Labor Market 33 | 'UNRATE': ['U3 Rate %'], 'U6RATE': ['U6 Rate %'], 'NROU': ['Natural Unemployment Rate %'], 34 | 'CIVPART': ['Cumm. LFPR %'], 'LNS11300002': ['Women LFPR%'], 'LNS11300001': ['Men LFPR%'], 35 | 'LNS11300012': ["16-19yrs LFPR %"], 'LNS11300036': ['20-24yrs LFPR %'] ,'LNS11300060': ['25-54yrs LFPR %'], 'LNS11324230': ['55+yrs LFPR %'], 36 | 'LNS11300003': ['White LFPR %'], 'LNS11300006': ['Black LFPR %'], 'LNS11300009': ['Hispanic LFPR %'], 'LNU01332183': ['Asian LFPR %'], 37 | 'ICSA': ['Initial Jobless Claims'], 'IC4WSA': ['4 wk MA of Initial Claims'], 'CCSA': ['Continued Claims (Insured Unempl.)'], 'CC4WSA': ['4wk MA of Continued Claims'], 38 | 'FRBKCLMCIM': ['Labor Market Momentum'], 'FRBKCLMCILA': ['Labor Market Level of Activity'], 39 | # Fed's Tools 40 | 'DFF': ['Daily EFF rate'], 'FEDTARRM': ['EFF Midpoint Projection'], 41 | 'T20YIEM': ['20 yr CPI'], 'EFFR': ['Median EFFR'], 42 | 'INTDSRUSM193N': ["Fed's Discount Rate"], 'IORR': ['% on Required Reserves'], 'IOER': ['% on Excess Reserves'], 43 | 'RPONAGYD': ['Repos Purchased $B'], 'RRPONTSYD': ['Repos Sold $B'], 44 | 'DGS30': ['30 Year %'], 'DGS20': ['20 Year %'],'DGS10': ['10 Year %'], 'DGS5': ['5 Year %'] ,'DGS2': ['2 Year %'], 45 | 'RESPPLLDTXAWXCH52NWW': ['Weekly Net Change in General Account $M'], 46 | #Inflation 47 | 'USACPIALLMINMEI': ['Inflation level'], 'PPIACO': ['PPI Level'], 'PCEC96': ['Real PCE Level'], 48 | 'DSPIC96': ['Real Disposable Income $B'] 49 | 50 | } 51 | 52 | # Helper Functions 53 | def to_df(series_name, start, end): 54 | series = fred.get_series(series_name, start, end) 55 | df = pd.DataFrame(series, columns=econ_dictionary[series_name]) 56 | # df.index = df.index.date 57 | return df 58 | 59 | def show_chart(df): 60 | if len(df) > 1: 61 | st.line_chart(df) 62 | else: 63 | st.warning('\Select an earlier START date to view a line chart over time') 64 | major_selection = st.sidebar.selectbox( 65 | 'Explore Data for:', 66 | ('Home','Overall Economic Activity', 'Labor Market', 67 | "Fed's Tools", "Inflation","Volatility","Commodities", "Recession Risks") 68 | ) 69 | if major_selection == 'Home': 70 | st.write("# Welcome to MACRO Terminal ") 71 | st.markdown( 72 | """ 73 | MACRO Terminal is an open-source Streamlit app built specifically to analyze equities, bonds, commodities, and currencies. MACRO Terminal leverages the FRED API, which allow users to analyze a wide ranging number of macro datasets. 74 | 75 | 76 | MACRO Terminal consists of multiple unique dashboards that feature Overall Economic Activity, Labor Markets, Fed Tools, Inflation, Volatility, Commodities, and Recession Risks. 77 | Select a dashboard and see what MACRO Terminal can do! 78 | 79 | 80 | #### Want to learn more? 81 | - Check out the repo [Here](https://github.com/webn3ewbie/Economic-Data-Terminal) 82 | - Connect with me on [LinkedIn](https://www.linkedin.com/in/joseph-biancamano/) 83 | - Ask a question in the Streamlit community [forums](https://discuss.streamlit.io) 84 | 85 | 86 | Please note this app is NOT financial advice, nor are any dashboards intended to help guide financial decisions! 87 | """ 88 | ) 89 | if major_selection == 'Overall Economic Activity': 90 | st.title('Overall Economic Activity') 91 | start_date = st.date_input('START Date') 92 | end_date = st.date_input('END Date') 93 | date_condition = start_date < end_date 94 | st.info("An Indicator's chart may not be available because \n" 95 | "data has not been released for the specified time frame.") 96 | st.subheader('Gross Domestic Product (GDP)') 97 | gdp = to_df('GDPC1', start_date, end_date) 98 | show_chart(gdp) 99 | st.write('Updates *Quarterly*') 100 | 101 | st.subheader('GDP/Capita') 102 | gdp_percap = to_df('A939RC0Q052SBEA', start_date, end_date) 103 | show_chart(gdp_percap) 104 | st.write('Updates *Quarterly*') 105 | 106 | st.subheader('Use the dropdown menu to look at the GDP through its 4 main components') 107 | gdp_components = st.selectbox("4 Main Components", 108 | ('Consumption', 'Investment', 'Government Expenditure', 'Net Exports')) 109 | if gdp_components == 'Consumption': 110 | st.subheader('Personal Consumption Expenditures') 111 | c = to_df('PCECC96', start_date, end_date) 112 | c_goods = to_df('DGDSRX1Q020SBEA', start_date, end_date) 113 | c_services = to_df('PCESVC96', start_date, end_date) 114 | c_total = pd.concat([c, c_goods, c_services], axis=1) 115 | 116 | show_chart(c_total) 117 | st.write('Updates *Quarterly*') 118 | 119 | if gdp_components == 'Investment': 120 | st.subheader('Gross Private Domestic Investment') 121 | st.write("Where the majority of Investments are *Nonresidential*") 122 | 123 | i = to_df('GPDIC1', start_date, end_date) 124 | i_res = to_df('PRFIC1', start_date, end_date) 125 | i_nonres = to_df('PNFIC1', start_date, end_date) 126 | i_inventory = to_df('CBIC1', start_date, end_date) 127 | i_total = pd.concat([i, i_res, i_nonres], axis=1) 128 | 129 | show_chart(i_total) 130 | st.write('Updates *Quarterly*') 131 | 132 | inv_change = st.checkbox('Change in Real Private Inventory') 133 | if inv_change: 134 | st.line_chart(i_inventory) 135 | st.write('Updates *Quarterly*') 136 | 137 | if gdp_components == 'Government Expenditure': 138 | st.subheader('Government Consumption Expenditures and Investment') 139 | gov_exandinv = to_df('GCEC1', start_date, end_date) 140 | gov_fed = to_df('FGCEC1', start_date, end_date) 141 | gov_statelocal = to_df('SLCEC1', start_date, end_date) 142 | gov_total = pd.concat([gov_exandinv, gov_fed, gov_statelocal], axis=1) 143 | 144 | show_chart(gov_total) 145 | st.write('Updates *Quarterly*') 146 | 147 | if gdp_components == 'Net Exports': 148 | st.subheader('Net Exports of Goods and Services') 149 | nex = to_df('NETEXC', start_date, end_date) 150 | exports = to_df('EXPGSC1', start_date, end_date) 151 | imports = to_df('IMPGSC1', start_date, end_date) 152 | netexports = pd.concat([nex, exports, imports], axis=1) 153 | 154 | show_chart(netexports) 155 | st.write('Updates *Quarterly*') 156 | 157 | st.header('Housing Market') 158 | st.subheader('New Home Sales') 159 | new_homes = to_df('NHSUSSPT', start_date, end_date) 160 | show_chart(new_homes) 161 | st.write('Updates *Monthly*') 162 | 163 | st.subheader('Existing Home Sales') 164 | exist_homes = to_df('EXHOSLUSM495S', start_date, end_date) 165 | show_chart(exist_homes) 166 | st.write('Updates *Monthly*') 167 | 168 | st.subheader('Median Months on Market for New Homes') 169 | months_on_market = to_df('MNMFS', start_date, end_date) 170 | show_chart(months_on_market) 171 | st.write('Updates *Monthly*') 172 | 173 | st.subheader('Federal Housing Financing Agency Price Index') 174 | fhfi = to_df('USSTHPI', start_date, end_date) 175 | show_chart(fhfi) 176 | st.write('Updates *Quarterly*') 177 | 178 | st.header('Manufacturing Sector') 179 | naics_ipmanu = to_df('IPMAN', start_date, end_date) 180 | show_chart(naics_ipmanu) 181 | st.write('Updates *Monthly*') 182 | 183 | metals = st.checkbox('Industrial Production: Manufacturing - Durable Goods - Primary Metal (NAICS=331)') 184 | compelec_prods = st.checkbox('Industrial Production: Manufacturing - Durable Goods - Computer and Electronic Products (NAICS=334)') 185 | vehicles = st.checkbox('Industrial Production: Manufacturing - Durable Goods - Motor Vehicles and Parts (NAICS=3361-3)') 186 | furniture = st.checkbox('Industrial Production: Manufacturing - Durable Goods - Furniture and Related Goods (NAICS=337)') 187 | apparel = st.checkbox('Industrial Production: Manufacturing - Non Durable Goods - Apparel and Leather Goods (NAICS=315,6)') 188 | 189 | metals_df = to_df('IPG331S', start_date, end_date) 190 | compelec_prods_df = to_df('IPG334S', start_date, end_date) 191 | vehicles_df = to_df('IPG3361T3S', start_date, end_date) 192 | furniture_df = to_df('IPG337S', start_date, end_date) 193 | apparel_df = to_df('IPG315A6S', start_date, end_date) 194 | 195 | manu_checks = [metals, compelec_prods, vehicles, furniture, apparel] 196 | manudf_list = [metals_df, compelec_prods_df, vehicles_df, furniture_df, apparel_df] 197 | manu_sectors_todisp = [] 198 | 199 | #checks checkboxes 200 | for int in range(len(manu_checks)): 201 | if manu_checks[int]: 202 | manu_sectors_todisp.append(manudf_list[int]) 203 | if len(manu_sectors_todisp) == 0: 204 | st.warning('No Boxes are checked') 205 | 206 | if len(manu_sectors_todisp) > 0: 207 | final_manudf = pd.concat(manu_sectors_todisp, axis=1) 208 | show_chart(final_manudf) 209 | st.write('Updates *Monthly*') 210 | 211 | st.header('US National Balance Sheet') 212 | st.subheader('Federal Debt: Total Public Debt') 213 | debt = to_df('GFDEBTN', start_date, end_date) 214 | show_chart(debt) 215 | st.write('Updates *Quarterly*') 216 | 217 | st.subheader('Debt/GDP Ratio') 218 | debt_to_gdp = to_df('GFDEGDQ188S', start_date, end_date) 219 | show_chart(debt_to_gdp) 220 | st.write('Updates *Quarterly*') 221 | 222 | st.subheader('Federal Surplus or Deficit') 223 | surp_or_def = to_df('MTSDS133FMS', start_date, end_date) 224 | show_chart(surp_or_def) 225 | st.write('Updates *Monthly*') 226 | 227 | st.subheader('Surplus or Deficit/GDP Ratio') 228 | surp_or_def_ratio = to_df('FYFSGDA188S', start_date, end_date) 229 | show_chart(surp_or_def_ratio) 230 | st.write('Updates *Monthly*') 231 | 232 | st.header('Credit Market') 233 | st.subheader('National Financial Conditions Index ') 234 | nfci = to_df('NFCI', start_date, end_date) 235 | show_chart(nfci) 236 | st.write('Updates *Weekly*') 237 | 238 | if major_selection == 'Labor Market': 239 | st.title('Labor Market') 240 | start_date = st.date_input('START Date') 241 | end_date = st.date_input('END Date') 242 | date_condition = start_date < end_date 243 | 244 | st.subheader('Unemployment Rates (U3 and U6)') 245 | u3_rate = to_df('UNRATE',start_date, end_date) 246 | u6_rate = to_df('U6RATE', start_date, end_date) 247 | unemployment_rates = pd.concat([u3_rate, u6_rate], axis=1) 248 | show_chart(unemployment_rates) 249 | st.write('Updates Monthly') 250 | 251 | st.subheader('Natural Rate of Unemploymnet (Long-Term)') 252 | natural_urate = to_df('NROU', start_date, end_date) 253 | show_chart(natural_urate) 254 | st.write('Updates Quarterly') 255 | 256 | st.subheader('Labor Force Participation Rates (LFPR)') 257 | lfpr_total = to_df('CIVPART', start_date, end_date) 258 | show_chart(lfpr_total) 259 | st.write('Updates Quarterly') 260 | 261 | lfpr_select = st.selectbox('View the LFPR by demographic:', 262 | ('Age', 'Gender', 'Race')) 263 | 264 | if lfpr_select == 'Age': 265 | lfpr_younger = to_df('LNS11300012', start_date, end_date) 266 | lfpr_young = to_df('LNS11300036', start_date, end_date) 267 | lfpr_middle = to_df('LNS11300060', start_date, end_date) 268 | lfpr_old = to_df('LNS11324230', start_date, end_date) 269 | lfpr_age_df = pd.concat([lfpr_younger, lfpr_young, 270 | lfpr_middle, lfpr_old], axis=1) 271 | show_chart(lfpr_age_df) 272 | 273 | if lfpr_select == 'Gender': 274 | lfpr_female = to_df('LNS11300002', start_date, end_date) 275 | lfpr_male = to_df('LNS11300001', start_date, end_date) 276 | lfpr_gender_df = pd.concat([lfpr_female, lfpr_male], axis=1) 277 | show_chart(lfpr_gender_df) 278 | 279 | if lfpr_select == 'Race': 280 | white_lfpr = st.checkbox('White') 281 | black_lfpr = st.checkbox('Black') 282 | hispanic_lpr = st.checkbox('Hispanic') 283 | asian_lfpr = st.checkbox('Asian') 284 | 285 | white_lfpr_df = to_df('LNS11300003', start_date, end_date) 286 | black_lfpr_df = to_df('LNS11300006', start_date, end_date) 287 | hispanic_lpr_df = to_df('LNS11300009', start_date, end_date) 288 | asian_lfpr_df = to_df('LNU01332183', start_date, end_date) 289 | 290 | lfpr_checks = [white_lfpr, black_lfpr, hispanic_lpr, asian_lfpr] 291 | lfpr_df_list = [white_lfpr_df, black_lfpr_df, hispanic_lpr_df, asian_lfpr_df] 292 | lfpr_races_todisp = [] 293 | 294 | col1, col2 = st.beta_columns([2,2]) 295 | 296 | # checks checkboxes 297 | for int in range(len(lfpr_df_list)): 298 | if lfpr_checks[int]: 299 | lfpr_races_todisp.append(lfpr_df_list[int]) 300 | if len(lfpr_races_todisp) == 0: 301 | st.warning('No Boxes are checked') 302 | 303 | if len(lfpr_races_todisp) > 0: 304 | final_lfpr_races = pd.concat(lfpr_races_todisp, axis=1) 305 | with col1: 306 | # st.header of Combinations of races 307 | #Cut the |T00:... from the Datetime Index 308 | show_chart(final_lfpr_races) 309 | st.write('Updates *Monthly*') 310 | with col2: 311 | st.write(final_lfpr_races) 312 | 313 | st.subheader('Initial Jobless Claims') 314 | init_claims = to_df('ICSA', start_date, end_date) 315 | init_ma_claims = to_df('IC4WSA', start_date, end_date) 316 | init_total = pd.concat([init_claims, init_ma_claims], axis=1) 317 | show_chart(init_total) 318 | st.write('Updates Weekly') 319 | 320 | st.subheader('Continuing Jobless Claims') 321 | cont_claims = to_df('CCSA', start_date, end_date) 322 | cont_ma_claims = to_df('CC4WSA', start_date, end_date) 323 | cont_total = pd.concat([cont_claims, cont_ma_claims], axis=1) 324 | show_chart(cont_total) 325 | st.write('Updates Weekly') 326 | 327 | st.subheader('KC Fed Labor Market Conditions: Momentum and Overall Activity') 328 | kc_momentum = to_df('FRBKCLMCIM', start_date, end_date) 329 | kc_activity = to_df('FRBKCLMCILA', start_date, end_date) 330 | kc = pd.concat([kc_momentum, kc_activity], axis=1) 331 | show_chart(kc) 332 | st.write('Updates Monthly') 333 | 334 | if major_selection == "Fed's Tools": 335 | st.title('Fed Tools') 336 | start_date = st.date_input('START Date') 337 | end_date = st.date_input('END Date') 338 | date_condition = start_date < end_date 339 | st.subheader("Fed's Funds Rate") 340 | eff = to_df('DFF', start_date, end_date) 341 | show_chart(eff) 342 | st.write('Updates Daily') 343 | 344 | st.subheader("FOMC FFR Midpoint Project") 345 | effproj = to_df('FEDTARRM', start_date, end_date) 346 | show_chart(effproj) 347 | st.write('Updates Yearly') 348 | 349 | st.subheader('EFFR (Lending Rates between Banks)') 350 | effr = to_df('EFFR', start_date, end_date) 351 | show_chart(effr) 352 | st.write('Updates Daily') 353 | 354 | st.subheader('Discount Rate') 355 | discount = to_df('INTDSRUSM193N', start_date, end_date) 356 | show_chart(discount) 357 | st.write('Updates Monthly') 358 | 359 | st.subheader('IR on Required Reserves') 360 | ir_rr = to_df('IORR', start_date, end_date) 361 | show_chart(ir_rr) 362 | st.write('Updates Daily') 363 | 364 | st.subheader('IR on Excess Reserves') 365 | ir_er = to_df('IOER', start_date, end_date) 366 | show_chart(ir_er) 367 | st.write('Updates Daily') 368 | 369 | st.header('Open Market Operations: Purchase and sell Repos') 370 | buy_repos = to_df('RPONAGYD', start_date, end_date) 371 | sell_repos = to_df('RRPONTSYD', start_date, end_date) 372 | repos = pd.concat([buy_repos, sell_repos], axis = 1) 373 | show_chart(repos) 374 | st.write('Updates Daily') 375 | st.write(repos) 376 | 377 | st.header("Yield Curves") 378 | st.subheader('Treasury Yields') 379 | yield_30 = to_df('DGS30', start_date, end_date) 380 | yield_20 = to_df('DGS20', start_date, end_date) 381 | yield_10 = to_df('DGS10', start_date, end_date) 382 | yield_5 = to_df('DGS5', start_date, end_date) 383 | yield_2 = to_df('DGS2', start_date, end_date) 384 | yields = pd.concat([yield_30, yield_10, yield_20 ,yield_5 , yield_2], axis=1) 385 | show_chart(yields) 386 | 387 | st.header("Fed's Balance Sheet and Holdings") 388 | st.subheader('Fed Balance Sheet: Weekly Net Change in General Account') 389 | ga_weekly = to_df('RESPPLLDTXAWXCH52NWW', start_date, end_date) 390 | show_chart(ga_weekly) 391 | 392 | if major_selection == 'Inflation': 393 | st.title('Inflation') 394 | start_date = st.date_input('START Date') 395 | end_date = st.date_input('END Date') 396 | date_condition = start_date < end_date 397 | 398 | st.subheader("Inflation Target from CPI") 399 | infl_20 = to_df('T20YIEM', start_date, end_date) 400 | show_chart(infl_20) 401 | st.write('Updates Monthly') 402 | 403 | st.subheader('CPI based on ALL US Products') 404 | cpi = to_df('USACPIALLMINMEI', start_date, end_date) 405 | show_chart(cpi) 406 | st.write('Updates Monthly') 407 | 408 | st.subheader('PPI based on ALL US Commodities') 409 | ppi = to_df('PPIACO', start_date, end_date) 410 | show_chart(ppi) 411 | st.write('Updates Monthly') 412 | 413 | st.subheader('Real PCE') 414 | pce = to_df('PCEC96', start_date, end_date) 415 | show_chart(pce) 416 | st.write('Updates Monthly') 417 | 418 | st.subheader('Real Disposable Income') 419 | r_di = to_df('DSPIC96', start_date, end_date) 420 | show_chart(r_di) 421 | 422 | if major_selection == 'Volatility': 423 | st.title('Volatility') 424 | start_date = st.date_input('START Date') 425 | end_date = st.date_input('END Date') 426 | date_condition = start_date < end_date 427 | 428 | st.subheader("CBOE Volatility Index") 429 | vix = to_df('VIXCLS', start_date, end_date) 430 | show_chart(vix) 431 | 432 | st.subheader(" CBOE Gold ETF Volatility Index") 433 | gvix = to_df('GVZCLS', start_date, end_date) 434 | show_chart(gvix) 435 | 436 | st.subheader(" CBOE Crude Oil ETF Volatility Index") 437 | cvix = to_df('OVXCLS', start_date, end_date) 438 | show_chart(cvix) 439 | vixs = pd.concat([vix, gvix,cvix],axis=1) 440 | show_chart(vixs) 441 | 442 | if major_selection == 'Commodities': 443 | st.title('Commodities') 444 | st.subheader("Select Commodity Type") 445 | com_components = st.selectbox("3 Main Components", 446 | ('Energy', 'Metals', 'Agriculture')) 447 | start_date = st.date_input('START Date') 448 | end_date = st.date_input('END Date') 449 | date_condition = start_date < end_date 450 | 451 | if com_components == 'Energy': 452 | wti = to_df('DCOILWTICO', start_date, end_date) 453 | ng = to_df('DHHNGSP', start_date, end_date) 454 | gasa = to_df('GASREGW', start_date, end_date) 455 | elc = to_df('APU000072610', start_date, end_date) 456 | etotal = pd.concat([wti, ng, gasa, elc], axis=1) 457 | st.subheader("Crude Oil Prices: West Texas Intermediate (WTI) - Cushing, Oklahoma") 458 | show_chart(wti) 459 | st.subheader("Henry Hub Natural Gas Spot Price") 460 | show_chart(ng) 461 | st.subheader("US Regular All Formulations Gas Price") 462 | show_chart(gasa) 463 | st.subheader("Average Price: Electricity per Kilowatt-Hour in U.S. City Average") 464 | show_chart(elc) 465 | 466 | if com_components == 'Agriculture': 467 | egg = to_df('APU0000708111', start_date, end_date) 468 | chk = to_df('APU0000FF1101', start_date, end_date) 469 | bef = to_df('APU0000703112', start_date, end_date) 470 | flo = to_df('APU0000701111', start_date, end_date) 471 | etotal = pd.concat([egg, chk, bef], axis=1) 472 | st.subheader("Average Price: Eggs, Grade A, Large (Cost per Dozen) in U.S. City Average") 473 | show_chart(egg) 474 | st.subheader("Average Price: Chicken Breast, Boneless (Cost per Pound) in U.S. City Average") 475 | show_chart(chk) 476 | st.subheader("Average Price: Ground Beef, 100% Beef (Cost per Pound) in U.S. City Average") 477 | show_chart(bef) 478 | st.subheader('Average Price: Flour, White, All Purpose (Cost per Pound) in U.S. City Average ') 479 | show_chart(flo) 480 | 481 | if com_components == 'Metals': 482 | cop = to_df('PCOPPUSDM', start_date, end_date) 483 | alu = to_df('PALUMUSDM', start_date, end_date) 484 | nkl = to_df('PNICKUSDM', start_date, end_date) 485 | etotal = pd.concat([cop, alu, nkl], axis=1) 486 | 487 | st.subheader("Global price of Copper") 488 | show_chart(cop) 489 | st.subheader("Global price of Aluminum") 490 | show_chart(alu) 491 | st.subheader("Global price of Nickel") 492 | show_chart(nkl) 493 | 494 | if major_selection == 'Recession Risks': 495 | st.title('Recession Risks') 496 | start_date = st.date_input('START Date') 497 | end_date = st.date_input('END Date') 498 | date_condition = start_date < end_date 499 | st.subheader("10-Year Treasury Constant Maturity Minus 2-Year Treasury Constant Maturity'") 500 | tty = to_df('T10Y2Y', start_date, end_date) 501 | show_chart(tty) 502 | st.subheader("10-Year Treasury Constant Maturity Minus 3-Month Treasury Constant Maturity") 503 | ttm = to_df('T10Y3M', start_date, end_date) 504 | show_chart(ttm) 505 | st.subheader("Smoothed U.S. Recession Probabilities") 506 | srp = to_df('RECPROUSM156N', start_date, end_date) 507 | show_chart(srp) 508 | st.subheader("Real-time Sahm Rule Recession Indicator") 509 | srr = to_df('SAHMREALTIME', start_date, end_date) 510 | show_chart(srr) 511 | st.subheader("GDP-Based Recession Indicator Index") 512 | gdpr = to_df('JHGDPBRINDX', start_date, end_date) 513 | show_chart(gdpr) 514 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pandas 2 | streamlit 3 | fredapi 4 | numpy 5 | seaborn 6 | plotly==3.10.0 7 | yfinance 8 | pandas_datareader 9 | scipy 10 | --------------------------------------------------------------------------------