Import('*')

FIGURES_CODE = '#source/analysis/figures/main'
FIGURES_OUTPUT = '#source/figures/main/raw'
FIGURES_DATA = '#source/figures/main/data'
INTEREST_RATE_ORIG = '#datastore/raw/interest_rates/orig'
BEA_ORIG = '#datastore/raw/bea/orig'
BEA_DATA = '#datastore/raw/bea/data'
EMPIRICS = '#datastore/derived/empirics'
INFLATION_ORIG = '#datastore/raw/inflation/orig'
SPF_ORIG = '#datastore/raw/spf/orig'
FRED_ORIG = '#datastore/raw/fred/orig'
FRED_DATA = '#datastore/raw/fred/data'
FROM_PAPERS_ORIG = '#datastore/raw/from_papers/orig'
GFD_ORIG = '#datastore/raw/gfd/orig'
MODEL_DATA = '#datastore/derived/model'

target = [f'{FIGURES_OUTPUT}/figure_1a_nominal_rates.pdf',
          f'{FIGURES_OUTPUT}/figure_1b_boe_rates.pdf',
          f'{FIGURES_DATA}/figure_1a_nominal_rates.csv',
          f'{FIGURES_DATA}/figure_1b_boe_rates.csv']
source = [f'{FIGURES_CODE}/01_figure_1_long_term_rates.do',
          f'{FROM_PAPERS_ORIG}/eight-centuries-of-global-real-interest-rates-r-g-and-the-suprasecular-decline-1311-2018-data.xlsx',
          f'{GFD_ORIG}/bank_of_england_rate.csv']
env.Stata(target, source)

target = [f'{FIGURES_OUTPUT}/figure_2a_usa_eff_fed_funds.pdf',
          f'{FIGURES_OUTPUT}/figure_2b_usa_pd_rat.pdf',
          f'{FIGURES_OUTPUT}/figure_2c_usa_xk.pdf',
          f'{FIGURES_OUTPUT}/figure_2d_usa_rgdp.pdf',
          f'{BEA_DATA}/ik.csv',
          f'{FIGURES_DATA}/figure_2a_usa_eff_fed_funds.csv',
          f'{FIGURES_DATA}/figure_2b_usa_pd_rat.csv',
          f'{FIGURES_DATA}/figure_2c_usa_xk.csv',
          f'{FIGURES_DATA}/figure_2d_usa_rgdp.csv']
source = [f'{FIGURES_CODE}/02_figure_2_data_moments.do',
          f'{FRED_DATA}/fred_interest_rates.dta',
          f'{EMPIRICS}/valuation_ratios_data.dta',
          f'{BEA_ORIG}/bea_investment_fixed_assets_table_1_5.csv',
          f'{BEA_ORIG}/bea_current_cost_net_stock_of_fixed_assets_table_1_1.csv',
          f'{FRED_ORIG}/annual/GDPC1.dta']
env.Stata(target, source)

target = [f'{FIGURES_OUTPUT}/figure_3_vix_plot_with_break.pdf',
          f'{FIGURES_DATA}/figure_3_vix_plot_with_break.csv']
source = [f'{FIGURES_CODE}/03_figure_3_vix_plot.py',
          f'{GFD_ORIG}/vix.csv']
env.Python(target, source)

target = [f'{FIGURES_OUTPUT}/figure_4a_nominal_less_inflation_indexed_1y.pdf',
          f'{FIGURES_OUTPUT}/figure_4b_nominal_less_inflation_indexed_5y.pdf',
          f'{FIGURES_DATA}/figure_4a_nominal_less_inflation_indexed_1y.csv',
          f'{FIGURES_DATA}/figure_4b_nominal_less_inflation_indexed_5y.csv']
source = [f'{FIGURES_CODE}/04_figure_4_inflation_indexed_vs_nominal.do',
          f'{GFD_ORIG}/uk_cpi_inflation.csv',
          f'{GFD_ORIG}/uk_nominal_note_5_year.csv',
          f'{GFD_ORIG}/uk_nominal_note_1_year.csv',
          f'{GFD_ORIG}/uk_inflation_indexed_gilt_5_year.csv']
env.Stata(target, source)

target = [f'{FIGURES_OUTPUT}/figure_5_cons_inf_corr.pdf',
          f'{FIGURES_DATA}/figure_5_cons_inf_corr.csv']
