From 71a8f078ebc4477cf4658bd99f4009ae1340cb9b Mon Sep 17 00:00:00 2001 From: james Date: Wed, 22 Feb 2023 17:26:59 -0500 Subject: [PATCH] Clean up unused static dicts --- .../fixedincome/fixedincome_controller.py | 44 +- openbb_terminal/fixedincome/fred_model.py | 140 ++----- openbb_terminal/fixedincome/fred_view.py | 377 +----------------- 3 files changed, 50 insertions(+), 511 deletions(-) diff --git a/openbb_terminal/fixedincome/fixedincome_controller.py b/openbb_terminal/fixedincome/fixedincome_controller.py index 89178bffcb3..adc0874f221 100644 --- a/openbb_terminal/fixedincome/fixedincome_controller.py +++ b/openbb_terminal/fixedincome/fixedincome_controller.py @@ -81,11 +81,11 @@ class FixedIncomeController(BaseController): } self.choices["spot"]["--maturity"] = { - c: None for c in fred_view.SPOT_TO_OPTIONS["Maturity"] + c: None for c in fred_model.SPOT_TO_OPTIONS["Maturity"] } self.choices["spot"]["-m"] = "--maturity" self.choices["spot"]["--category"] = { - c: None for c in fred_view.SPOT_TO_OPTIONS["Category"] + c: None for c in fred_model.SPOT_TO_OPTIONS["Category"] } self.choices["spot"]["-c"] = "--category" self.completer = NestedCompleter.from_nested_dict(self.choices) # type: ignore @@ -261,7 +261,7 @@ class FixedIncomeController(BaseController): type=str, help="Specific SONIA data to retrieve", default="rate", - choices=fred_view.SONIA_PARAMETER_TO_FRED_ID.keys(), + choices=fred_model.SONIA_PARAMETER_TO_FRED_ID.keys(), ) parser.add_argument( "-s", @@ -312,7 +312,7 @@ class FixedIncomeController(BaseController): type=str, help="Specific AMERIBOR data to retrieve", default="overnight", - choices=fred_view.AMERIBOR_PARAMETER_TO_FRED_ID.keys(), + choices=fred_model.AMERIBOR_PARAMETER_TO_FRED_ID.keys(), ) parser.add_argument( "-s", @@ -363,7 +363,7 @@ class FixedIncomeController(BaseController): type=str, help="Specific Effective Federal Funds Rate data to retrieve", default="monthly", - choices=fred_view.FED_PARAMETER_TO_FRED_ID.keys(), + choices=fred_model.FED_PARAMETER_TO_FRED_ID.keys(), ) parser.add_argument( "-s", @@ -520,7 +520,7 @@ class FixedIncomeController(BaseController): type=str, help="Specific Discount Window Primary Credit Rate data to retrieve", default="daily_excl_weekend", - choices=fred_view.DWPCR_PARAMETER_TO_FRED_ID.keys(), + choices=fred_model.DWPCR_PARAMETER_TO_FRED_ID.keys(), ) parser.add_argument( "-s", @@ -706,7 +706,7 @@ class FixedIncomeController(BaseController): type=str, help="Selected treasury constant maturity to subtract", default="3_month", - choices=fred_view.TMC_PARAMETER_TO_FRED_ID.keys(), + choices=fred_model.TMC_PARAMETER_TO_FRED_ID.keys(), ) parser.add_argument( "-s", @@ -942,7 +942,7 @@ class FixedIncomeController(BaseController): type=str, help="Specific Treasury Bill Secondary Market Rate data to plot", default="3_month", - choices=list(fred_view.USARATES_TO_FRED_ID.keys()), + choices=list(fred_model.USARATES_TO_FRED_ID.keys()), ) parser.add_argument( "-p", @@ -985,13 +985,15 @@ class FixedIncomeController(BaseController): if ns_parser: if ns_parser.options: print_rich_table( - pd.DataFrame.from_dict(fred_view.USARATES_TO_FRED_ID).T.fillna("-"), + pd.DataFrame.from_dict(fred_model.USARATES_TO_FRED_ID).T.fillna( + "-" + ), show_index=True, title="Available options including FRED Series name", ) elif ( ns_parser.parameter - not in fred_view.USARATES_TO_FRED_ID[ns_parser.maturity] + not in fred_model.USARATES_TO_FRED_ID[ns_parser.maturity] ): console.print( f"[red]Maturity {ns_parser.maturity.replace('_', ' ')} is not " @@ -1028,7 +1030,7 @@ class FixedIncomeController(BaseController): type=str, help="What type you'd like to collect data for", default="yield", - choices=fred_view.ICE_BOFA_TO_OPTIONS["Type"], + choices=fred_model.ICE_BOFA_TO_OPTIONS["Type"], ) parser.add_argument( @@ -1038,7 +1040,7 @@ class FixedIncomeController(BaseController): type=str, help="What category you'd like to collect data for", default="all", - choices=fred_view.ICE_BOFA_TO_OPTIONS["Category"], + choices=fred_model.ICE_BOFA_TO_OPTIONS["Category"], ) parser.add_argument( @@ -1048,7 +1050,7 @@ class FixedIncomeController(BaseController): type=str, help="What region you'd like to collect data for", default="us", - choices=fred_view.ICE_BOFA_TO_OPTIONS["Area"], + choices=fred_model.ICE_BOFA_TO_OPTIONS["Area"], ) parser.add_argument( @@ -1058,7 +1060,7 @@ class FixedIncomeController(BaseController): type=str, help="What grade you'd like to collect data for", default="non_sovereign", - choices=fred_view.ICE_BOFA_TO_OPTIONS["Grade"], + choices=fred_model.ICE_BOFA_TO_OPTIONS["Grade"], ) parser.add_argument( @@ -1199,7 +1201,7 @@ class FixedIncomeController(BaseController): type=str, help="What type you'd like to collect data for", default="30d", - choices=fred_view.CP_TO_OPTIONS["Maturity"], + choices=fred_model.CP_TO_OPTIONS["Maturity"], ) parser.add_argument( @@ -1209,7 +1211,7 @@ class FixedIncomeController(BaseController): type=str, help="What category you'd like to collect data for", default="financial", - choices=fred_view.CP_TO_OPTIONS["Category"], + choices=fred_model.CP_TO_OPTIONS["Category"], ) parser.add_argument( @@ -1219,7 +1221,7 @@ class FixedIncomeController(BaseController): type=str, help="What grade you'd like to collect data for", default="aa", - choices=fred_view.CP_TO_OPTIONS["Grade"], + choices=fred_model.CP_TO_OPTIONS["Grade"], ) parser.add_argument( @@ -1414,7 +1416,7 @@ class FixedIncomeController(BaseController): type=str, help="What category you'd like to collect data for", default="all", - choices=fred_view.ICE_BOFA_TO_OPTIONS["Category"], + choices=fred_model.ICE_BOFA_TO_OPTIONS["Category"], ) parser.add_argument( @@ -1424,7 +1426,7 @@ class FixedIncomeController(BaseController): type=str, help="What region you'd like to collect data for", default="us", - choices=fred_view.ICE_BOFA_TO_OPTIONS["Area"], + choices=fred_model.ICE_BOFA_TO_OPTIONS["Area"], ) parser.add_argument( @@ -1434,7 +1436,7 @@ class FixedIncomeController(BaseController): type=str, help="What grade you'd like to collect data for", default="non_sovereign", - choices=fred_view.ICE_BOFA_TO_OPTIONS["Grade"], + choices=fred_model.ICE_BOFA_TO_OPTIONS["Grade"], ) parser.add_argument( @@ -1507,7 +1509,7 @@ class FixedIncomeController(BaseController): type=str, help="Selected Treasury Bill", default="3_month", - choices=fred_view.TBFFR_PARAMETER_TO_FRED_ID.keys(), + choices=fred_model.TBFFR_PARAMETER_TO_FRED_ID.keys(), ) parser.add_argument( "-s", diff --git a/openbb_terminal/fixedincome/fred_model.py b/openbb_terminal/fixedincome/fred_model.py index e1d3bf64521..99324d58aac 100644 --- a/openbb_terminal/fixedincome/fred_model.py +++ b/openbb_terminal/fixedincome/fred_model.py @@ -72,97 +72,6 @@ commercial_paper_path = pathlib.Path(__file__).parent / "commercial_paper.xlsx" spot_rates_path = pathlib.Path(__file__).parent / "corporate_spot_rates.xlsx" -ID_TO_NAME_SOFR = { - "SOFR": "Secured Overnight Financing Rate (SOFR)", - "SOFR30DAYAVG": "30-Day Average SOFR", - "SOFR90DAYAVG": "90-Day Average SOFR", - "SOFR180DAYAVG": "180-Day Average SOFR", - "SOFRINDEX": "SOFR Index", -} -ID_TO_NAME_SONIA = { - "IUDSOIA": "Daily Sterling Overnight Index Average (SONIA) Rate", - "IUDZOS2": "SONIA Compounded Index", - "IUDZLS6": "SONIA Rate: 10th percentile", - "IUDZLS7": "SONIA Rate: 25th percentile", - "IUDZLS8": "SONIA Rate: 75th percentile", - "IUDZLS9": "SONIA Rate: 90th percentile", - "IUDZLT2": "SONIA Rate Total Nominal Value", -} -ID_TO_NAME_AMERIBOR = { - "AMERIBOR": "Overnight Unsecured AMERIBOR Benchmark Interest Rate", - "AMBOR30T": "AMERIBOR Term-30 Derived Interest Rate Index", - "AMBOR90T": "AMERIBOR Term-90 Derived Interest Rate Index", - "AMBOR1W": "1-Week AMERIBOR Term Structure of Interest Rates", - "AMBOR1M": "1-Month AMERIBOR Term Structure of Interest Rates", - "AMBOR3M": "3-Month AMERIBOR Term Structure of Interest Rates", - "AMBOR6M": "6-Month AMERIBOR Term Structure of Interest Rates", - "AMBOR1Y": "1-Year AMERIBOR Term Structure of Interest Rates", - "AMBOR2Y": "2-Year AMERIBOR Term Structure of Interest Rates", - "AMBOR30": "30-Day Moving Average AMERIBOR Benchmark Interest Rate", - "AMBOR90": "90-Day Moving Average AMERIBOR Benchmark Interest Rate", -} -ID_TO_NAME_FED = { - "FEDFUNDS": "Monthly Effective Federal Funds Rate", - "EFFR": "Daily Effective Federal Funds Rate", - "DFF": "Daily Effective Federal Funds Rate", - "OBFR": "Daily Overnight Bank Funding Rate", - "FF": "Weekly Effective Federal Funds Rate", - "RIFSPFFNB": "Daily (Excl. Weekends) Effective Federal Funds Rate", - "RIFSPFFNA": "Annual Effective Federal Funds Rate", - "RIFSPFFNBWAW": "Biweekly Effective Federal Funds Rate", - "EFFRVOL": "Effective Federal Funds Volume", - "OBFRVOL": "Overnight Bank Funding Volume", -} - -ID_TO_NAME_DWPCR = { - "MPCREDIT": "Monthly", - "RIFSRPF02ND": "Daily (incl. Weekends)", - "WPCREDIT": "Weekly", - "DPCREDIT": "Daily (excl. Weekends)", - "RIFSRPF02NA": "Annual", -} -ID_TO_NAME_TMC = { - "T10Y3M": "3-Month", - "T10Y2Y": "2-Year", -} -ID_TO_NAME_FFRMC = { - "T10YFF": "10-Year", - "T5YFF": "5-Year", - "T1YFF": "1-Year", - "T6MFF": "6-Month", - "T3MFF": "3-Month", -} -ID_TO_NAME_SECONDARY = { - "TB3MS": "3-Month", - "DTB4WK": "4-Week", - "DTB1YR": "1-Year", - "DTB6": "6-Month", -} -ID_TO_NAME_TIPS = { - "DFII5": "5-Year", - "DFII7": "7-Year", - "DFII10": "10-Year", - "DFII20": "20-Year", - "DFII30": "30-Year", -} -ID_TO_NAME_CMN = { - "DGS1MO": "1 Month", - "DGS3MO": "3 Month", - "DGS6MO": "6 Month", - "DGS1": "1 Year", - "DGS2": "2 Year", - "DGS3": "3 Year", - "DGS5": "5 Year", - "DGS7": "7 Year", - "DGS10": "10 Year", - "DGS20": "20 Year", - "DGS30": "30 Year", -} -ID_TO_NAME_TBFFR = { - "TB3SMFFM": "3 Month", - "TB6SMFFM": "6 Month", -} - NAME_TO_ID_PROJECTION = { "Range High": ["FEDTARRH", "FEDTARRHLR"], "Central tendency High": ["FEDTARCTH", "FEDTARCTHLR"], @@ -247,13 +156,6 @@ MOODY_TO_OPTIONS: Dict[str, Dict] = { }, "Spread": ["treasury", "fed_funds"], # type: ignore } - -CP_TO_OPTIONS = { - "Maturity": ["15d", "30d", "60d", "7d", "90d", "overnight"], - "Category": ["asset_backed", "financial", "non_financial", "spread"], - "Grade": ["a2_p2", "aa"], -} - SPOT_TO_OPTIONS = { "Maturity": [ "1y", @@ -459,6 +361,11 @@ SPOT_TO_OPTIONS = { ], "Category": ["spot_rate", "par_yield"], } +CP_TO_OPTIONS = { + "Maturity": ["15d", "30d", "60d", "7d", "90d", "overnight"], + "Category": ["asset_backed", "financial", "non_financial", "spread"], + "Grade": ["a2_p2", "aa"], +} ESTR_PARAMETER_TO_ECB_ID = { "volume_weighted_trimmed_mean_rate": "ECBESTRVOLWGTTRMDMNRT", @@ -719,8 +626,9 @@ def get_estr( ) -> pd.DataFrame: series_id = ESTR_PARAMETER_TO_ECB_ID.get(parameter, "") - df = get_series_data(series_id=series_id, start_date=start_date, end_date=end_date) - return df + return pd.DataFrame( + get_series_data(series_id=series_id, start_date=start_date, end_date=end_date) + ) @log_start_end(log=logger) @@ -732,8 +640,9 @@ def get_sofr( ) -> pd.DataFrame: series_id = SOFR_PARAMETER_TO_FRED_ID.get(parameter, "") - df = get_series_data(series_id=series_id, start_date=start_date, end_date=end_date) - return df + return pd.DataFrame( + get_series_data(series_id=series_id, start_date=start_date, end_date=end_date) + ) @log_start_end(log=logger) @@ -745,8 +654,9 @@ def get_sonia( ) -> pd.DataFrame: series_id = SONIA_PARAMETER_TO_FRED_ID.get(parameter, "") - df = get_series_data(series_id=series_id, start_date=start_date, end_date=end_date) - return df + return pd.DataFrame( + get_series_data(series_id=series_id, start_date=start_date, end_date=end_date) + ) @log_start_end(log=logger) @@ -806,8 +716,8 @@ def get_fed( df = df.dropna() return df - return get_series_data( - series_id=series_id, start_date=start_date, end_date=end_date + return pd.DataFrame( + get_series_data(series_id=series_id, start_date=start_date, end_date=end_date) ) @@ -815,7 +725,9 @@ def get_iorb( start_date: Optional[str] = None, end_date: Optional[str] = None, ) -> pd.DataFrame: - return get_series_data(series_id="IORB", start_date=start_date, end_date=end_date) + return pd.DataFrame( + get_series_data(series_id="IORB", start_date=start_date, end_date=end_date) + ) def get_projection(long_run: bool = False): @@ -836,8 +748,8 @@ def get_dwpcr( end_date: Optional[str] = None, ) -> pd.DataFrame: series_id = DWPCR_PARAMETER_TO_FRED_ID[parameter] - return get_series_data( - series_id=series_id, start_date=start_date, end_date=end_date + return pd.DataFrame( + get_series_data(series_id=series_id, start_date=start_date, end_date=end_date) ) @@ -877,8 +789,8 @@ def get_usrates( end_date: Optional[str] = None, ): series_id = USARATES_TO_FRED_ID[maturity][parameter] - return get_series_data( - series_id=series_id, start_date=start_date, end_date=end_date + return pd.DataFrame( + get_series_data(series_id=series_id, start_date=start_date, end_date=end_date) ) @@ -1032,7 +944,7 @@ def get_tbffr( ) -> pd.DataFrame: series_id = TBFFR_PARAMETER_TO_FRED_ID[parameter] - return get_series_data(series_id, start_date, end_date) + return pd.DataFrame(get_series_data(series_id, start_date, end_date)) def get_icespread( @@ -1049,7 +961,7 @@ def get_ffrmc( end_date: Optional[str] = None, ) -> pd.DataFrame: series_id = FFRMC_PARAMETER_TO_FRED_ID[parameter] - return get_series_data(series_id, start_date, end_date) + return pd.DataFrame(get_series_data(series_id, start_date, end_date)) def get_tmc( @@ -1058,4 +970,4 @@ def get_tmc( end_date: Optional[str] = None, ) -> pd.DataFrame: series_id = TMC_PARAMETER_TO_FRED_ID[parameter] - return get_series_data(series_id, start_date, end_date) + return pd.DataFrame(get_series_data(series_id, start_date, end_date)) diff --git a/openbb_terminal/fixedincome/fred_view.py b/openbb_terminal/fixedincome/fred_view.py index 86e4a209218..68f2504ace9 100644 --- a/openbb_terminal/fixedincome/fred_view.py +++ b/openbb_terminal/fixedincome/fred_view.py @@ -26,53 +26,6 @@ logger = logging.getLogger(__name__) # pylint: disable=too-many-lines -YIELD_CURVE_SERIES_NOMINAL = { - "1Month": "DGS1MO", - "3Month": "DGS3MO", - "6Month": "DGS6MO", - "1Year": "DGS1", - "2Year": "DGS2", - "3Year": "DGS3", - "5Year": "DGS5", - "7Year": "DGS7", - "10Year": "DGS10", - "20Year": "DGS20", - "30Year": "DGS30", -} -YIELD_CURVE_SERIES_REAL = { - "5Year": "DFII5", - "7Year": "DFII7", - "10Year": "DFII10", - "20Year": "DFII20", - "30Year": "DFII30", -} - -YIELD_CURVE_SERIES_CORPORATE_SPOT = { - "6Month": "HQMCB6MT", - "1Year": "HQMCB1YR", - "2Year": "HQMCB2YR", - "3Year": "HQMCB3YR", - "5Year": "HQMCB5YR", - "7Year": "HQMCB7YR", - "10Year": "HQMCB10YR", - "20Year": "HQMCB20YR", - "30Year": "HQMCB30YR", - "50Year": "HQMCB50YR", - "75Year": "HQMCB75YR", - "100Year": "HQMCB100YR", -} -YIELD_CURVE_SERIES_CORPORATE_PAR = { - "2Year": "HQMCB2YRP", - "5Year": "HQMCB5YRP", - "10Year": "HQMCB10YRP", - "30Year": "HQMCB30YRP", -} - -YIELD_CURVE_NOMINAL_RATES = [1 / 12, 0.25, 0.5, 1, 2, 3, 5, 7, 10, 20, 30] -YIELD_CURVE_SPOT_RATES = [0.5, 1, 2, 3, 5, 7, 10, 20, 30, 50, 75, 100] -YIELD_CURVE_REAL_RATES = [5, 7, 10, 20, 30] -YIELD_CURVE_PAR_RATES = [2, 5, 10, 30] - ice_bofa_path = pathlib.Path(__file__).parent / "ice_bofa_indices.xlsx" commercial_paper_path = pathlib.Path(__file__).parent / "commercial_paper.xlsx" spot_rates_path = pathlib.Path(__file__).parent / "corporate_spot_rates.xlsx" @@ -189,43 +142,6 @@ NAME_TO_ID_PROJECTION = { NAME_TO_ID_ECB = {"deposit": "ECBDFR", "lending": "ECBMLFR", "refinancing": "ECBMRRFR"} -USARATES_TO_FRED_ID = { - "4_week": {"tbill": "DTB4WK"}, - "1_month": {"cmn": "DGS1MO"}, - "3_month": {"tbill": "TB3MS", "cmn": "DGS3MO"}, - "6_month": {"tbill": "DTB6", "cmn": "DGS6MO"}, - "1_year": {"tbill": "DTB1YR", "cmn": "DGS1"}, - "2_year": {"cmn": "DGS2"}, - "3_year": {"cmn": "DGS3"}, - "5_year": {"tips": "DFII5", "cmn": "DGS5"}, - "7_year": {"tips": "DFII7", "cmn": "DGS7"}, - "10_year": {"tips": "DFII10", "cmn": "DGS10"}, - "20_year": {"tips": "DFII20", "cmn": "DGS20"}, - "30_year": {"tips": "DFII30", "cmn": "DGS30"}, -} - -ICE_BOFA_TO_OPTIONS = { - "Type": ["total_return", "yield", "yield_to_worst"], - "Category": ["all", "duration", "eur", "usd"], - "Area": ["asia", "emea", "eu", "ex_g10", "latin_america", "us"], - "Grade": [ - "a", - "aa", - "aaa", - "b", - "bb", - "bbb", - "ccc", - "crossover", - "high_grade", - "high_yield", - "non_financial", - "non_sovereign", - "private_sector", - "public_sector", - ], -} - MOODY_TO_OPTIONS: Dict[str, Dict] = { "Type": { "aaa": { @@ -262,297 +178,6 @@ MOODY_TO_OPTIONS: Dict[str, Dict] = { "Spread": ["treasury", "fed_funds"], # type: ignore } -CP_TO_OPTIONS = { - "Maturity": ["15d", "30d", "60d", "7d", "90d", "overnight"], - "Category": ["asset_backed", "financial", "non_financial", "spread"], - "Grade": ["a2_p2", "aa"], -} - -SPOT_TO_OPTIONS = { - "Maturity": [ - "1y", - "1.5y", - "2y", - "2.5y", - "3y", - "3.5y", - "4y", - "4.5y", - "5y", - "5.5y", - "6 y", - "6y", - "6.5y", - "7y", - "7.5y", - "8y", - "8.5y", - "9y", - "9.5y", - "10y", - "10.5y", - "11y", - "11.5y", - "12y", - "12.5y", - "13y", - "13.5y", - "14y", - "14.5y", - "15y", - "15.5y", - "16y", - "16.5y", - "17y", - "17.5y", - "18y", - "18.5y", - "19y", - "19.5y", - "20y", - "20.5y", - "21y", - "21.5y", - "22y", - "22.5y", - "23y", - "23.5y", - "24y", - "24.5y", - "25y", - "25.5y", - "26y", - "26.5y", - "27y", - "27.5y", - "28y", - "28.5y", - "29y", - "29.5y", - "30y", - "30.5y", - "31y", - "31.5y", - "32y", - "32.5y", - "33y", - "33.5y", - "34y", - "34.5y", - "35y", - "35.5y", - "36y", - "36.5y", - "37y", - "37.5y", - "38y", - "38.5y", - "39y", - "39.5y", - "40y", - "40.5y", - "41y", - "41.5y", - "42y", - "42.5y", - "43y", - "43.5y", - "44y", - "44.5y", - "45y", - "45.5y", - "46y", - "46.5y", - "47y", - "47.5y", - "48y", - "48.5y", - "49y", - "49.5y", - "50y", - "50.5y", - "51y", - "51.5y", - "52y", - "52.5y", - "53y", - "53.5y", - "54y", - "54.5y", - "55y", - "55.5y", - "56y", - "56.5y", - "57y", - "57.5y", - "58y", - "58.5y", - "59y", - "59.5y", - "60y", - "60.5y", - "61y", - "61.5y", - "62y", - "62.5y", - "63y", - "63.5y", - "64y", - "64.5y", - "65y", - "65.5y", - "66y", - "66.5y", - "67y", - "67.5y", - "68y", - "68.5y", - "69y", - "69.5y", - "70y", - "70.5y", - "71y", - "71.5y", - "72y", - "72.5y", - "73y", - "73.5y", - "74y", - "74.5y", - "75y", - "75.5y", - "76y", - "76.5y", - "77y", - "77.5y", - "78y", - "78.5y", - "79y", - "79.5y", - "80y", - "80.5y", - "81y", - "81.5y", - "82y", - "82.5y", - "83y", - "83.5y", - "84y", - "84.5y", - "85y", - "85.5y", - "86y", - "86.5y", - "87y", - "87.5y", - "88y", - "88.5y", - "89y", - "89.5y", - "90y", - "90.5y", - "91y", - "91.5y", - "92y", - "92.5y", - "93y", - "93.5y", - "94y", - "94.5y", - "95y", - "95.5y", - "96y", - "96.5y", - "97y", - "97.5y", - "98y", - "98.5y", - "99y", - "99.5y", - "100y", - ], - "Category": ["spot_rate", "par_yield"], -} - -ESTR_PARAMETER_TO_ECB_ID = { - "volume_weighted_trimmed_mean_rate": "ECBESTRVOLWGTTRMDMNRT", - "number_of_transactions": "ECBESTRNUMTRANS", - "number_of_active_banks": "ECBESTRNUMACTBANKS", - "total_volume": "ECBESTRTOTVOL", - "share_of_volume_of_the_5_largest_active_banks": "ECBESTRSHRVOL5LRGACTBNK", - "rate_at_75th_percentile_of_volume": "ECBESTRRT75THPCTVOL", - "rate_at_25th_percentile_of_volume": "ECBESTRRT25THPCTVOL", -} - -SOFR_PARAMETER_TO_FRED_ID = { - "overnight": "SOFR", - "30_day_average": "SOFR30DAYAVG", - "90_day_average": "SOFR90DAYAVG", - "180_day_average": "SOFR180DAYAVG", - "index": "SOFRINDEX", -} -SONIA_PARAMETER_TO_FRED_ID = { - "rate": "IUDSOIA", - "index": "IUDZOS2", - "10th_percentile": "IUDZLS6", - "25th_percentile": "IUDZLS7", - "75th_percentile": "IUDZLS8", - "90th_percentile": "IUDZLS9", - "total_nominal_value": "IUDZLT2", -} -AMERIBOR_PARAMETER_TO_FRED_ID = { - "overnight": "AMERIBOR", - "term_30": "AMBOR30T", - "term_90": "AMBOR90T", - "1_week_term_structure": "AMBOR1W", - "1_month_term_structure": "AMBOR1M", - "3_month_term_structure": "AMBOR3M", - "6_month_term_structure": "AMBOR6M", - "1_year_term_structure": "AMBOR1Y", - "2_year_term_structure": "AMBOR2Y", - "30_day_ma": "AMBOR30", - "90_day_ma": "AMBOR90", -} - -FED_PARAMETER_TO_FRED_ID = { - "monthly": "FEDFUNDS", - "daily": "DFF", - "weekly": "FF", - "daily_excl_weekend": "RIFSPFFNB", - "annual": "RIFSPFFNA", - "biweekly": "RIFSPFFNBWAW", - "volume": "EFFRVOL", -} - -OBFR_PARAMETER_TO_FRED_ID = { - "daily": "OBFR", - "volume": "OBFRVOL", -} - -DWPCR_PARAMETER_TO_FRED_ID = { - "daily_excl_weekend": "DPCREDIT", - "monthly": "MPCREDIT", - "weekly": "WPCREDIT", - "daily": "RIFSRPF02ND", - "annual": "RIFSRPF02NA", -} -TMC_PARAMETER_TO_FRED_ID = { - "3_month": "T10Y3M", - "2_year": "T10Y2Y", -} -FFRMC_PARAMETER_TO_FRED_ID = { - "10_year": "T10YFF", - "5_year": "T5YFF", - "1_year": "T1YFF", - "6_month": "T6MFF", - "3_month": "T3MFF", -} - -TBFFR_PARAMETER_TO_FRED_ID = { - "3_month": "TB3SMFFM", - "6_month": "TB6SMFFM", -} - @log_start_end(log=logger) @check_api_key(["API_FRED_KEY"]) @@ -729,7 +354,7 @@ def plot_sonia( external_axes: Optional[List[plt.Axes]] External axes (1 axis is expected in the list) """ - series_id = SONIA_PARAMETER_TO_FRED_ID[parameter] + series_id = fred_model.SONIA_PARAMETER_TO_FRED_ID[parameter] df = fred_model.get_sonia( parameter=parameter, start_date=start_date, end_date=end_date