Import('*')

# =============================================================================
# WRDS raw data downloads
#
# These steps are NOT part of the default build. WRDS data cannot be
# redistributed, so the files are absent from the public replication package
# and must be downloaded by someone holding a WRDS subscription. Run them
# deliberately:
#
#     scons refresh_raw=1
#
# See "Downloading the restricted-access data" in README.md.
# =============================================================================

# Code paths
WRDS_CODE = '#source/raw/wrds'

# Data paths
WRDS_ORIG = '#datastore/raw/wrds/orig'

# 01: Annual CRSP value-weighted market returns
target = [f'{WRDS_ORIG}/crsp_returns.dta']
source = [f'{WRDS_CODE}/01_download_crsp_returns.py']
env.Python(target, source)

# 02: S&P 500 long-term growth forecasts from IBES
target = [f'{WRDS_ORIG}/ibes_global_aggregates.csv']
source = [f'{WRDS_CODE}/02_download_ibes_ltg.py']
env.Python(target, source)

# 03: The same market returns monthly, so a part-finished year can be used
target = [f'{WRDS_ORIG}/crsp_returns_monthly.dta']
source = [f'{WRDS_CODE}/03_download_crsp_monthly.py']
env.Python(target, source)