source = [f'{FIGURES_CODE}/05_figure_5_cons_inf_corr.py',
          f'{FRED_ORIG}/default/DPCERAM1M225NBEA.dta',
          f'{FRED_ORIG}/default/CPIAUCSL.dta']
env.Python(target, source)

target = [f'{FIGURES_OUTPUT}/figure_6_inflation_expectations.pdf',
          f'{FIGURES_DATA}/figure_6_inflation_expectations.csv']
source = [f'{FIGURES_CODE}/06_figure_6_inflation_expectations.do',
          f'{FRED_DATA}/fred_inflation.dta',
          f'{EMPIRICS}/irp_data.dta',
          f'{EMPIRICS}/inflation_data.dta']
env.Stata(target, source)

target = [f'{FIGURES_OUTPUT}/figure_7_expected_vs_realized_inflation.pdf',
          f'{FIGURES_DATA}/figure_7_expected_vs_realized_inflation.csv']
source = [f'{FIGURES_CODE}/07_figure_7_expected_vs_realized_inflation.py',
          f'{SPF_ORIG}/Individual_PGDP.xlsx',
          f'{FRED_ORIG}/default/GDPDEF.dta']
env.Python(target, source)

target = [f'{FIGURES_OUTPUT}/figure_8a_interest_rate_model_vs_data.pdf',
          f'{FIGURES_OUTPUT}/figure_8b_cape_model_vs_data.pdf',
          f'{FIGURES_DATA}/figure_8a_interest_rate_model_vs_data.csv',
          f'{FIGURES_DATA}/figure_8b_cape_model_vs_data.csv']
source = [f'{FIGURES_CODE}/08_figure_8_dynamic_model_plots.py',
          f'{MODEL_DATA}/dynamic_model/parameters/baseline_calibration.json',
          f'{MODEL_DATA}/dynamic_model/results/baseline_calibration.json',
          f'{MODEL_DATA}/dynamic_model/results/beta_only_calibration.json']
env.Python(target, source)

target = [f'{FIGURES_OUTPUT}/figure_9_inflation_risk_premium_plots.pdf',
          f'{FIGURES_DATA}/figure_9_inflation_risk_premium_plots.csv']
source = [f'{FIGURES_CODE}/09_figure_9_inflation_risk_premium_plots.do',
          f'{EMPIRICS}/irp_data.dta',
          f'{MODEL_DATA}/dynamic_model/results/inflation_risk_premium.dta']
env.Stata(target, source)

target = [f'{FIGURES_OUTPUT}/figure_10_ik_ratio_comparative_statics.pdf',
          f'{FIGURES_DATA}/figure_10_ik_ratio_comparative_statics.csv']
source = [f'{FIGURES_CODE}/10_figure_10_inventory_investment_capital_ratio.py',
          f'{MODEL_DATA}/inventory_model/comparative_statics.json']
env.Python(target, source)

target = [f'{FIGURES_OUTPUT}/figure_11_pd_ratio_comparative_statics.pdf',
          f'{FIGURES_DATA}/figure_11_pd_ratio_comparative_statics.csv']
source = [f'{FIGURES_CODE}/11_figure_11_inventory_valuation_ratio.py',
          f'{MODEL_DATA}/inventory_model/comparative_statics.json']
env.Python(target, source)

target = [f'{FIGURES_OUTPUT}/figure_12_risk_premium_comparative_statics.pdf',
          f'{FIGURES_DATA}/figure_12_risk_premium_comparative_statics.csv']
source = [f'{FIGURES_CODE}/12_figure_12_inventory_risk_premium.py',
          f'{MODEL_DATA}/inventory_model/comparative_statics.json']
env.Python(target, source)

target = [f'{FIGURES_OUTPUT}/figure_13_money_supply.pdf',
          f'{FIGURES_DATA}/figure_13_money_supply.csv']
source = [f'{FIGURES_CODE}/13_figure_13_money_supply.do',
          f'{FRED_ORIG}/annual/MZM.dta',
          f'{FRED_ORIG}/annual/M2SL.dta',
          f'{BEA_ORIG}/bea_current_cost_net_stock_of_fixed_assets_table_1_1.csv']
env.Stata(target, source)


