Change style and run linter

This commit is contained in:
james
2023-02-21 10:05:54 -05:00
parent 55f0751082
commit cfa182b0de
12 changed files with 318 additions and 346 deletions

View File

@@ -68,7 +68,6 @@ class EconomyController(BaseController):
"map",
"rtps",
"bigmac",
# "spread",
"events",
"edebt",
]
@@ -253,9 +252,6 @@ class EconomyController(BaseController):
mt.add_cmd("futures")
mt.add_cmd("map")
mt.add_cmd("bigmac")
# Comment out spread while investpy is donw :()
# mt.add_cmd("spread")
mt.add_cmd("ycrv")
mt.add_cmd("events")
mt.add_cmd("edebt")
mt.add_raw("\n")

View File

@@ -4,7 +4,6 @@ __docformat__ = "numpy"
import logging
import os
import textwrap
from datetime import datetime, timedelta
from typing import List, Optional, Tuple
import certifi

View File

@@ -109,7 +109,9 @@ def get_ecb_yield_curve(
return pd.DataFrame()
if detailed:
console.print("Note that due to the large amount of data, this may take a while. Use CTRL + C to cancel.")
console.print(
"Note that due to the large amount of data, this may take a while. Use CTRL + C to cancel."
)
series_id = [
f"{yield_type}{y}Y{m}M" if y != 0 else f"{yield_type}{m}M"
for y in range(0, 30)
@@ -145,13 +147,14 @@ def get_ecb_yield_curve(
return pd.DataFrame()
# Add in logic that will get the most recent date.
get_last = False
if not date:
date = (datetime.now() - timedelta(days=1)).strftime("%Y-%m-%d")
try:
for i in optional_rich_track( range(len(series_id)), desc="Obtaining yield curve data"):
for i in optional_rich_track(
range(len(series_id)), desc="Obtaining yield curve data"
):
temp = get_series_data(series_id[i], date, date)
temp.columns = [labels[i]]
df = pd.concat([df, temp], axis=1)
@@ -167,13 +170,17 @@ def get_ecb_yield_curve(
# Drop rows with NaN -- corresponding to weekends typically
df = df.dropna()
if datetime.strptime(date, "%Y-%m-%d") not in df.index:
nearest_value = df.index.get_indexer([datetime.strptime(date, "%Y-%m-%d")], method='nearest')
nearest_value = df.index.get_indexer(
[datetime.strptime(date, "%Y-%m-%d")], method="nearest"
)
date_of_yield = df.iloc[nearest_value].index[0].date()
series = df[df.index == df.iloc[nearest_value].index[0]]
series = df[df.index == df.iloc[nearest_value].index[0]]
if series.empty:
return pd.DataFrame(), date_of_yield
rates = pd.DataFrame(series.values.T, columns=["Rate"])
console.print(f"{date} not available, therefore selecting the nearest date, {date_of_yield}.")
console.print(
f"{date} not available, therefore selecting the nearest date, {date_of_yield}."
)
else:
date_of_yield = date
series = df[df.index == datetime.strptime(date, "%Y-%m-%d")]

View File

@@ -1,24 +1,24 @@
""" ECB view """
__docformat__ = "numpy"
from typing import Optional, List
from itertools import cycle
import logging
import os
from itertools import cycle
from typing import List, Optional
import pandas as pd
from matplotlib import pyplot as plt
from openbb_terminal.config_terminal import theme
from openbb_terminal.config_plot import PLOT_DPI
from openbb_terminal.config_terminal import theme
from openbb_terminal.decorators import log_start_end
from openbb_terminal.fixedincome import ecb_model
from openbb_terminal.helper_funcs import (
export_data,
plot_autoscale,
is_valid_axes_count,
plot_autoscale,
print_rich_table,
)
from openbb_terminal.fixedincome import ecb_model
from openbb_terminal.rich_config import console
logger = logging.getLogger(__name__)
@@ -74,10 +74,6 @@ def plot_estr(
ax.plot(
df.index,
df.values,
marker="o",
linestyle="dashed",
linewidth=2,
markersize=4,
color=next(colors, "#FCED00"),
)
ax.set_title(ID_TO_NAME[series_id])
@@ -85,7 +81,7 @@ def plot_estr(
if external_axes is None:
theme.visualize_output()
if export:
if "[Percent]" in ID_TO_NAME[series_id]:
# Check whether it is a percentage, relevant for exporting
@@ -98,7 +94,7 @@ def plot_estr(
os.path.dirname(os.path.abspath(__file__)),
series_id,
df_transformed,
sheet_name
sheet_name,
)
@@ -170,7 +166,7 @@ def display_ecb_yield_curve(
ax.set_title(
f"Euro Area{' AAA Bonds' if not any_rating else ' All Bonds'} {yield_type.replace('_', ' ').title()} "
f"Yield Curve for {date_of_yield}",
fontsize=15
fontsize=15,
)
theme.visualize_output()
@@ -189,5 +185,5 @@ def display_ecb_yield_curve(
os.path.dirname(os.path.abspath(__file__)),
"ecbycrv",
rates / 100,
sheet_name
sheet_name,
)

View File

@@ -2,8 +2,8 @@
__docformat__ = "numpy"
import logging
from typing import Dict, Any, Optional
from datetime import datetime
from typing import Any, Dict, Optional
import pandas as pd
import pandas_datareader.data as web

View File

@@ -1,23 +1,23 @@
""" EconDB view """
__docformat__ = "numpy"
from typing import Optional, List
from itertools import cycle
import logging
import os
import pandas as pd
from itertools import cycle
from typing import List, Optional
import pandas as pd
from matplotlib import pyplot as plt
from openbb_terminal.config_terminal import theme
from openbb_terminal.config_plot import PLOT_DPI
from openbb_terminal.decorators import log_start_end, check_api_key
from openbb_terminal.config_terminal import theme
from openbb_terminal.decorators import check_api_key, log_start_end
from openbb_terminal.fixedincome import econdb_model
from openbb_terminal.helper_funcs import (
export_data,
plot_autoscale,
is_valid_axes_count,
plot_autoscale,
)
from openbb_terminal.fixedincome import econdb_model
logger = logging.getLogger(__name__)
@@ -33,7 +33,7 @@ MATURITY_TO_ID = {
"7_year": "7y",
"10_year": "10y",
"20_year": "20y",
"30_year": "30y"
"30_year": "30y",
}
@@ -72,7 +72,13 @@ def plot_cmn(
external_axes: Optional[List[plt.Axes]]
External axes (1 axis is expected in the list)
"""
df = econdb_model.get_treasuries(instruments=["nominal"], maturities=[MATURITY_TO_ID[maturity]], frequency="daily", start_date=start_date, end_date=end_date)
df = econdb_model.get_treasuries(
instruments=["nominal"],
maturities=[MATURITY_TO_ID[maturity]],
frequency="daily",
start_date=start_date,
end_date=end_date,
)
# This plot has 1 axis
if not external_axes:
@@ -86,13 +92,11 @@ def plot_cmn(
ax.plot(
df.index,
df.values,
marker="o",
linestyle="dashed",
linewidth=2,
markersize=4,
color=next(colors, "#FCED00"),
)
ax.set_title(f"{maturity.replace('-', ' ')} Treasury Constant Maturity Nominal Market Yield [Percent]")
ax.set_title(
f"{maturity.replace('-', ' ')} Treasury Constant Maturity Nominal Market Yield [Percent]"
)
theme.style_primary_axis(ax)
if external_axes is None:
@@ -141,7 +145,13 @@ def plot_tips(
external_axes: Optional[List[plt.Axes]]
External axes (1 axis is expected in the list)
"""
df = econdb_model.get_treasuries(instruments=["inflation"], maturities=[MATURITY_TO_ID[maturity]], frequency="daily", start_date=start_date, end_date=end_date)
df = econdb_model.get_treasuries(
instruments=["inflation"],
maturities=[MATURITY_TO_ID[maturity]],
frequency="daily",
start_date=start_date,
end_date=end_date,
)
# This plot has 1 axis
if not external_axes:
@@ -155,14 +165,12 @@ def plot_tips(
ax.plot(
df.index,
df.values,
marker="o",
linestyle="dashed",
linewidth=2,
markersize=4,
color=next(colors, "#FCED00"),
)
ax.set_title(f"{maturity.replace('-', ' ')} Yields on Treasury inflation protected securities (TIPS) adjusted to "
f"constant maturities [Percent]")
ax.set_title(
f"{maturity.replace('-', ' ')} Yields on Treasury inflation protected securities (TIPS) adjusted to "
f"constant maturities [Percent]"
)
theme.style_primary_axis(ax)
if external_axes is None:
@@ -205,7 +213,13 @@ def plot_tbill(
external_axes: Optional[List[plt.Axes]]
External axes (1 axis is expected in the list)
"""
df = econdb_model.get_treasuries(instruments=["secondary"], maturities=[MATURITY_TO_ID[maturity]], frequency="daily", start_date=start_date, end_date=end_date)
df = econdb_model.get_treasuries(
instruments=["secondary"],
maturities=[MATURITY_TO_ID[maturity]],
frequency="daily",
start_date=start_date,
end_date=end_date,
)
# This plot has 1 axis
if not external_axes:
@@ -219,13 +233,11 @@ def plot_tbill(
ax.plot(
df.index,
df.values,
marker="o",
linestyle="dashed",
linewidth=2,
markersize=4,
color=next(colors, "#FCED00"),
)
ax.set_title(f"{maturity.replace('-', ' ')} Treasury Bill Secondary Market Rate, Discount Basis [Percent]")
ax.set_title(
f"{maturity.replace('-', ' ')} Treasury Bill Secondary Market Rate, Discount Basis [Percent]"
)
theme.style_primary_axis(ax)
if external_axes is None:

View File

@@ -5,27 +5,24 @@ __docformat__ = "numpy"
import argparse
import logging
from datetime import datetime, timedelta
from typing import List
import pandas as pd
from openbb_terminal.custom_prompt_toolkit import NestedCompleter
from openbb_terminal import feature_flags as obbff
from openbb_terminal.custom_prompt_toolkit import NestedCompleter
from openbb_terminal.decorators import log_start_end
from openbb_terminal.fixedincome import ecb_view, oecd_view, econdb_view, yfinance_view
from openbb_terminal.fixedincome import fred_view, oecd_model
from openbb_terminal.fixedincome import ecb_view, fred_view, oecd_model, oecd_view
from openbb_terminal.helper_funcs import (
EXPORT_BOTH_RAW_DATA_AND_FIGURES,
EXPORT_ONLY_RAW_DATA_ALLOWED,
list_from_str,
print_rich_table,
valid_date,
EXPORT_ONLY_RAW_DATA_ALLOWED,
)
from openbb_terminal.parent_classes import BaseController
from openbb_terminal.rich_config import console, MenuText
from openbb_terminal.menu import session
from openbb_terminal.parent_classes import BaseController
from openbb_terminal.rich_config import MenuText, console
logger = logging.getLogger(__name__)
@@ -110,14 +107,14 @@ class FixedIncomeController(BaseController):
"daily_excl_weekend": "RIFSPFFNB",
"annual": "RIFSPFFNA",
"biweekly": "RIFSPFFNBWAW",
"volume": "EFFRVOL"
"volume": "EFFRVOL",
}
obfr_parameter_to_fred_id = {
"daily": "OBFR",
"volume": "OBFRVOL",
}
dwpcr_parameter_to_fred_id = {
"daily_excl_weekend": "DPCREDIT",
"monthly": "MPCREDIT",
@@ -136,7 +133,7 @@ class FixedIncomeController(BaseController):
"6_month": "T6MFF",
"3_month": "T3MFF",
}
tbffr_parameter_to_fred_id = {
"3_month": "TB3SMFFM",
"6_month": "TB6SMFFM",
@@ -148,8 +145,12 @@ class FixedIncomeController(BaseController):
if session and obbff.USE_PROMPT_TOOLKIT:
self.choices: dict = self.choices_default
self.choices["treasury"]["--short"] = {c: None for c in oecd_model.COUNTRY_TO_CODE}
self.choices["treasury"]["--long"] = {c: None for c in oecd_model.COUNTRY_TO_CODE}
self.choices["treasury"]["--short"] = {
c: None for c in oecd_model.COUNTRY_TO_CODE
}
self.choices["treasury"]["--long"] = {
c: None for c in oecd_model.COUNTRY_TO_CODE
}
self.completer = NestedCompleter.from_nested_dict(self.choices) # type: ignore
def print_help(self):
@@ -196,7 +197,7 @@ class FixedIncomeController(BaseController):
"€STR is published on each TARGET2 business day based on transactions conducted "
"and settled on the previous TARGET2 business day (the reporting date “T”) "
"with a maturity date of T+1 which are deemed to have been executed at arm’s "
"length and thus reflect market rates in an unbiased way."
"length and thus reflect market rates in an unbiased way.",
)
parser.add_argument(
"-p",
@@ -233,9 +234,7 @@ class FixedIncomeController(BaseController):
ns_parser.start_date,
ns_parser.end_date,
ns_parser.export,
" ".join(ns_parser.sheet_name)
if ns_parser.sheet_name
else None,
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None,
)
elif ns_parser.source == "ECB":
ecb_view.plot_estr(
@@ -243,9 +242,7 @@ class FixedIncomeController(BaseController):
ns_parser.start_date,
ns_parser.end_date,
ns_parser.export,
" ".join(ns_parser.sheet_name)
if ns_parser.sheet_name
else None,
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None,
)
@log_start_end(log=logger)
@@ -294,9 +291,7 @@ class FixedIncomeController(BaseController):
ns_parser.start_date,
ns_parser.end_date,
ns_parser.export,
" ".join(ns_parser.sheet_name)
if ns_parser.sheet_name
else None,
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None,
)
@log_start_end(log=logger)
@@ -345,9 +340,7 @@ class FixedIncomeController(BaseController):
ns_parser.start_date,
ns_parser.end_date,
ns_parser.export,
" ".join(ns_parser.sheet_name)
if ns_parser.sheet_name
else None,
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None,
)
@log_start_end(log=logger)
@@ -360,7 +353,7 @@ class FixedIncomeController(BaseController):
description="Ameribor (short for the American interbank offered rate) is "
"a benchmark interest rate that reflects the true cost of short-term interbank borrowing. "
"This rate is based on transactions in overnight unsecured loans conducted on the American "
"Financial Exchange (AFX)."
"Financial Exchange (AFX).",
)
parser.add_argument(
"-p",
@@ -396,9 +389,7 @@ class FixedIncomeController(BaseController):
ns_parser.start_date,
ns_parser.end_date,
ns_parser.export,
" ".join(ns_parser.sheet_name)
if ns_parser.sheet_name
else None,
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None,
)
@log_start_end(log=logger)
@@ -438,7 +429,7 @@ class FixedIncomeController(BaseController):
help="Ending date (YYYY-MM-DD) of data",
default=None,
)
parser.add_argument(
"-o",
"--overnight",
@@ -463,13 +454,15 @@ class FixedIncomeController(BaseController):
help="Whether to show the target range data",
default=False,
)
ns_parser = self.parse_known_args_and_warn(
parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES, raw=True
)
if ns_parser:
if ns_parser.overnight and (ns_parser.target or ns_parser.quantiles):
console.print("The Overnight Bank Funding Rate has no target and quantiles data.")
console.print(
"The Overnight Bank Funding Rate has no target and quantiles data."
)
else:
fred_view.plot_fed(
self.fed_parameter_to_fred_id[ns_parser.parameter],
@@ -480,9 +473,7 @@ class FixedIncomeController(BaseController):
ns_parser.target,
ns_parser.raw,
ns_parser.export,
" ".join(ns_parser.sheet_name)
if ns_parser.sheet_name
else None,
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None,
)
@log_start_end(log=logger)
@@ -521,9 +512,7 @@ class FixedIncomeController(BaseController):
ns_parser.start_date,
ns_parser.end_date,
ns_parser.export,
" ".join(ns_parser.sheet_name)
if ns_parser.sheet_name
else None,
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None,
)
@log_start_end(log=logger)
@@ -533,7 +522,7 @@ class FixedIncomeController(BaseController):
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="projection",
description="Get the Federal Reserve's projection of the federal funds rate."
description="Get the Federal Reserve's projection of the federal funds rate.",
)
parser.add_argument(
"-l",
@@ -551,9 +540,7 @@ class FixedIncomeController(BaseController):
ns_parser.long_run,
ns_parser.raw,
ns_parser.export,
" ".join(ns_parser.sheet_name)
if ns_parser.sheet_name
else None,
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None,
)
@log_start_end(log=logger)
@@ -602,9 +589,7 @@ class FixedIncomeController(BaseController):
ns_parser.start_date,
ns_parser.end_date,
ns_parser.export,
" ".join(ns_parser.sheet_name)
if ns_parser.sheet_name
else None,
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None,
)
@log_start_end(log=logger)
@@ -617,7 +602,7 @@ class FixedIncomeController(BaseController):
description="Plot the three interest rates the ECB sets "
"every six weeks as part of its monetary policy, these are the "
"interest rate on the main refinancing operations (MRO), the rate on "
"the deposit facility and the rate on the marginal lending facility."
"the deposit facility and the rate on the marginal lending facility.",
)
parser.add_argument(
"-s",
@@ -642,7 +627,7 @@ class FixedIncomeController(BaseController):
type=str,
help="Whether to choose the deposit, marginal lending or main refinancing rate",
choices=["deposit", "lending", "refinancing"],
default=None
default=None,
)
ns_parser = self.parse_known_args_and_warn(
parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES, raw=True
@@ -654,9 +639,7 @@ class FixedIncomeController(BaseController):
ns_parser.type,
ns_parser.raw,
ns_parser.export,
" ".join(ns_parser.sheet_name)
if ns_parser.sheet_name
else None,
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None,
)
@log_start_end(log=logger)
@@ -666,10 +649,10 @@ class FixedIncomeController(BaseController):
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="treasury",
description='Plot short (3 month) and long (10 year) term interest rates from selected countries '
'including the possibility to plot forecasts for the next years.'
)
description="Plot short (3 month) and long (10 year) term interest rates from selected countries "
"including the possibility to plot forecasts for the next years.",
)
parser.add_argument(
"--short",
type=str,
@@ -677,7 +660,7 @@ class FixedIncomeController(BaseController):
help="Countries to get short term (3 month) interest rates for.",
default=None,
)
parser.add_argument(
"--long",
type=str,
@@ -717,11 +700,17 @@ class FixedIncomeController(BaseController):
)
if ns_parser:
if ns_parser.short is None and ns_parser.long is None:
console.print("[red]Please provide at least one country to plot "
"with --short (3 months) and/or --long (10 years).[/red]")
console.print(
"[red]Please provide at least one country to plot "
"with --short (3 months) and/or --long (10 years).[/red]"
)
else:
short_term_countries = list_from_str(ns_parser.short.lower()) if ns_parser.short else None
long_term_countries = list_from_str(ns_parser.long.lower()) if ns_parser.long else None
short_term_countries = (
list_from_str(ns_parser.short.lower()) if ns_parser.short else None
)
long_term_countries = (
list_from_str(ns_parser.long.lower()) if ns_parser.long else None
)
oecd_view.plot_treasuries(
short_term=short_term_countries,
long_term=long_term_countries,
@@ -834,9 +823,7 @@ class FixedIncomeController(BaseController):
ns_parser.start_date,
ns_parser.end_date,
ns_parser.export,
" ".join(ns_parser.sheet_name)
if ns_parser.sheet_name
else None,
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None,
)
@log_start_end(log=logger)
@@ -982,7 +969,7 @@ class FixedIncomeController(BaseController):
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="usrates",
description="Plot various rates from the United States. This includes tbill (Treasury Bills), "
"Constant Maturity treasuries (cmn) and Inflation Protected Treasuries (TIPS)"
"Constant Maturity treasuries (cmn) and Inflation Protected Treasuries (TIPS)",
)
parser.add_argument(
"-m",
@@ -1001,7 +988,7 @@ class FixedIncomeController(BaseController):
help="Choose either tbill (Treasury Bills), Constant Maturity treasuries (cmn) "
"or Inflation Protected Treasuries (TIPS)",
default="tbill",
choices=['tbill', 'cmn', 'tips']
choices=["tbill", "cmn", "tips"],
)
parser.add_argument(
"-o",
@@ -1009,9 +996,9 @@ class FixedIncomeController(BaseController):
dest="options",
action="store_true",
help="See the available options",
default=False
default=False,
)
parser.add_argument(
"-s",
"--start",
@@ -1036,11 +1023,16 @@ class FixedIncomeController(BaseController):
print_rich_table(
pd.DataFrame.from_dict(fred_view.USARATES_TO_FRED_ID).T.fillna("-"),
show_index=True,
title="Available options including FRED Series name"
title="Available options including FRED Series name",
)
elif (
ns_parser.parameter
not in fred_view.USARATES_TO_FRED_ID[ns_parser.maturity]
):
console.print(
f"[red]Maturity {ns_parser.maturity.replace('_', ' ')} is not "
f"available for {ns_parser.parameter}. Please use 'usrates --options'.[/red]"
)
elif ns_parser.parameter not in fred_view.USARATES_TO_FRED_ID[ns_parser.maturity]:
console.print(f"[red]Maturity {ns_parser.maturity.replace('_', ' ')} is not "
f"available for {ns_parser.parameter}. Please use 'usrates --options'.[/red]")
else:
fred_view.plot_usrates(
ns_parser.parameter,
@@ -1049,9 +1041,7 @@ class FixedIncomeController(BaseController):
ns_parser.end_date,
ns_parser.raw,
ns_parser.export,
" ".join(ns_parser.sheet_name)
if ns_parser.sheet_name
else None,
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None,
)
@log_start_end(log=logger)
@@ -1097,7 +1087,5 @@ class FixedIncomeController(BaseController):
ns_parser.start_date,
ns_parser.end_date,
ns_parser.export,
" ".join(ns_parser.sheet_name)
if ns_parser.sheet_name
else None,
)
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None,
)

View File

@@ -1,19 +1,19 @@
""" FRED model """
__docformat__ = "numpy"
from datetime import datetime, timedelta
import os
import logging
import os
from datetime import datetime, timedelta
from typing import Optional, Tuple
from requests import HTTPError
import certifi
import pandas as pd
from fredapi import Fred
import certifi
from requests import HTTPError
from openbb_terminal import config_terminal as cfg
from openbb_terminal.decorators import check_api_key, log_start_end
from openbb_terminal.rich_config import console
from openbb_terminal.decorators import log_start_end, check_api_key
# pylint: disable=attribute-defined-outside-init
@@ -148,7 +148,7 @@ def get_yield_curve(
if not date:
date = (datetime.now() - timedelta(days=7)).strftime("%Y-%m-%d")
get_last = True
if inflation_adjusted:
fred_series = YIELD_CURVE_SERIES_REAL
years = YIELD_CURVE_REAL_RATES
@@ -183,11 +183,7 @@ def get_yield_curve(
return pd.DataFrame(), date_of_yield
rates = pd.DataFrame(series.values.T, columns=["Rate"])
rates.insert(
0,
"Maturity",
years
)
rates.insert(0, "Maturity", years)
if return_date:
return rates, date_of_yield
return rates

View File

@@ -1,24 +1,24 @@
""" FRED view """
__docformat__ = "numpy"
from typing import Optional, List
from itertools import cycle
import logging
import os
from itertools import cycle
from typing import List, Optional
import pandas as pd
from matplotlib import pyplot as plt
from openbb_terminal.config_terminal import theme
from openbb_terminal.config_plot import PLOT_DPI
from openbb_terminal.decorators import log_start_end, check_api_key
from openbb_terminal.config_terminal import theme
from openbb_terminal.decorators import check_api_key, log_start_end
from openbb_terminal.fixedincome import fred_model
from openbb_terminal.helper_funcs import (
export_data,
plot_autoscale,
is_valid_axes_count,
plot_autoscale,
print_rich_table,
)
from openbb_terminal.fixedincome import fred_model
from openbb_terminal.rich_config import console
logger = logging.getLogger(__name__)
@@ -96,7 +96,7 @@ ID_TO_NAME_SECONDARY = {
"TB3MS": "3-Month",
"DTB4WK": "4-Week",
"DTB1YR": "1-Year",
"DTB6": "6-Month"
"DTB6": "6-Month",
}
ID_TO_NAME_TIPS = {
"DFII5": "5-Year",
@@ -124,24 +124,20 @@ ID_TO_NAME_TBFFR = {
}
NAME_TO_ID_PROJECTION = {
"Range High": [ 'FEDTARRH', 'FEDTARRHLR'],
"Central tendency High": ['FEDTARCTH', 'FEDTARCTHLR'],
"Median": ['FEDTARMD', 'FEDTARMDLR'],
"Range Midpoint": ['FEDTARRM', 'FEDTARRMLR'],
"Central tendency Midpoint": ['FEDTARCTM', 'FEDTARCTMLR'],
"Range Low": ['FEDTARRL', 'FEDTARRLLR'],
"Central tendency Low": ['FEDTARCTL', 'FEDTARCTLLR'],
"Range High": ["FEDTARRH", "FEDTARRHLR"],
"Central tendency High": ["FEDTARCTH", "FEDTARCTHLR"],
"Median": ["FEDTARMD", "FEDTARMDLR"],
"Range Midpoint": ["FEDTARRM", "FEDTARRMLR"],
"Central tendency Midpoint": ["FEDTARCTM", "FEDTARCTMLR"],
"Range Low": ["FEDTARRL", "FEDTARRLLR"],
"Central tendency Low": ["FEDTARCTL", "FEDTARCTLLR"],
}
NAME_TO_ID_ECB = {
"deposit": "ECBDFR",
"lending": "ECBMLFR",
"refinancing": "ECBMRRFR"
}
NAME_TO_ID_ECB = {"deposit": "ECBDFR", "lending": "ECBMLFR", "refinancing": "ECBMRRFR"}
USARATES_TO_FRED_ID = {
"4_week": {"tbill": "DTB4WK"},
"1_month": { "cmn": "DGS1MO"},
"1_month": {"cmn": "DGS1MO"},
"3_month": {"tbill": "TB3MS", "cmn": "DGS3MO"},
"6_month": {"tbill": "DTB6", "cmn": "DGS6MO"},
"1_year": {"tbill": "DTB1YR", "cmn": "DGS1"},
@@ -200,10 +196,6 @@ def plot_estr(
ax.plot(
df.index,
df.values,
marker="o",
linestyle="dashed",
linewidth=2,
markersize=4,
color=next(colors, "#FCED00"),
)
ax.set_title(ID_TO_NAME_ESTR[series_id])
@@ -211,7 +203,7 @@ def plot_estr(
if external_axes is None:
theme.visualize_output()
if export:
if "[Percent]" in ID_TO_NAME_ESTR[series_id]:
# Check whether it is a percentage, relevant for exporting
@@ -224,7 +216,7 @@ def plot_estr(
os.path.dirname(os.path.abspath(__file__)),
series_id,
df_transformed,
sheet_name
sheet_name,
)
@@ -271,17 +263,13 @@ def plot_sofr(
ax.plot(
df.index,
df.values,
marker="o",
linestyle="dashed",
linewidth=2,
markersize=4,
color=next(colors, "#FCED00"),
)
ax.set_title(ID_TO_NAME_SOFR[series_id])
theme.style_primary_axis(ax)
if external_axes is None:
theme.visualize_output()
theme.visualize_output()
if export:
if "[Percent]" in ID_TO_NAME_SOFR[series_id]:
@@ -289,13 +277,13 @@ def plot_sofr(
df_transformed = pd.DataFrame(df, columns=[series_id]) / 100
else:
df_transformed = pd.DataFrame(df, columns=[series_id])
export_data(
export,
os.path.dirname(os.path.abspath(__file__)),
series_id,
df_transformed,
sheet_name
sheet_name,
)
@@ -340,10 +328,6 @@ def plot_sonia(
ax.plot(
df.index,
df.values,
marker="o",
linestyle="dashed",
linewidth=2,
markersize=4,
color=next(colors, "#FCED00"),
)
ax.set_title(ID_TO_NAME_SONIA[series_id])
@@ -351,20 +335,20 @@ def plot_sonia(
if external_axes is None:
theme.visualize_output()
if export:
if "[Percent]" in ID_TO_NAME_SONIA[series_id]:
# Check whether it is a percentage, relevant for exporting
df_transformed = pd.DataFrame(df, columns=[series_id]) / 100
else:
df_transformed = pd.DataFrame(df, columns=[series_id])
export_data(
export,
os.path.dirname(os.path.abspath(__file__)),
series_id,
df_transformed,
sheet_name
sheet_name,
)
@@ -409,10 +393,6 @@ def plot_ameribor(
ax.plot(
df.index,
df.values,
marker="o",
linestyle="dashed",
linewidth=2,
markersize=4,
color=next(colors, "#FCED00"),
)
ax.set_title(ID_TO_NAME_AMERIBOR[series_id])
@@ -420,7 +400,7 @@ def plot_ameribor(
if external_axes is None:
theme.visualize_output()
if export:
if "[Percent]" in ID_TO_NAME_AMERIBOR[series_id]:
# Check whether it is a percentage, relevant for exporting
@@ -433,9 +413,10 @@ def plot_ameribor(
os.path.dirname(os.path.abspath(__file__)),
series_id,
df_transformed,
sheet_name
sheet_name,
)
@log_start_end(log=logger)
@check_api_key(["API_FRED_KEY"])
def plot_fftr(
@@ -494,7 +475,7 @@ def plot_fftr(
os.path.dirname(os.path.abspath(__file__)),
"fftr",
pd.DataFrame(df, columns=["FFTR"]) / 100,
sheet_name
sheet_name,
)
@@ -548,29 +529,31 @@ def plot_fed(
elif series_id == "EFFRVOL":
series_id = "OBFRVOL"
else:
console.print("The Overnight Banking Federal Rate only supports Daily data.")
console.print(
"The Overnight Banking Federal Rate only supports Daily data."
)
series_id = "OBFR"
if quantiles or target and not overnight:
data_series = [series_id if series_id != 'EFFRVOL' else "EFFR"]
series_id = series_id if series_id != 'EFFRVOL' else "EFFR"
data_series = [series_id if series_id != "EFFRVOL" else "EFFR"]
series_id = series_id if series_id != "EFFRVOL" else "EFFR"
if quantiles:
data_series.extend(['EFFR1', 'EFFR25', 'EFFR75', 'EFFR99'])
data_series.extend(["EFFR1", "EFFR25", "EFFR75", "EFFR99"])
if target:
data_series.extend(['DFEDTARU', 'DFEDTARL'])
data_series.extend(["DFEDTARU", "DFEDTARL"])
for series in data_series:
data = pd.DataFrame(fred_model.get_series_data(
series_id=series, start_date=start_date, end_date=end_date), columns=[series]
data = pd.DataFrame(
fred_model.get_series_data(
series_id=series, start_date=start_date, end_date=end_date
),
columns=[series],
)
if series == series_id:
df = data
else:
df = pd.concat([df, data], axis=1)
df = data if series == series_id else pd.concat([df, data], axis=1)
df = df.dropna()
# This plot has 1 axis
if not external_axes:
_, ax = plt.subplots(figsize=plot_autoscale(), dpi=PLOT_DPI)
@@ -585,7 +568,7 @@ def plot_fed(
df[column],
linewidth=3 if column == series_id else 1,
color=next(colors),
)
)
ax.set_title(ID_TO_NAME_FED[series_id])
ax.legend(data_series)
ax.set_ylabel("Yield (%)")
@@ -614,12 +597,16 @@ def plot_fed(
color=next(colors),
)
ax.set_title(ID_TO_NAME_FED[series_id])
ax.set_ylabel("Yield (%)" if series_id not in ["EFFRVOL", "OBFRVOL"] else "Billions in USD" )
ax.set_ylabel(
"Yield (%)"
if series_id not in ["EFFRVOL", "OBFRVOL"]
else "Billions in USD"
)
theme.style_primary_axis(ax)
if external_axes is None:
theme.visualize_output()
if export or raw:
if not quantiles and not target:
if series_id != "EFFRVOL":
@@ -629,8 +616,8 @@ def plot_fed(
df_transformed = pd.DataFrame(df, columns=[series_id])
else:
df_transformed = df / 100
if raw:
if raw:
print_rich_table(
df_transformed.iloc[-10:],
headers=list(df_transformed.columns),
@@ -638,14 +625,14 @@ def plot_fed(
title=ID_TO_NAME_FED[series_id],
floatfmt=".3f",
)
if export:
export_data(
export,
os.path.dirname(os.path.abspath(__file__)),
series_id,
df_transformed,
sheet_name
sheet_name,
)
@@ -704,7 +691,7 @@ def plot_iorb(
os.path.dirname(os.path.abspath(__file__)),
"iorb",
pd.DataFrame(df, columns=["IORB"]) / 100,
sheet_name
sheet_name,
)
@@ -733,7 +720,7 @@ def plot_projection(
External axes (1 axis is expected in the list)
"""
data_series = {}
for projection, values in NAME_TO_ID_PROJECTION.items():
data_series[projection] = fred_model.get_series_data(series_id=values[long_run])
@@ -744,7 +731,7 @@ def plot_projection(
(ax,) = external_axes
else:
return
data_series_df = pd.DataFrame.from_dict(data_series).dropna()
data_series_df.index = pd.to_datetime(data_series_df.index).date
@@ -756,24 +743,24 @@ def plot_projection(
linewidth=1 if legend != "Median" else 2,
label=legend,
)
ax.set_title(
f"FOMC {'Long Run ' if long_run else ''}Summary of Economic Projections\nfor the Federal Funds Rate"
)
ax.legend(prop={"size": 8}, loc='lower left')
ax.legend(prop={"size": 8}, loc="lower left")
ax.set_ylabel("Yield (%)")
theme.style_primary_axis(ax)
if external_axes is None:
theme.visualize_output()
if raw:
print_rich_table(
data_series_df,
headers=list(data_series_df.columns),
show_index=True,
title= f"FOMC {'Long Run ' if long_run else ''}Summary of "
title=f"FOMC {'Long Run ' if long_run else ''}Summary of "
"Economic Projections for the Federal Funds Rate",
)
@@ -782,9 +769,10 @@ def plot_projection(
os.path.dirname(os.path.abspath(__file__)),
"projection",
data_series_df,
sheet_name
sheet_name,
)
@log_start_end(log=logger)
@check_api_key(["API_FRED_KEY"])
def plot_dwpcr(
@@ -830,10 +818,6 @@ def plot_dwpcr(
ax.plot(
df.index,
df.values,
marker="o",
linestyle="dashed",
linewidth=2,
markersize=4,
color=next(colors, "#FCED00"),
)
ax.set_title(
@@ -851,7 +835,7 @@ def plot_dwpcr(
os.path.dirname(os.path.abspath(__file__)),
series_id,
pd.DataFrame(df, columns=[series_id]) / 100,
sheet_name
sheet_name,
)
@@ -885,23 +869,28 @@ def plot_ecb(
external_axes: Optional[List[plt.Axes]]
External axes (1 axis is expected in the list)
"""
if interest_type:
df = pd.DataFrame(
fred_model.get_series_data(
series_id=NAME_TO_ID_ECB[interest_type], start_date=start_date, end_date=end_date),
columns=[interest_type])
series_id=NAME_TO_ID_ECB[interest_type],
start_date=start_date,
end_date=end_date,
),
columns=[interest_type],
)
else:
series_dictionary = {}
for interest_name, value in NAME_TO_ID_ECB.items():
series_dictionary[interest_name.title()] = fred_model.get_series_data(
series_id=value, start_date=start_date, end_date=end_date)
series_id=value, start_date=start_date, end_date=end_date
)
df = pd.DataFrame.from_dict(series_dictionary)
df.index = pd.to_datetime(df.index).date
df.index = pd.to_datetime(df.index).date
# This plot has 1 axis
if not external_axes:
_, ax = plt.subplots(figsize=plot_autoscale(), dpi=PLOT_DPI)
@@ -911,7 +900,7 @@ def plot_ecb(
return
colors = cycle(theme.get_colors())
for series in df:
ax.plot(
df.index,
@@ -920,16 +909,20 @@ def plot_ecb(
label=series.title(),
)
title = f"ECB {interest_type.title()} Rate for Euro Area" if interest_type else "ECB Interest Rates for Euro Area"
title = (
f"ECB {interest_type.title()} Rate for Euro Area"
if interest_type
else "ECB Interest Rates for Euro Area"
)
ax.set_title(title)
ax.legend(loc='lower left')
ax.legend(loc="lower left")
ax.set_ylabel("Yield (%)")
theme.style_primary_axis(ax)
if external_axes is None:
theme.visualize_output()
if raw:
if raw:
print_rich_table(
df.iloc[-10:],
headers=list(df.columns),
@@ -943,7 +936,7 @@ def plot_ecb(
os.path.dirname(os.path.abspath(__file__)),
"ecbdfr",
pd.DataFrame(df, columns=["ECBDFR"]) / 100,
sheet_name
sheet_name,
)
@@ -1000,11 +993,7 @@ def plot_ecbmlfr(
theme.visualize_output()
export_data(
export,
os.path.dirname(os.path.abspath(__file__)),
"ecbmlfr",
df,
sheet_name
export, os.path.dirname(os.path.abspath(__file__)), "ecbmlfr", df, sheet_name
)
@@ -1069,7 +1058,7 @@ def plot_ecbmrofr(
os.path.dirname(os.path.abspath(__file__)),
"ecbmrofr",
pd.DataFrame(df, columns=["ECBMROFR"]) / 100,
sheet_name
sheet_name,
)
@@ -1118,10 +1107,6 @@ def plot_tmc(
ax.plot(
df.index,
df.values,
marker="o",
linestyle="dashed",
linewidth=2,
markersize=4,
color=next(colors, "#FCED00"),
)
ax.set_title(
@@ -1139,7 +1124,7 @@ def plot_tmc(
os.path.dirname(os.path.abspath(__file__)),
series_id,
pd.DataFrame(df, columns=[series_id]) / 100,
sheet_name
sheet_name,
)
@@ -1188,10 +1173,6 @@ def plot_ffrmc(
ax.plot(
df.index,
df.values,
marker="o",
linestyle="dashed",
linewidth=2,
markersize=4,
color=next(colors, "#FCED00"),
)
ax.set_title(
@@ -1208,7 +1189,7 @@ def plot_ffrmc(
os.path.dirname(os.path.abspath(__file__)),
series_id,
pd.DataFrame(df, columns=[series_id]) / 100,
sheet_name
sheet_name,
)
@@ -1267,7 +1248,9 @@ def display_yield_curve(
ax.set_ylabel("Rate (%)")
theme.style_primary_axis(ax)
if external_axes is None:
ax.set_title(f"US {'Real' if inflation_adjusted else 'Nominal'} Yield Curve for {date_of_yield} ")
ax.set_title(
f"US {'Real' if inflation_adjusted else 'Nominal'} Yield Curve for {date_of_yield} "
)
theme.visualize_output()
if raw:
@@ -1283,10 +1266,11 @@ def display_yield_curve(
export,
os.path.dirname(os.path.abspath(__file__)),
"ycrv",
rates.set_index('Maturity') / 100,
sheet_name
rates.set_index("Maturity") / 100,
sheet_name,
)
@log_start_end(log=logger)
@check_api_key(["API_FRED_KEY"])
def plot_usrates(
@@ -1305,7 +1289,7 @@ def plot_usrates(
maturity of one year or less. Treasury bills are usually sold in denominations of $1,000. However, some can reach
a maximum denomination of $5 million in non-competitive bids. These securities are widely regarded as low-risk
and secure investments.
Yields on Treasury nominal securities at “constant maturity” are interpolated by the U.S. Treasury from the daily
yield curve for non-inflation-indexed Treasury securities. This curve, which relates the yield on a security to
its time to maturity, is based on the closing market bid yields on actively traded Treasury securities in the
@@ -1353,7 +1337,7 @@ def plot_usrates(
df.values,
color=next(colors, "#FCED00"),
)
if parameter == "tbill":
title = f"{maturity.replace('_', ' ').title()} Treasury Bill Secondary Market Rate, Discount Basis"
elif parameter == "cmn":
@@ -1367,7 +1351,7 @@ def plot_usrates(
if external_axes is None:
theme.visualize_output()
if raw:
print_rich_table(
pd.DataFrame(df, columns=[parameter]).iloc[-10:],
@@ -1375,14 +1359,13 @@ def plot_usrates(
show_index=True,
floatfmt=".3f",
)
export_data(
export,
os.path.dirname(os.path.abspath(__file__)),
series_id,
pd.DataFrame(df, columns=[parameter]) / 100,
sheet_name
sheet_name,
)
@@ -1427,10 +1410,6 @@ def plot_tbffr(
ax.plot(
df.index,
df.values,
marker="o",
linestyle="dashed",
linewidth=2,
markersize=4,
color=next(colors, "#FCED00"),
)
ax.set_title(
@@ -1447,5 +1426,5 @@ def plot_tbffr(
os.path.dirname(os.path.abspath(__file__)),
series_id,
pd.DataFrame(df, columns=["TBFFR"]) / 100,
sheet_name
sheet_name,
)

View File

@@ -1,66 +1,66 @@
""" OECD model """
__docformat__ = "numpy"
from datetime import datetime
import logging
from datetime import datetime
import pandas as pd
from openbb_terminal.decorators import log_start_end
logger = logging.getLogger(__name__)
COUNTRY_TO_CODE = {
'australia':'AUS',
'austria':'AUT',
'belgium':'BEL',
'bulgaria':'BGR',
'brazil':'BRA',
'canada':'CAN',
'switzerland':'CHE',
'chile':'CHL',
'china':'CHN',
'colombia':'COL',
'costa_rica':'CRI',
'czech_republic':'CZE',
'germany':'DEU',
'denmark':'DNK',
'spain':'ESP',
'estonia':'EST',
'finland':'FIN',
'france':'FRA',
'united_kingdom':'GBR',
'greece':'GRC',
'croatia':'HRV',
'hungary':'HUN',
'indonesia':'IDN',
'india':'IND',
'ireland':'IRL',
'iceland':'ISL',
'israel':'ISR',
'italy':'ITA',
'japan':'JPN',
'korea':'KOR',
'lithuania':'LTU',
'luxembourg':'LUX',
'latvia':'LVA',
'mexico':'MEX',
'netherlands':'NLD',
'norway':'NOR',
'new_zealand':'NZL',
'poland':'POL',
'portugal':'PRT',
'romania':'ROU',
'russia':'RUS',
'slovak_republic':'SVK',
'slovenia':'SVN',
'sweden':'SWE',
'united_states':'USA',
'south_africa':'ZAF'
"australia": "AUS",
"austria": "AUT",
"belgium": "BEL",
"bulgaria": "BGR",
"brazil": "BRA",
"canada": "CAN",
"switzerland": "CHE",
"chile": "CHL",
"china": "CHN",
"colombia": "COL",
"costa_rica": "CRI",
"czech_republic": "CZE",
"germany": "DEU",
"denmark": "DNK",
"spain": "ESP",
"estonia": "EST",
"finland": "FIN",
"france": "FRA",
"united_kingdom": "GBR",
"greece": "GRC",
"croatia": "HRV",
"hungary": "HUN",
"indonesia": "IDN",
"india": "IND",
"ireland": "IRL",
"iceland": "ISL",
"israel": "ISR",
"italy": "ITA",
"japan": "JPN",
"korea": "KOR",
"lithuania": "LTU",
"luxembourg": "LUX",
"latvia": "LVA",
"mexico": "MEX",
"netherlands": "NLD",
"norway": "NOR",
"new_zealand": "NZL",
"poland": "POL",
"portugal": "PRT",
"romania": "ROU",
"russia": "RUS",
"slovak_republic": "SVK",
"slovenia": "SVN",
"sweden": "SWE",
"united_states": "USA",
"south_africa": "ZAF",
}
@log_start_end(log=logger)
def get_interest_rate_data(
data: str = "short",
@@ -178,8 +178,8 @@ def get_interest_rate_data(
temp = pd.DataFrame(df[df["LOCATION"] == COUNTRY_TO_CODE[country]]["Value"])
temp.columns = [f"{country} ({data_name})"]
result = pd.concat([result, temp], axis=1)
result.index = pd.to_datetime(result.index).date
result.index = pd.to_datetime(result.index).date
result.sort_index(inplace=True)
return result

View File

@@ -1,26 +1,27 @@
""" OECD view """
__docformat__ = "numpy"
from typing import Optional, List
import logging
import os
import pandas as pd
from typing import List, Optional
import pandas as pd
from matplotlib import pyplot as plt
from openbb_terminal.config_terminal import theme
from openbb_terminal.config_plot import PLOT_DPI
from openbb_terminal.config_terminal import theme
from openbb_terminal.decorators import log_start_end
from openbb_terminal.fixedincome import oecd_model
from openbb_terminal.helper_funcs import (
export_data,
plot_autoscale,
is_valid_axes_count,
plot_autoscale,
print_rich_table,
)
from openbb_terminal.fixedincome import oecd_model
logger = logging.getLogger(__name__)
@log_start_end(log=logger)
def plot_treasuries(
short_term: list = None,
@@ -40,7 +41,7 @@ def plot_treasuries(
interest rates are generally averages of daily rates, measured as a percentage. Short-term interest rates are
based on three-month money market rates where available. Typical standardised names are "money market rate" and
"treasury bill rate".
Long-term interest rates refer to government bonds maturing in ten years. Rates are mainly determined by the
price charged by the lender, the risk from the borrower and the fall in the capital value. Long-term interest
rates are generally averages of daily rates, measured as a percentage. These interest rates are implied by the
@@ -49,7 +50,7 @@ def plot_treasuries(
interest rates are one of the determinants of business investment. Low long-term interest rates encourage
investment in new equipment and high interest rates discourage it. Investment is, in turn, a major source of
economic growth.
Parameters
----------
countries: list
@@ -66,7 +67,7 @@ def plot_treasuries(
External axes (1 axis is expected in the list)
"""
df_short, df_long = pd.DataFrame(), pd.DataFrame()
if short_term:
df_short = oecd_model.get_interest_rate_data(
f"short{'_forecast' if forecast else ''}",
@@ -81,7 +82,7 @@ def plot_treasuries(
start_date if start_date is not None else "",
end_date if end_date is not None else "",
)
df = pd.concat([df_short, df_long], axis=1)
# This plot has 1 axis
@@ -92,11 +93,7 @@ def plot_treasuries(
else:
return
ax.plot(
df.index,
df.values,
linewidth=1
)
ax.plot(df.index, df.values, linewidth=1)
if short_term and long_term:
title = f"Short and Long Term Interest Rates {' with forecasts' if forecast else ''}"
elif short_term:
@@ -104,18 +101,18 @@ def plot_treasuries(
elif long_term:
title = f"Long Term Interest Rates {' with forecasts' if forecast else ''}"
ax.set_title(title)
style_countries = [country.replace("_", " ").title() for country in df.columns]
ax.legend(style_countries)
ax.set_ylabel("Yield (%)")
theme.style_primary_axis(ax)
if external_axes is None:
theme.visualize_output()
if raw:
if raw:
print_rich_table(
df.iloc[-10:],
headers=list(df.columns),
@@ -127,7 +124,7 @@ def plot_treasuries(
export_data(
export,
os.path.dirname(os.path.abspath(__file__)),
f"treasury",
"treasury",
df / 100,
sheet_name
)
sheet_name,
)

View File

@@ -1,23 +1,23 @@
""" Yahoo Finance view """
__docformat__ = "numpy"
from typing import Optional, List
from itertools import cycle
import logging
import os
import pandas as pd
from itertools import cycle
from typing import List, Optional
import pandas as pd
from matplotlib import pyplot as plt
from openbb_terminal.config_terminal import theme
from openbb_terminal.config_plot import PLOT_DPI
from openbb_terminal.decorators import log_start_end, check_api_key
from openbb_terminal.config_terminal import theme
from openbb_terminal.decorators import check_api_key, log_start_end
from openbb_terminal.fixedincome import yfinance_model
from openbb_terminal.helper_funcs import (
export_data,
plot_autoscale,
is_valid_axes_count,
plot_autoscale,
)
from openbb_terminal.fixedincome import yfinance_model
logger = logging.getLogger(__name__)
@@ -52,7 +52,9 @@ def plot_ty(
external_axes: Optional[List[plt.Axes]]
External axes (1 axis is expected in the list)
"""
df = yfinance_model.get_series(TY_TO_ID[maturity], start_date=start_date, end_date=end_date)
df = yfinance_model.get_series(
TY_TO_ID[maturity], start_date=start_date, end_date=end_date
)
# This plot has 1 axis
if not external_axes: