import gradio as gr import pandas as pd import numpy as np from data_proc import load_equity_data, load_yield_curve_data, load_credit_spread_data, load_fed_balance_sheet from data_proc import plot_treasury_curves, plot_credit_spreads, plot_fed_balance_sheet data_from_file = True loser_frame, largest_frame = load_equity_data(data_from_file) yc_frame = load_yield_curve_data(data_from_file) spread_frame = load_credit_spread_data(data_from_file) fed_frame = load_fed_balance_sheet(data_from_file) with gr.Blocks() as crisis_dashboard: gr.Markdown("
Banking Crisis Dashboard
") with gr.Tab("Bank Performance"): with gr.Row(): with gr.Column(): gr.Markdown("##
Worst performing banks
") gr.DataFrame(loser_frame) with gr.Column(): gr.Markdown("##
Largest bank performance
") gr.DataFrame(largest_frame) gr.Markdown("###
*performance since 3/8/2023
") with gr.Row(): with gr.Column(): gr.Markdown("## Failed banks") gr.DataFrame(pd.DataFrame(list(zip(['FRC','SBNY','SIVB'], ['First Republic Bank','Signature Bank', 'SVB Financial Group'])), columns=['Ticker','Bank Name'])) with gr.Tab("Interest Rates"): with gr.Row(): with gr.Column(): # gr.Markdown("##
Treasury yield curve
") gr.Plot(plot_treasury_curves(yc_frame)) with gr.Column(): # gr.Markdown("##
Credit spreads
") gr.Plot(plot_credit_spreads(spread_frame)) gr.Markdown("###
Data Source: FRED
") with gr.Tab("Fed Balance Sheet"): with gr.Row(): with gr.Column(): gr.Plot(plot_fed_balance_sheet(fed_frame)) with gr.Column(): gr.Plot(plot_fed_balance_sheet(fed_frame, 'Liabilities')) gr.Markdown("###
*change since 3/8/2023") #with gr.Tab("Bank Balance Sheets"): crisis_dashboard.launch()