This commit is contained in:
james
2023-02-22 13:45:43 -05:00
parent e1e1bd9a47
commit 0a451e5a71
7 changed files with 17 additions and 16 deletions

View File

@@ -72,7 +72,7 @@ def plot_estr(
external_axes: Optional[List[plt.Axes]]
External axes (1 axis is expected in the list)
"""
series_id = ESTR_PARAMETER_TO_ECB_ID.get(series_id)
series_id = ESTR_PARAMETER_TO_ECB_ID.get(series_id, "")
df = ecb_model.get_series_data(
series_id, start_date if start_date else "", end_date if end_date else ""

View File

@@ -69,8 +69,8 @@ TREASURIES: Dict = {
@log_start_end(log=logger)
def get_treasuries(
instruments: list = None,
maturities: list = None,
instruments: Optional[list] = None,
maturities: Optional[list] = None,
frequency: str = "monthly",
start_date: str = "1900-01-01",
end_date: Optional[str] = None,

View File

@@ -5,7 +5,7 @@ __docformat__ = "numpy"
import argparse
import logging
from typing import List
from typing import List, Optional
import pandas as pd
@@ -58,7 +58,7 @@ class FixedIncomeController(BaseController):
PATH = "/fixedincome/"
CHOICES_GENERATION = True
def __init__(self, queue: List[str] = None):
def __init__(self, queue: Optional[List[str]] = None):
"""Constructor"""
super().__init__(queue)

View File

@@ -109,7 +109,7 @@ def get_yield_curve(
date: str = "",
return_date: bool = False,
inflation_adjusted: bool = False,
spot_or_par: str = None,
spot_or_par: Optional[str] = None,
) -> Tuple[pd.DataFrame, str]:
"""Gets yield curve data from FRED.
@@ -185,7 +185,7 @@ def get_yield_curve(
years = YIELD_CURVE_REAL_RATES
elif spot_or_par:
if spot_or_par == "spot":
years = YIELD_CURVE_SPOT_RATES
years = YIELD_CURVE_SPOT_RATES # type: ignore
fred_series = YIELD_CURVE_SERIES_CORPORATE_SPOT
elif spot_or_par == "par":
years = YIELD_CURVE_PAR_RATES
@@ -194,7 +194,7 @@ def get_yield_curve(
console.print("Please select either 'spot' or 'par' rates.")
else:
fred_series = YIELD_CURVE_SERIES_NOMINAL
years = YIELD_CURVE_NOMINAL_RATES
years = YIELD_CURVE_NOMINAL_RATES # type: ignore
for key, s_id in fred_series.items():
df = pd.concat(

View File

@@ -5,7 +5,7 @@ import logging
import os
import pathlib
from itertools import cycle
from typing import List, Optional
from typing import Dict, List, Optional
import pandas as pd
from matplotlib import pyplot as plt
@@ -179,7 +179,7 @@ ICE_BOFA_TO_OPTIONS = {
],
}
MOODY_TO_OPTIONS = {
MOODY_TO_OPTIONS: Dict[str, Dict] = {
"Type": {
"aaa": {
"index": {
@@ -212,7 +212,7 @@ MOODY_TO_OPTIONS = {
},
},
},
"Spread": ["treasury", "fed_funds"],
"Spread": ["treasury", "fed_funds"], # type: ignore
}
CP_TO_OPTIONS = {
@@ -1997,7 +1997,7 @@ def plot_icebofa(
@check_api_key(["API_FRED_KEY"])
def plot_moody(
data_type: str = "aaa",
spread: str = None,
spread: Optional[str] = None,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
raw: bool = False,

View File

@@ -3,6 +3,7 @@ __docformat__ = "numpy"
import logging
from datetime import datetime
from typing import List, Optional
import pandas as pd
@@ -64,7 +65,7 @@ COUNTRY_TO_CODE = {
@log_start_end(log=logger)
def get_interest_rate_data(
data: str = "short",
countries: list = None,
countries: Optional[List[str]] = None,
start_date: str = "",
end_date: str = "",
) -> pd.DataFrame:
@@ -174,7 +175,7 @@ def get_interest_rate_data(
df = df.iloc[:, [0, 5]]
result = pd.DataFrame()
for country in countries:
for country in countries: # type: ignore
temp = pd.DataFrame(df[df["LOCATION"] == COUNTRY_TO_CODE[country]]["Value"])
temp.columns = [f"{country} ({data_name})"]
result = pd.concat([result, temp], axis=1)

View File

@@ -26,8 +26,8 @@ logger = logging.getLogger(__name__)
@log_start_end(log=logger)
def plot_treasuries(
short_term: list = None,
long_term: list = None,
short_term: Optional[list] = None,
long_term: Optional[list] = None,
forecast: bool = False,
start_date: Optional[str] = None,
end_date: Optional[str] = None,