File tree Expand file tree Collapse file tree 2 files changed +3
-27
lines changed Expand file tree Collapse file tree 2 files changed +3
-27
lines changed Original file line number Diff line number Diff line change 6
6
import pandas as pd
7
7
from fluid .utils .http_client import AioHttpClient
8
8
9
- URL = (
10
- "https://www.federalreserve.gov/datadownload/Output.aspx?"
11
- "rel=H15&series=bf17364827e38702b42a58cf8eaa3f78&lastobs=&"
12
- )
13
-
14
- maturities = [
9
+ MATURITIES = (
15
10
"month_1" ,
16
11
"month_3" ,
17
12
"month_6" ,
23
18
"year_10" ,
24
19
"year_20" ,
25
20
"year_30" ,
26
- ]
21
+ )
27
22
28
23
29
24
@dataclass
@@ -52,7 +47,7 @@ async def yield_curves(self, **params: Any) -> pd.DataFrame:
52
47
params .update (series = "bf17364827e38702b42a58cf8eaa3f78" , rel = "H15" )
53
48
data = await self ._get_text (params )
54
49
df = pd .read_csv (data , header = 5 , index_col = None , parse_dates = True )
55
- df .columns = [ "date" ] + maturities # type: ignore
50
+ df .columns = list (( "date" ,) + MATURITIES ) # type: ignore
56
51
df = df .set_index ("date" ).replace ("ND" , np .nan )
57
52
return df .dropna (axis = 0 , how = "all" ).reset_index ()
58
53
Original file line number Diff line number Diff line change 6
6
7
7
from quantflow .utils .dates import as_date
8
8
9
- URL = (
10
- "https://www.federalreserve.gov/datadownload/Output.aspx?"
11
- "rel=H15&series=bf17364827e38702b42a58cf8eaa3f78&lastobs=&"
12
- )
13
-
14
- maturities = [
15
- "month_1" ,
16
- "month_3" ,
17
- "month_6" ,
18
- "year_1" ,
19
- "year_2" ,
20
- "year_3" ,
21
- "year_5" ,
22
- "year_7" ,
23
- "year_10" ,
24
- "year_20" ,
25
- "year_30" ,
26
- ]
27
-
28
9
29
10
@dataclass
30
11
class FiscalData (AioHttpClient ):
You can’t perform that action at this time.
0 commit comments