A Python wrapper to easily retrieve data from the Federal Reserve Bank of New York (FRBoNY) official API in pandas format.
MIT License
This repository contains a Python wrapper to easily retrieve data from the Federal Reserve Bank of New York (FRBoNY) official API in pandas format.
The Markets Data APIs are provided to external users and applications to request data from the Federal Reserve Bank of New York. FRBoNY's API does not require tokens or registration, so feel free to use it immediately.
There are ten databases with their endpoints that the FRBoNY has exposed to the public:
pip install nyfedapi
Returns the latest AMBS operation Announcements or Results for the current day.
from nyfedapi import ambs
df = ambs.latest(operation, status, include)
Parameter | Type | Description |
---|---|---|
operation |
str |
The operation type. Available values: ["all", "purchases", "sales", "roll", "swap"] |
status |
str |
The operation status. Available values: ["announcements", "results"] |
include |
str |
The level of details to include. Available values: ["summary", "details"] |
pd.DataFrame
: A DataFrame containing the latest AMBS operation announcements or results for the current day.Returns the last two weeks AMBS operations Results.
from nyfedapi import ambs
df = ambs.results_last_two_weeks(operation, include)
Parameter | Type | Description |
---|---|---|
operation |
str |
The operation type. Available values: ["all", "purchases", "sales", "roll", "swap"] |
include |
str |
The level of details to include. Available values: ["summary", "details"] |
pd.DataFrame
: A DataFrame containing the last two weeks AMBS operations results.Returns the last N number of AMBS operations Results.
from nyfedapi import ambs
df = ambs.results_last_two_weeks(operation, include, number)
Parameter | Type | Description |
---|---|---|
operation |
str |
The operation type. Available values: ["all", "purchases", "sales", "roll", "swap"] |
include |
str |
The level of details to include. Available values: ["summary", "details"] |
number |
int |
The last N amount of operations to return. |
pd.DataFrame
: A DataFrame containing the last N number of AMBS operations results.Returns AMBS operations Results.
from nyfedapi import ambs
df = ambs.results_search(operation, include, **kwargs)
Parameter | Type | Description |
---|---|---|
operation |
str |
The operation type. Available values: ["all", "purchases", "sales", "roll", "swap"] |
include |
str |
The level of details to include. Available values: ["summary", "details"] |
start_date |
str |
The start date (inclusive) from which to search. Format YYYY-MM-DD. |
end_date |
str |
The end date (inclusive) up until which to search. Format YYYY-MM-DD. |
securities |
str |
Filter by securities (Operation Method). Available values: ["Basket", "Coupon Swap", "Dollar Roll", "Specified Pool", "TBA"] |
cusip |
str |
Only return operations which include the given CUSIP. Partial identifiers are accepted. |
desc |
str |
Only return operations which include the given Security Description. Partial identifiers are accepted. |
pd.DataFrame
: A DataFrame containing the AMBS operations results.Returns the latest Liquidity Swaps operation Results posted on current day.
from nyfedapi import fxs
df = fxs.latest(operation_type)
Parameter | Type | Description |
---|---|---|
operation_type |
str |
The operation type to search for. Available values: ["all", "usdollar", "nonusdollar"] |
pd.DataFrame
: A DataFrame containing the latest Liquidity Swaps operation results posted on current day.Returns the last N number of Liquidity Swaps operations Results.
from nyfedapi import fxs
df = fxs.last_number(operation_type, number)
Parameter | Type | Description |
---|---|---|
operation_type |
str |
The operation type to search for. Available values: ["all", "usdollar", "nonusdollar"] |
number |
int |
The last N amount of trades to return |
pd.DataFrame
: A DataFrame containing the last N number of Liquidity Swaps operations results.Returns Liquidity Swaps operation Results.
from nyfedapi import fxs
df = fxs.search(operation_type, **kwargs)
Parameter | Type | Description |
---|---|---|
operation_type |
str |
The operation type to search for. Available values: ["all", "usdollar", "nonusdollar"] |
start_date |
str |
The start date (inclusive) from which to search, depending on date type. Defaults to current date. Format YYYY-MM-DD. |
end_date |
str |
The end date (inclusive) up until which to search, depending on date type. Format YYYY-MM-DD. |
date_type |
str |
The date type to search for within the start and end. Defaults to trade date. Available values : ["trade", "maturity"] |
counterparties |
str |
A comma-separated list of counterparty names to search for. Partial names are accepted. |
pd.DataFrame
: A DataFrame containing Liquidity Swaps operation Results.Returns Counterparties of Liquidity Swaps operations.
from nyfedapi import fxs
df = fxs.counterparties()
pd.DataFrame
: A DataFrame containing counterparties of Liquidity Swaps operations.Returns the latest Guide Sheet. Work in Progress (WIP).
from nyfedapi import guidesheets
df = guidesheets.latest()
Parameter | Type | Description |
---|---|---|
guidesheet_type |
str |
The guide sheet type. Available values: ["si", "wi", "fs"] |
pd.DataFrame
: A DataFrame containing the latest Guide Sheet.Returns the previous Guide Sheet. Work in Progress (WIP).
from nyfedapi import guidesheets
df = guidesheets.previous()
Parameter | Type | Description |
---|---|---|
guidesheet_type |
str |
The guide sheet type. Available values: ["si", "wi", "fs"] |
pd.DataFrame
: A DataFrame containing the latest Guide Sheet.Returns the latest Survey results for each timeseries.
from nyfedapi import pd
df = pd.latest()
Parameter | Type | Description |
---|---|---|
seriesbreak |
str |
A valid series break value. |
pd.DataFrame
: A DataFrame containing the latest Survey results for each timeseries.Returns all Survey results.
from nyfedapi import pd
df = pd.get_all_timeseries()
pd.DataFrame
: A DataFrame containing all Survey results.Returns Description of timeseries/keyids.
from nyfedapi import pd
df = pd.list_timeseries()
pd.DataFrame
: A DataFrame containing description of timeseries/keyids.Returns all As Of Dates with respective Series Break.
from nyfedapi import pd
df = pd.list_asof()
pd.DataFrame
: A DataFrame containing all as of dates with respective series break.Returns Series Breaks including Label, Start and End Date.
from nyfedapi import pd
df = pd.list_seriesbreaks()
pd.DataFrame
: A DataFrame containing series breaks including label, start and end date.Returns single date Survey results.
from nyfedapi import pd
df = pd.get_asof()
Parameter | Type | Description |
---|---|---|
date |
str |
The time series as of date. Format YYYY-MM-DD. |
pd.DataFrame
: A DataFrame containing single date survey results.Return Survey results for given timeseries across all Series Breaks. To query multiple timeseries, separate each with underscore(_).
from nyfedapi import pd
df = pd.get_timeseries()
Parameter | Type | Description |
---|---|---|
timeseries |
str |
A list of time series ids separated by underscores. |
pd.DataFrame
: A DataFrame containing survey results for given timeseries across all series breaks.Return Survey results for given timeseries across all Series Breaks. To query multiple timeseries, separate each with underscore(_).
from nyfedapi import pd
df = pd.get_seriesbreaks_timeseries()
Parameter | Type | Description |
---|---|---|
seriesbreaks |
str |
A valid series break value. |
timeseries |
str |
A list of valid time series separated with underscores. |
pd.DataFrame
: A DataFrame containing survey results for given timeseries across all series breaks.Returns the latest quarterly Market Share.
from nyfedapi import marketshare
df = marketshare.qtrly_latest()
pd.DataFrame
: A DataFrame containing the latest quarterly market share.Returns the latest year-to-date Market Share.
from nyfedapi import marketshare
df = marketshare.ytd_latest()
pd.DataFrame
: A DataFrame containing the latest year-to-date market share.Returns the latest secured and unsecured rates.
from nyfedapi import rates
df = rates.all_latest()
pd.DataFrame
: A DataFrame containing the latest secured and unsecured rates.Returns the latest secured and unsecured rates.
from nyfedapi import rates
df = rates.all_search()
Parameter | Type | Description |
---|---|---|
start_date |
str |
The start date (inclusive) from which to search. Defaults to the current date. Format YYYY-MM-DD. |
end_date |
str |
The end date (inclusive) up until which to search. Format YYYY-MM-DD. |
type |
str |
The report type to return. Available values : ["rate", "volume"] |
pd.DataFrame
: A DataFrame containing the latest secured and unsecured rates.Returns the latest secured rates.
from nyfedapi import rates
df = rates.secured_all_latest()
pd.DataFrame
: A DataFrame containing the latest secured rates.Returns the last N number of secured rates.
from nyfedapi import rates
df = rates.secured_last_number(rate_type, number)
Parameter | Type | Description |
---|---|---|
rate_type |
str |
The rate type. Available values : ["tgcr", "bgcr", "sofr", "sofrai"] |
number |
int |
The last N amount of rates to return. |
pd.DataFrame
: A DataFrame containing the last N number of secured rates.Returns secured rates and/or volume.
from nyfedapi import rates
df = rates.secured_search(rate_type, **kwargs)
Parameter | Type | Description |
---|---|---|
rate_type |
str |
The rate type. Available values : ["all", "tgcr", "bgcr", "sofr", "sofrai"] |
start_date |
str |
The start date (inclusive) from which to search. Defaults to the current date. Format YYYY-MM-DD |
end_date |
str |
The end date (inclusive) up until which to search. Format YYYY-MM-DD |
type |
str |
The report type to return. Available values : ["rate", "volume"] |
pd.DataFrame
: A DataFrame containing secured rates and/or volume.Returns the latest unsecured rates.
from nyfedapi import rates
df = rates.unsecured_all_latest()
pd.DataFrame
: A DataFrame containing the latest unsecured rates.Returns the last N number of unsecured rates.
from nyfedapi import rates
df = rates.unsecured_last_number(rate_type, number)
Parameter | Type | Description |
---|---|---|
rate_type |
str |
The rate type. Available values : ["effr", "obfr"] |
number |
int |
The last N amount of rates to return. |
pd.DataFrame
: A DataFrame containing the last N number of unsecured rates.Returns unsecured rates and/or volume.
from nyfedapi import rates
df = rates.unsecured_search(rate_type, **kwargs)
Parameter | Type | Description |
---|---|---|
rate_type |
str |
The rate type. Available values : ["all", "efr", "obfr"] |
start_date |
str |
The start date (inclusive) from which to search. Defaults to the current date. Format YYYY-MM-DD. |
end_date |
str |
The end date (inclusive) up until which to search. Format YYYY-MM-DD. |
type |
str |
The report type to return. Available values : ["rate", "volume"] |
pd.DataFrame
: A DataFrame containing unsecured rates and/or volume.Returns the latest Repo and/or Reverse Repo operations Announcements or Results for the current day.
from nyfedapi import rp
df = rp.latest(operation_type, method, status)
Parameter | Type | Description |
---|---|---|
operation_type |
str |
The operation type. Available values : ["all", "repo", "reverserepo"] |
method |
str |
The operation method. Available values : ["all", "fixed", "single", "multiple"] |
status |
str |
The operation status. Available values : ["announcements", "results"] |
pd.DataFrame
: A DataFrame containing the latest repo and/or reverse repo operations announcements or results for the current day.Returns the last two weeks Repo and/or Reverse Repo operations Results.
from nyfedapi import rp
df = rp.results_last_two_weeks(operation_type, method)
Parameter | Type | Description |
---|---|---|
operation_type |
str |
The operation type. Available values : ["all", "repo", "reverserepo"] |
method |
str |
The operation method. Available values : ["all", "fixed", "single", "multiple"] |
pd.DataFrame
: A DataFrame containing the last two weeks repo and/or reverse repo operations results.Returns the last N number of Repo and/or Reverse Repo operations Results.
from nyfedapi import rp
df = rp.results_last_number(operation_type, method, number)
Parameter | Type | Description |
---|---|---|
operation_type |
str |
The operation type. Available values : ["all", "repo", "reverserepo"] |
method |
str |
The operation method. Available values : ["all", "fixed", "single", "multiple"] |
number |
int |
The last N amount of operations to return. |
pd.DataFrame
: A DataFrame containing the last N number of repo and/or reverse repo operations results.Returns Repo and/or Reverse Repo operation Results.
from nyfedapi import rp
df = rp.results_search(**kwargs)
Parameter | Type | Description |
---|---|---|
start_date |
str |
The start date (inclusive) from which to search. Format YYYY-MM-DD. |
end_date |
str |
The end date (inclusive) up until which to search. Format YYYY-MM-DD. |
operation_types |
str |
The operation types (comma-delimited) by which to filter. Available values : ["Repo", "Reverse Repo"] |
method |
str |
The operation method by which to filter. Available values : ["multiple", "single", "fixed"] |
security_type |
str |
The security type (tranche) by which to filter. For specific types, only operations which include that type will be returned. Available values : ["mbs", "agency", "tsy", "srf"] |
term |
str |
The term of the operation. Available values : ["overnight", "term"] |
pd.DataFrame
: A DataFrame containing repo and/or reverse repo operation results.Returns Propositions for Reverse Repo operations.
from nyfedapi import rp
df = rp.reverserepo_propositions_search(**kwargs)
Parameter | Type | Description |
---|---|---|
start_date |
str |
The start date (inclusive) from which to search. Format YYYY-MM-DD. |
end_date |
str |
The end date (inclusive) up until which to search. Format YYYY-MM-DD. |
pd.DataFrame
: A DataFrame containing propositions for reverse repo operations.Returns the latest Securities Lending operation Results for the current day.
from nyfedapi import seclending
df = seclending.results_latest(operation, include)
Parameter | Type | Description |
---|---|---|
operation |
str |
The operation type. Available values : ["all", "seclending", "extensions"]. |
include |
str |
The level of details to include. Available values : ["summary", "details"]. |
pd.DataFrame
: A DataFrame containing the latest securities lending operation results for the current day.Returns the last two weeks Securities Lending operation Results and/or Extensions.
from nyfedapi import seclending
df = seclending.results_last_two_weeks(operation, include)
Parameter | Type | Description |
---|---|---|
operation |
str |
The operation type. Available values : ["all", "seclending", "extensions"]. |
include |
str |
The level of details to include. Available values : ["summary", "details"]. |
pd.DataFrame
: A DataFrame containing the last two weeks securities lending operation results and/or extensions.Returns the last N number of Securities Lending operation Results and/or Extensions.
from nyfedapi import seclending
df = seclending.results_last_number(operation, include, number)
Parameter | Type | Description |
---|---|---|
operation |
str |
The operation type. Available values : ["all", "seclending", "extensions"]. |
include |
str |
The level of details to include. Available values : ["summary", "details"]. |
number |
int |
The last N amount of operations to return. |
pd.DataFrame
: A DataFrame containing the last N number of securities lending operation results and/or extensions.Returns Securities Lending operation Results and/or Extensions.
from nyfedapi import seclending
df = seclending.results_search(operation, include)
Parameter | Type | Description |
---|---|---|
operation |
str |
The operation type. Available values : ["all", "seclending", "extensions"]. |
include |
str |
The level of details to include. Available values : ["summary", "details"]. |
pd.DataFrame
: A DataFrame containing securities lending operation results and/or extensions.Returns the latest SOMA holdings As Of Date.
from nyfedapi import soma
df = soma.asofdates_latest()
pd.DataFrame
: A DataFrame containing the latest SOMA holdings As Of Date.Returns Summary Of SOMA holdings for each As of Date and holding type.
from nyfedapi import soma
ndf = soma.summary()
pd.DataFrame
: A DataFrame containing summary of SOMA holdings for each as of date and holding type.Returns all SOMA holdings As of Date.
from nyfedapi import soma
df = soma.asofdates_list()
pd.DataFrame
: A DataFrame containing all SOMA holdings as of date.Returns the last three months Agency Release and As Of Dates.
from nyfedapi import soma
df = soma.agency_get_release_log()
pd.DataFrame
: A DataFrame containing the last three months Agency release and as of dates.Returns a single date SOMA Agency Holdings.
from nyfedapi import soma
df = soma.agency_get_asof(date)
Parameter | Type | Description |
---|---|---|
date |
str |
The date for which to retrieve the agency release. Format YYYY-MM-DD. |
pd.DataFrame
: A DataFrame containing a single date SOMA Agency holdings.Returns all SOMA Agency Holdings for a single CUSIP.
from nyfedapi import soma
df = soma.agency_get_cusip(cusip)
Parameter | Type | Description |
---|---|---|
cusip |
str |
The CUSIP for which to retrieve information. |
pd.DataFrame
: A DataFrame containing all SOMA Agency Holdings for a single CUSIP.Returns a single date SOMA Agency Holdings for a Agency holding type.
from nyfedapi import soma
df = soma.agency_get_holdingtype_asof(holding_type, date)
Parameter | Type | Description |
---|---|---|
holding_type |
str |
The holding type for which to retrieve. Available values: ["all", "agency debts", "mbs", "cmb"] |
date |
str |
The date for which to retrieve the agency release. Format YYYY-MM-DD. |
pd.DataFrame
: A DataFrame containing a single date SOMA Agency holdings for a Agency holding type.Returns a single date Weighted Average Maturity for Agency Debt.
from nyfedapi import soma
df = soma.agency_wam_asof(date)
Parameter | Type | Description |
---|---|---|
date |
str |
The date for which to retrieve the Weighted Average Maturity number. Format YYYY-MM-DD. |
pd.DataFrame
: A DataFrame containing a single date Weighted Average Maturity for Agency Debt.Returns the last three months Treasury Release and As Of Dates.
from nyfedapi import soma
df = soma.tsy_get_release_log()
pd.DataFrame
: A DataFrame containing the last three months Treasury release and as of dates.Returns a single date SOMA Treasury Holdings.
from nyfedapi import soma
df = soma.tsy_get_asof(date)
Parameter | Type | Description |
---|---|---|
date |
str |
The date for which to retrieve the treasury release. Format YYYY-MM-DD. |
pd.DataFrame
: A DataFrame containing a single date SOMA Treasury holdings.Returns all SOMA Treasury Holdings for a single CUSIP.
from nyfedapi import soma
df = soma.tsy_get_cusip(cusip)
Parameter | Type | Description |
---|---|---|
cusip |
str |
The CUSIP for which to retrieve information. |
pd.DataFrame
: A DataFrame containing all SOMA Treasury Holdings for a single CUSIP.Returns a single date SOMA Treasury Holdings for a Treasury holding type.
from nyfedapi import soma
df = soma.tsy_get_holdingtype_asof(holding_type, date)
Parameter | Type | Description |
---|---|---|
holding_type |
str |
The holding type for which to retrieve. Available values: ["all", "bills", "notesbonds", "frn", "tips"] |
date |
str |
The date for which to retrieve the treasury release. Format YYYY-MM-DD. |
pd.DataFrame
: A DataFrame containing a single date SOMA Treasury Holdings for a Treasury holding type.Returns a single date Weighted Average Maturity for a Treasury holding type.
from nyfedapi import soma
ndf = soma.tsy_wam_holdingtype_asof(holding_type, date)
Parameter | Type | Description |
---|---|---|
holding_type |
str |
The holding type for which to retrieve. Available values: ["all", "bills", "notesbonds", "frn", "tips"] |
date |
str |
The date for which to retrieve the Weighted Average Maturity number. Format YYYY-MM-DD. |
pd.DataFrame
: A DataFrame containing a single date Weighted Average Maturity for a Treasury holding type.Returns all SOMA Treasury Holdings at monthly intervals.
from nyfedapi import soma
df = soma.tsy_get_monthly()
pd.DataFrame
: A DataFrame containing all SOMA Treasury Holdings at monthly intervals.Returns the latest Treasury operation Announcements or Results for the current day.
from nyfedapi import tsy
df = tsy.latest(operation, status, include)
Parameter | Type | Description |
---|---|---|
operation |
str |
The operation type. Available values: ["all", "purchases", "sales"] |
status |
str |
The operation status. Available values: ["announcements", "results", "operations""] |
include |
str |
The level of details to include. Available values: ["summary", "details"] |
pd.DataFrame
: A DataFrame containing the latest Treasury operation announcements or results for the current day.Returns the last two weeks Treasury operations Results.
from nyfedapi import tsy
df = tsy.results_last_two_weeks(operation, include)
Parameter | Type | Description |
---|---|---|
operation |
str |
The operation type. Available values: ["all", "purchases", "sales"] |
include |
str |
The level of details to include. Available values: ["summary", "details"] |
pd.DataFrame
: A DataFrame containing the last two weeks Treasury operations results.Returns the last N number of Treasury operations Results.
from nyfedapi import tsy
df = tsy.results_last_number(operation, include, number)
Parameter | Type | Description |
---|---|---|
operation |
str |
The operation type. Available values: ["all", "purchases", "sales"] |
include |
str |
The level of details to include. Available values: ["summary", "details"] |
number |
int |
The last amount of results to return from current date. |
pd.DataFrame
: A DataFrame containing the last N number of Treasury operations Results.Returns Treasury operation Results.
from nyfedapi import tsy
df = tsy.results_search(operation, include)
Parameter | Type | Description |
---|---|---|
operation |
str |
The operation type. Available values: ["all", "purchases", "sales"] |
include |
str |
The level of details to include. Available values: ["summary", "details"] |
pd.DataFrame
: A DataFrame containing Treasury operation results.seclending.results_search()
: Although startDate and endDate are not required, omitting them results in a 404 error with the response: ["Cannot exceed allowed span of 1 year"].ambs.results_search()
: Although startDate and endDate are not required, omitting them results in a 404 error with the response: ["Cannot exceed allowed span of 2 years"].