Skip to content

Instantly share code, notes, and snippets.

@beyoung
Created November 28, 2023 01:43
Show Gist options
  • Save beyoung/f534da144d6a6f11609fc173b94297d3 to your computer and use it in GitHub Desktop.
Save beyoung/f534da144d6a6f11609fc173b94297d3 to your computer and use it in GitHub Desktop.
{
"hostName": "fred.stlouisfed.org",
"series": {},
"chart": {
"labels": {
"title": "Bank Prime Loan Rate",
"subtitle": "Source: Board of Governors of the Federal Reserve System (US)",
"left_axis": "Percent",
"right_axis": "",
"bottom_axis": "",
"bubble-size_axis": "",
"footer": "2023 fred.stlouisfed.org"
},
"cosd": "2018-11-21",
"coed": "2023-11-21",
"min_date": "1955-08-04",
"max_date": "2023-11-21",
"frequency": "Daily",
"width": 1318,
"height": 450,
"drp": 0,
"stacking": null,
"txtcolor": "#444444",
"mode": "fred",
"ts": 12,
"tts": 12,
"fo": "open sans",
"x_scale": "time",
"trc": 0,
"nt": 0,
"thu": 0,
"bgcolor": "#E1E9F0",
"graph_bgcolor": "#ffffff",
"showLegend": "yes",
"showAxisTitles": "yes",
"zoomType": "x",
"showTooltip": "yes",
"chartType": "line",
"recession_bars": "on",
"showNavigator": "true",
"available_chart_types": [
"line",
"area",
"column",
"scatter",
"pie",
"bubble"
],
"log_scales": {
"left": false,
"right": false,
"bottom": false,
"bubble-size": false
},
"available_stacking": [
"normal",
"percent"
],
"legacy_url": "bgcolor=%23E1E9F0&chart_type=line&drp=0&fo=open%20sans&graph_bgcolor=%23ffffff&height=450&mode=fred&recession_bars=on&txtcolor=%23444444&ts=12&tts=12&width=1318&nt=0&thu=0&trc=0&show_legend=yes&show_axis_titles=yes&show_tooltip=yes&id=DPRIME&scale=left&cosd=2018-11-21&coed=2023-11-21&line_color=%234572a7&link_values=false&line_style=solid&mark_type=none&mw=3&lw=2&ost=-99999&oet=99999&mma=0&fml=a&fq=Daily&fam=avg&fgst=lin&fgsnd=2020-02-01&line_index=0&transformation=lin&vintage_date=2023-11-27&revision_date=2023-11-27&nd=1955-08-04",
"piedate": null,
"lastModified": "Wed, 22 Nov 2023 21:20:07 GMT",
"obsFetch": false,
"initialPayload": true
},
"xAxis": {},
"yAxis": {},
"seriesObjects": [
{
"type": "time-series",
"line_index": 1,
"legendIndex": 1,
"title": "Bank Prime Loan Rate",
"hide_marks": true,
"available_formula_transformations": {
"lin": {
"full": "",
"short": ""
},
"chg": {
"full": "Change",
"short": "Chg."
},
"ch1": {
"full": "Change from Year Ago",
"short": "Chg. from Yr. Ago"
},
"pch": {
"full": "Percent Change",
"short": "% Chg."
},
"pc1": {
"full": "Percent Change from Year Ago",
"short": "% Chg. from Yr. Ago"
},
"pca": {
"full": "Compounded Annual Rate of Change",
"short": "Comp. Annual Rate of Chg."
},
"cch": {
"full": "Continuously Compounded Rate of Change",
"short": "Cont. Comp. Rate of Chg."
},
"cca": {
"full": "Continuously Compounded Annual Rate of Change",
"short": "Cont. Comp. Annual Rate of Chg."
},
"log": {
"full": "Natural Log",
"short": "Log"
},
"nbd": {
"full": "Index (Scale value to 100 for chosen period)",
"short": "Index"
}
},
"line_color": "#4572a7",
"line_style": "solid",
"lw": 2,
"mark_type": "none",
"mw": 3,
"scale": "left",
"decimal_places": "2",
"frequency": "Daily",
"fq": "Daily",
"available_colors": {
"1": "#4572A7",
"2": "#AA4643",
"3": "#89A54E",
"4": "#80699B",
"5": "#3D96AE",
"6": "#DB843D",
"7": "#92A8CD",
"8": "#A47D7C",
"9": "#B5CA92",
"10": "#91e8e1",
"11": "#8d4653",
"12": "#8085e8"
},
"available_fams": {
"Average": "avg",
"Sum": "sum",
"End of Period": "eop"
},
"fam": "avg",
"available_fqs": [
"Daily",
"Weekly, Ending Friday",
"Weekly, Ending Thursday",
"Weekly, Ending Wednesday",
"Weekly, Ending Tuesday",
"Weekly, Ending Monday",
"Weekly, Ending Sunday",
"Weekly, Ending Saturday",
"Biweekly, Ending Wednesday",
"Biweekly, Ending Monday",
"Monthly",
"Quarterly",
"Semiannual",
"Annual"
],
"fml": "a",
"fgst": "lin",
"fgsnd": "2020-02-01",
"all_fred_series_have_same_frequency": true,
"has_fred_series_with_nbd_transformation": false,
"cosd": "2018-11-21",
"coed": "2023-11-21",
"min_date": "1955-08-04",
"max_date": "2023-11-21",
"year_range": 68,
"ost": -99999,
"oet": 99999,
"available_mmas": [
0,
1,
2
],
"mma": 0,
"graph_series_ids": [
"DPRIME"
],
"series_objects": {
"a": {
"series_id": "DPRIME",
"title": "Bank Prime Loan Rate",
"season": "Not Seasonally Adjusted",
"season_short": "NSA",
"frequency": "Daily",
"frequency_short": "D",
"units": "Percent",
"units_short": "%",
"keywords": " ",
"all_obs_transformations": {
"lin": "Percent",
"cap": "Percent per Capita",
"chg": "Change, Percent",
"ch1": "Change from Year Ago, Percent",
"pch": "Percent Change",
"pc1": "Percent Change from Year Ago",
"pca": "Compounded Annual Rate of Change",
"cch": "Continuously Compounded Rate of Change",
"cca": "Continuously Compounded Annual Rate of Change"
},
"abbreviated_all_obs_transformations": {
"lin": "Levels",
"cap": "Levels per Capita",
"chg": "Chg.",
"ch1": "Chg. from Yr. Ago",
"pch": "% Chg.",
"pc1": "% Chg. from Yr. Ago",
"pca": "Comp. Annual Rate of Chg.",
"cch": "Cont. Comp. Rate of Chg.",
"cca": "Cont. Comp. Annual Rate of Chg.",
"log": "Log"
},
"obs_transformations": {
"lin": "Percent",
"chg": "Change, Percent",
"ch1": "Change from Year Ago, Percent",
"pch": "Percent Change",
"pc1": "Percent Change from Year Ago",
"pca": "Compounded Annual Rate of Change",
"cch": "Continuously Compounded Rate of Change",
"cca": "Continuously Compounded Annual Rate of Change"
},
"valid_start_date": "2023-11-27",
"valid_end_date": "2023-11-27",
"vintage_date": "2023-11-27",
"available_revision_dates": [
"2023-11-27"
],
"revision_date": "2023-11-27",
"relative_vintage": null,
"nd": "1955-08-04",
"step_line": "f",
"transformation": "lin",
"available_units": {
"lin": "Percent",
"chg": "Change, Percent",
"ch1": "Change from Year Ago, Percent",
"pch": "Percent Change",
"pc1": "Percent Change from Year Ago",
"pca": "Compounded Annual Rate of Change",
"cch": "Continuously Compounded Rate of Change",
"cca": "Continuously Compounded Annual Rate of Change"
},
"min_valid_start_date": "2023-11-22",
"max_valid_start_date": null,
"min_obs_start_date": "1955-08-04",
"max_obs_start_date": "2023-11-21",
"last_updated": "2023-11-22 15:20:07-06"
}
},
"lsv": null,
"lev": null,
"observation_grouping_approximation": "close",
"chart_key": "090836b9b1fe81daddbdd434afb8016d"
}
],
"fredLogo": {
"width": 105,
"height": 22,
"image": "https://fred.stlouisfed.org/images/fredgraph-logo-2x.png"
},
"container": {
"width": 1318,
"height": 450
},
"defaultFontSize": 12,
"defaultMaxTicks": 10,
"showNavigator": true,
"showCredits": true,
"dataParams": {},
"dataUrl": "https://fred-sa.stlouisfed.org/graph/graph-data.php",
"graphBreakpointWidth": 400,
"observations": {},
"axisTitleHeight": 300,
"titleWidth": 1153,
"alignTicks": true,
"borderRadius": 0,
"recessionBars": "on",
"spacingBottom": 15,
"spacingTop": 50,
"spacingRight": 20,
"zoomType": "x",
"style": {
"fontFamily": "Open Sans",
"color": "color: rgb(68, 68, 68)"
},
"chartTypes": {
"line": "LINE",
"area": "AREA",
"column": "BAR",
"scatter": "PLOT",
"pie": "SEGMENT"
},
"chartTypeIcons": {
"line": "fa-chart-line",
"area": "fa-chart-area",
"column": "fa-chart-bar",
"pie": "fa-chart-pie",
"scatter": ""
}
}
{
"hostName": "fred.stlouisfed.org",
"series": {},
"chart": {
"labels": {
"title": "Secured Overnight Financing Rate",
"subtitle": "Source: Federal Reserve Bank of New York",
"left_axis": "Percent",
"right_axis": "",
"bottom_axis": "",
"bubble-size_axis": "",
"footer": "2023 fred.stlouisfed.org"
},
"cosd": "2018-11-22",
"coed": "2023-11-22",
"min_date": "2018-04-03",
"max_date": "2023-11-22",
"frequency": "Daily",
"width": 1318,
"height": 450,
"drp": 0,
"stacking": null,
"txtcolor": "#444444",
"mode": "fred",
"ts": 12,
"tts": 12,
"fo": "open sans",
"x_scale": "time",
"trc": 0,
"nt": 0,
"thu": 0,
"bgcolor": "#E1E9F0",
"graph_bgcolor": "#ffffff",
"showLegend": "yes",
"showAxisTitles": "yes",
"zoomType": "x",
"showTooltip": "yes",
"chartType": "line",
"recession_bars": "on",
"showNavigator": "true",
"available_chart_types": [
"line",
"area",
"column",
"scatter",
"pie",
"bubble"
],
"log_scales": {
"left": false,
"right": false,
"bottom": false,
"bubble-size": false
},
"available_stacking": [
"normal",
"percent"
],
"legacy_url": "bgcolor=%23E1E9F0&chart_type=line&drp=0&fo=open%20sans&graph_bgcolor=%23ffffff&height=450&mode=fred&recession_bars=on&txtcolor=%23444444&ts=12&tts=12&width=1318&nt=0&thu=0&trc=0&show_legend=yes&show_axis_titles=yes&show_tooltip=yes&id=SOFR&scale=left&cosd=2018-11-22&coed=2023-11-22&line_color=%234572a7&link_values=false&line_style=solid&mark_type=none&mw=3&lw=2&ost=-99999&oet=99999&mma=0&fml=a&fq=Daily&fam=avg&fgst=lin&fgsnd=2020-02-01&line_index=0&transformation=lin&vintage_date=2023-11-27&revision_date=2023-11-27&nd=2018-04-03",
"piedate": null,
"lastModified": "Fri, 24 Nov 2023 13:01:01 GMT",
"obsFetch": false,
"initialPayload": true
},
"xAxis": {},
"yAxis": {},
"seriesObjects": [
{
"type": "time-series",
"line_index": 1,
"legendIndex": 1,
"title": "Secured Overnight Financing Rate",
"hide_marks": true,
"available_formula_transformations": {
"lin": {
"full": "",
"short": ""
},
"chg": {
"full": "Change",
"short": "Chg."
},
"ch1": {
"full": "Change from Year Ago",
"short": "Chg. from Yr. Ago"
},
"pch": {
"full": "Percent Change",
"short": "% Chg."
},
"pc1": {
"full": "Percent Change from Year Ago",
"short": "% Chg. from Yr. Ago"
},
"pca": {
"full": "Compounded Annual Rate of Change",
"short": "Comp. Annual Rate of Chg."
},
"cch": {
"full": "Continuously Compounded Rate of Change",
"short": "Cont. Comp. Rate of Chg."
},
"cca": {
"full": "Continuously Compounded Annual Rate of Change",
"short": "Cont. Comp. Annual Rate of Chg."
},
"log": {
"full": "Natural Log",
"short": "Log"
},
"nbd": {
"full": "Index (Scale value to 100 for chosen period)",
"short": "Index"
}
},
"line_color": "#4572a7",
"line_style": "solid",
"lw": 2,
"mark_type": "none",
"mw": 3,
"scale": "left",
"decimal_places": "2",
"frequency": "Daily",
"fq": "Daily",
"available_colors": {
"1": "#4572A7",
"2": "#AA4643",
"3": "#89A54E",
"4": "#80699B",
"5": "#3D96AE",
"6": "#DB843D",
"7": "#92A8CD",
"8": "#A47D7C",
"9": "#B5CA92",
"10": "#91e8e1",
"11": "#8d4653",
"12": "#8085e8"
},
"available_fams": {
"Average": "avg",
"Sum": "sum",
"End of Period": "eop"
},
"fam": "avg",
"available_fqs": [
"Daily",
"Weekly, Ending Friday",
"Weekly, Ending Thursday",
"Weekly, Ending Wednesday",
"Weekly, Ending Tuesday",
"Weekly, Ending Monday",
"Weekly, Ending Sunday",
"Weekly, Ending Saturday",
"Biweekly, Ending Wednesday",
"Biweekly, Ending Monday",
"Monthly",
"Quarterly",
"Semiannual",
"Annual"
],
"fml": "a",
"fgst": "lin",
"fgsnd": "2020-02-01",
"all_fred_series_have_same_frequency": true,
"has_fred_series_with_nbd_transformation": false,
"cosd": "2018-11-22",
"coed": "2023-11-22",
"min_date": "2018-04-03",
"max_date": "2023-11-22",
"year_range": 5,
"ost": -99999,
"oet": 99999,
"available_mmas": [
0,
1,
2
],
"mma": 0,
"graph_series_ids": [
"SOFR"
],
"series_objects": {
"a": {
"series_id": "SOFR",
"title": "Secured Overnight Financing Rate",
"season": "Not Seasonally Adjusted",
"season_short": "NSA",
"frequency": "Daily",
"frequency_short": "D",
"units": "Percent",
"units_short": "%",
"keywords": "",
"all_obs_transformations": {
"lin": "Percent",
"cap": "Percent per Capita",
"chg": "Change, Percent",
"ch1": "Change from Year Ago, Percent",
"pch": "Percent Change",
"pc1": "Percent Change from Year Ago",
"pca": "Compounded Annual Rate of Change",
"cch": "Continuously Compounded Rate of Change",
"cca": "Continuously Compounded Annual Rate of Change"
},
"abbreviated_all_obs_transformations": {
"lin": "Levels",
"cap": "Levels per Capita",
"chg": "Chg.",
"ch1": "Chg. from Yr. Ago",
"pch": "% Chg.",
"pc1": "% Chg. from Yr. Ago",
"pca": "Comp. Annual Rate of Chg.",
"cch": "Cont. Comp. Rate of Chg.",
"cca": "Cont. Comp. Annual Rate of Chg.",
"log": "Log"
},
"obs_transformations": {
"lin": "Percent",
"chg": "Change, Percent",
"ch1": "Change from Year Ago, Percent",
"pch": "Percent Change",
"pc1": "Percent Change from Year Ago",
"pca": "Compounded Annual Rate of Change",
"cch": "Continuously Compounded Rate of Change",
"cca": "Continuously Compounded Annual Rate of Change"
},
"valid_start_date": "2023-11-27",
"valid_end_date": "2023-11-27",
"vintage_date": "2023-11-27",
"available_revision_dates": [
"2023-11-27"
],
"revision_date": "2023-11-27",
"relative_vintage": null,
"nd": "2018-04-03",
"step_line": "f",
"transformation": "lin",
"available_units": {
"lin": "Percent",
"chg": "Change, Percent",
"ch1": "Change from Year Ago, Percent",
"pch": "Percent Change",
"pc1": "Percent Change from Year Ago",
"pca": "Compounded Annual Rate of Change",
"cch": "Continuously Compounded Rate of Change",
"cca": "Continuously Compounded Annual Rate of Change"
},
"min_valid_start_date": "2023-11-24",
"max_valid_start_date": null,
"min_obs_start_date": "2018-04-03",
"max_obs_start_date": "2023-11-22",
"last_updated": "2023-11-24 07:01:01-06"
}
},
"lsv": null,
"lev": null,
"observation_grouping_approximation": "close",
"chart_key": "658b367b3a2f43c9f644730b57647e0b"
}
],
"fredLogo": {
"width": 105,
"height": 22,
"image": "https://fred.stlouisfed.org/images/fredgraph-logo-2x.png"
},
"container": {
"width": 1318,
"height": 450
},
"defaultFontSize": 12,
"defaultMaxTicks": 10,
"showNavigator": true,
"showCredits": true,
"dataParams": {},
"dataUrl": "https://fred-sa.stlouisfed.org/graph/graph-data.php",
"graphBreakpointWidth": 400,
"observations": {},
"axisTitleHeight": 300,
"titleWidth": 1153,
"alignTicks": true,
"borderRadius": 0,
"recessionBars": "on",
"spacingBottom": 15,
"spacingTop": 50,
"spacingRight": 20,
"zoomType": "x",
"style": {
"fontFamily": "Open Sans",
"color": "color: rgb(68, 68, 68)"
},
"chartTypes": {
"line": "LINE",
"area": "AREA",
"column": "BAR",
"scatter": "PLOT",
"pie": "SEGMENT"
},
"chartTypeIcons": {
"line": "fa-chart-line",
"area": "fa-chart-area",
"column": "fa-chart-bar",
"pie": "fa-chart-pie",
"scatter": ""
}
}
{
"hostName": "fred.stlouisfed.org",
"series": {},
"chart": {
"labels": {
"title": "30-Day Average SOFR",
"subtitle": "Source: Federal Reserve Bank of New York",
"left_axis": "Percent",
"right_axis": "",
"bottom_axis": "",
"bubble-size_axis": "",
"footer": "2023 fred.stlouisfed.org"
},
"cosd": "2018-11-24",
"coed": "2023-11-24",
"min_date": "2018-05-02",
"max_date": "2023-11-24",
"frequency": "Daily",
"width": 1318,
"height": 450,
"drp": 0,
"stacking": null,
"txtcolor": "#444444",
"mode": "fred",
"ts": 12,
"tts": 12,
"fo": "open sans",
"x_scale": "time",
"trc": 0,
"nt": 0,
"thu": 0,
"bgcolor": "#E1E9F0",
"graph_bgcolor": "#ffffff",
"showLegend": "yes",
"showAxisTitles": "yes",
"zoomType": "x",
"showTooltip": "yes",
"chartType": "line",
"recession_bars": "on",
"showNavigator": "true",
"available_chart_types": [
"line",
"area",
"column",
"scatter",
"pie",
"bubble"
],
"log_scales": {
"left": false,
"right": false,
"bottom": false,
"bubble-size": false
},
"available_stacking": ["normal", "percent"],
"legacy_url": "bgcolor=%23E1E9F0&chart_type=line&drp=0&fo=open%20sans&graph_bgcolor=%23ffffff&height=450&mode=fred&recession_bars=on&txtcolor=%23444444&ts=12&tts=12&width=1318&nt=0&thu=0&trc=0&show_legend=yes&show_axis_titles=yes&show_tooltip=yes&id=SOFR30DAYAVG&scale=left&cosd=2018-11-24&coed=2023-11-24&line_color=%234572a7&link_values=false&line_style=solid&mark_type=none&mw=3&lw=2&ost=-99999&oet=99999&mma=0&fml=a&fq=Daily&fam=avg&fgst=lin&fgsnd=2020-02-01&line_index=0&transformation=lin&vintage_date=2023-11-27&revision_date=2023-11-27&nd=2018-05-02",
"piedate": null,
"lastModified": "Fri, 24 Nov 2023 13:01:03 GMT",
"obsFetch": false,
"initialPayload": true
},
"xAxis": {},
"yAxis": {},
"seriesObjects": [
{
"type": "time-series",
"line_index": 1,
"legendIndex": 1,
"title": "30-Day Average SOFR",
"hide_marks": true,
"available_formula_transformations": {
"lin": {
"full": "",
"short": ""
},
"chg": {
"full": "Change",
"short": "Chg."
},
"ch1": {
"full": "Change from Year Ago",
"short": "Chg. from Yr. Ago"
},
"pch": {
"full": "Percent Change",
"short": "% Chg."
},
"pc1": {
"full": "Percent Change from Year Ago",
"short": "% Chg. from Yr. Ago"
},
"pca": {
"full": "Compounded Annual Rate of Change",
"short": "Comp. Annual Rate of Chg."
},
"cch": {
"full": "Continuously Compounded Rate of Change",
"short": "Cont. Comp. Rate of Chg."
},
"cca": {
"full": "Continuously Compounded Annual Rate of Change",
"short": "Cont. Comp. Annual Rate of Chg."
},
"log": {
"full": "Natural Log",
"short": "Log"
},
"nbd": {
"full": "Index (Scale value to 100 for chosen period)",
"short": "Index"
}
},
"line_color": "#4572a7",
"line_style": "solid",
"lw": 2,
"mark_type": "none",
"mw": 3,
"scale": "left",
"decimal_places": 5,
"frequency": "Daily",
"fq": "Daily",
"available_colors": {
"1": "#4572A7",
"2": "#AA4643",
"3": "#89A54E",
"4": "#80699B",
"5": "#3D96AE",
"6": "#DB843D",
"7": "#92A8CD",
"8": "#A47D7C",
"9": "#B5CA92",
"10": "#91e8e1",
"11": "#8d4653",
"12": "#8085e8"
},
"available_fams": {
"Average": "avg",
"Sum": "sum",
"End of Period": "eop"
},
"fam": "avg",
"available_fqs": [
"Daily",
"Weekly, Ending Friday",
"Weekly, Ending Thursday",
"Weekly, Ending Wednesday",
"Weekly, Ending Tuesday",
"Weekly, Ending Monday",
"Weekly, Ending Sunday",
"Weekly, Ending Saturday",
"Biweekly, Ending Wednesday",
"Biweekly, Ending Monday",
"Monthly",
"Quarterly",
"Semiannual",
"Annual"
],
"fml": "a",
"fgst": "lin",
"fgsnd": "2020-02-01",
"all_fred_series_have_same_frequency": true,
"has_fred_series_with_nbd_transformation": false,
"cosd": "2018-11-24",
"coed": "2023-11-24",
"min_date": "2018-05-02",
"max_date": "2023-11-24",
"year_range": 5,
"ost": -99999,
"oet": 99999,
"available_mmas": [0, 1, 2],
"mma": 0,
"graph_series_ids": ["SOFR30DAYAVG"],
"series_objects": {
"a": {
"series_id": "SOFR30DAYAVG",
"title": "30-Day Average SOFR",
"season": "Not Seasonally Adjusted",
"season_short": "NSA",
"frequency": "Daily",
"frequency_short": "D",
"units": "Percent",
"units_short": "%",
"keywords": "",
"all_obs_transformations": {
"lin": "Percent",
"cap": "Percent per Capita",
"chg": "Change, Percent",
"ch1": "Change from Year Ago, Percent",
"pch": "Percent Change",
"pc1": "Percent Change from Year Ago",
"pca": "Compounded Annual Rate of Change",
"cch": "Continuously Compounded Rate of Change",
"cca": "Continuously Compounded Annual Rate of Change"
},
"abbreviated_all_obs_transformations": {
"lin": "Levels",
"cap": "Levels per Capita",
"chg": "Chg.",
"ch1": "Chg. from Yr. Ago",
"pch": "% Chg.",
"pc1": "% Chg. from Yr. Ago",
"pca": "Comp. Annual Rate of Chg.",
"cch": "Cont. Comp. Rate of Chg.",
"cca": "Cont. Comp. Annual Rate of Chg.",
"log": "Log"
},
"obs_transformations": {
"lin": "Percent",
"chg": "Change, Percent",
"ch1": "Change from Year Ago, Percent",
"pch": "Percent Change",
"pc1": "Percent Change from Year Ago",
"pca": "Compounded Annual Rate of Change",
"cch": "Continuously Compounded Rate of Change",
"cca": "Continuously Compounded Annual Rate of Change"
},
"valid_start_date": "2023-11-27",
"valid_end_date": "2023-11-27",
"vintage_date": "2023-11-27",
"available_revision_dates": ["2023-11-27"],
"revision_date": "2023-11-27",
"relative_vintage": null,
"nd": "2018-05-02",
"step_line": "f",
"transformation": "lin",
"available_units": {
"lin": "Percent",
"chg": "Change, Percent",
"ch1": "Change from Year Ago, Percent",
"pch": "Percent Change",
"pc1": "Percent Change from Year Ago",
"pca": "Compounded Annual Rate of Change",
"cch": "Continuously Compounded Rate of Change",
"cca": "Continuously Compounded Annual Rate of Change"
},
"min_valid_start_date": "2023-11-24",
"max_valid_start_date": null,
"min_obs_start_date": "2018-05-02",
"max_obs_start_date": "2023-11-24",
"last_updated": "2023-11-24 07:01:03-06"
}
},
"lsv": null,
"lev": null,
"observation_grouping_approximation": "close",
"chart_key": "74fa96e079fbd69d3f91fbf1548b7a4b"
}
],
"fredLogo": {
"width": 105,
"height": 22,
"image": "https://fred.stlouisfed.org/images/fredgraph-logo-2x.png"
},
"container": {
"width": 1318,
"height": 450
},
"defaultFontSize": 12,
"defaultMaxTicks": 10,
"showNavigator": true,
"showCredits": true,
"dataParams": {},
"dataUrl": "https://fred-sa.stlouisfed.org/graph/graph-data.php",
"graphBreakpointWidth": 400,
"observations": {},
"axisTitleHeight": 300,
"titleWidth": 1153,
"alignTicks": true,
"borderRadius": 0,
"recessionBars": "on",
"spacingBottom": 15,
"spacingTop": 50,
"spacingRight": 20,
"zoomType": "x",
"style": {
"fontFamily": "Open Sans",
"color": "color: rgb(68, 68, 68)"
},
"chartTypes": {
"line": "LINE",
"area": "AREA",
"column": "BAR",
"scatter": "PLOT",
"pie": "SEGMENT"
},
"chartTypeIcons": {
"line": "fa-chart-line",
"area": "fa-chart-area",
"column": "fa-chart-bar",
"pie": "fa-chart-pie",
"scatter": ""
}
}
import pprint
import json
import requests
import pandas
from datetime import datetime
from playwright.sync_api import sync_playwright
FRED_REQUEST_HEADER = {
"accept": "application/json",
"accept-language": "en,zh-CN;q=0.9,zh;q=0.8,zh-TW;q=0.7",
"content-type": "text/plain;charset=UTF-8",
"sec-ch-ua": '"Google Chrome";v="119", "Chromium";v="119", "Not?A_Brand";v="24"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"macOS"',
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"cookie": "ak_bmsc=74F9473DDCCBE9E187991FD095778CF4~000000000000000000000000000000~YAAQPyZzaBMLeduLAQAAHVsJEBWTBN9zvtuCo/TK8JY+nR23N+HUWTG+FQaP2kdKXGYXe1lVpYDnxIQt6NQBnekiM5TaYXndSQc1ulNtHcOJD/kTqud9gd2G3dKzHb3+1OnRSUIEfNYwebpy12JdwjOxzwweyOu5DMBJFBp7tRB33yLtyYsqCiu+ukUDMyRKBqRGy8VAFthbLF04+RwXM7YgzWZPvc6bsca24XXH4U5aJXHmx6w2Bf5oUBurESTO90u3x/2DMLyC71oz64H6SuQSrhVkJ9bUX05bmfIl/eJHXAK6iPIGcRX24Nu+W5XjSV8aV8F0GqMoAtGuPtXqeb6eITFD6ymoI6jIPoCEwJ/lwloEN4zy5zqNZ9tytcOojuByTc6ezbdN/kMWFw==; _gid=GA1.2.684653607.1701076097; _gat_UA-9926151-1=1; _gat_UA-9926151-28=1; bm_sv=CD76F0829868086B39683040C13440F8~YAAQPyZzaBE5eduLAQAAE7YOEBVPSoX7E891W2KKvRWLtO2kXaFiXhha357I4UkaTWFes0M3BxlD8aQG4xQxWPy3EljCvtzCcUN2U/TniEJRoTGwgnTDzUuUDKs1Mzzl9mg621dSJuYqHZBnmtFvT+yPQ9oEyR9+msoadFQt/Pphn6bhJA08FpWRKCKmOaH+O37AfwsK/VU6YM4QyQPqyJL07oBo4X8P/JI5k51zkXOALRdrs8JTNiKD52w2vjvS4Lsw2A==~1; _ga_M8THG4VKKZ=GS1.1.1701076096.2.1.1701076447.0.0.0; _ga=GA1.2.374959731.1700703612",
"Referer": "https://fred.stlouisfed.org/series/SOFR",
"Referrer-Policy": "strict-origin-when-cross-origin",
}
## http method
# https://developer.mozilla.org/zh-TW/docs/Web/HTTP/Methods
## json
# https://www.json.org/json-en.html
## unixtime
# https://tool.chinaz.com/tools/unixtime.aspx
def AMERIBOR():
url = "https://www.ameribor.net/"
res = requests.get("https://us-central1-ameribor.cloudfunctions.net/api/rates")
results = []
for item in res.json():
if datetime.strptime(item["date"], "%Y%m%d") > datetime.strptime(
"2023-01-01", "%Y-%m-%d"
):
results.append(item)
df = pandas.DataFrame(results)
print(df)
def base_fred_request(req_type="SOFR"):
# TODO 需要传入当天时间到payload中
with open(f"{req_type}.json", "r") as f:
payload = json.loads(f.read())
res = requests.post(
f"https://fred.stlouisfed.org/graph/api/series/?obs=True&sid={req_type}",
headers=FRED_REQUEST_HEADER,
data=json.dumps(payload),
)
return res.json()
def SOFR():
data = base_fred_request(req_type="SOFR")
print(data["observations"][-1])
def PRIME():
data = base_fred_request(req_type="DPRIME")
print(data["observations"][-1])
def D30_SOFR_AVG():
data = base_fred_request(req_type="SOFR30DAYAVG")
print(data["observations"][-1])
def M1_TermSOFR():
url = "https://www.cmegroup.com/market-data/cme-group-benchmark-administration/term-sofr.html#contact"
with sync_playwright() as p:
browser = p.chromium.launch(headless=False)
page = browser.new_page()
page.goto(url)
page.wait_for_selector("iframe#cmeIframe-9wptdylq")
table_page = page.frame_locator("iframe#cmeIframe-9wptdylq").locator(
"div.yui-gd"
)
table_page.inner_html()
df = pandas.read_html(table_page.inner_html())
df[0].to_csv("cmd.csv")
browser.close()
if __name__ == "__main__":
# AMERIBOR()
# SOFR()
# PRIME()
# D30_SOFR_AVG()
M1_TermSOFR()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment