What is “FRED”? Why it is important for algorithmic traders?
In this post, you will
find the answers.
Reading Time: 4 minutes Financial activity: Trading Knowledge level: Beginner
Summary
What is “FRED”?
How to use FRED to
search data
An example of the use of
the FRED API keys
Conclusions
What is “FRED”?
FRED is the Federal
Reserve Economic Data (a big online database) handled by the Research
Department at the Federal Reserve Bank of St. Louis.
As you can read on the
home page of FRED, it is “your trusted source for economic data since 1991” and
it allows you to “Download, graph, and track 823,000 US and international time
series from 114 sources”! And it’s free!
Screenshot from fred.stlouisfed.org
This is the link to FRED: St. Luis FRED.
You can simply access FRED using your Google account (click on “My Account” in the top right
corner) and you will receive an email that warns you that your St. Louis Fed
Economic Research account has been created.
When you are inside,
this is your personal menu:
This menu is important
because you can request your API keys.
How to use FRED to search data
It’s easy to search
data in FRED, there is a big search bar on the home page:
We can also do research by category ("Browse Data By:", under the search bar):
For example, if we
search “Category > Money, Banking and Finance > Exchange rates > Daily
rates” we can find the “U.S. Dollars to Euro Spot Exchange Rate”.
Clicking on it with the mouse, we can see the graph.
If you click on the
blue button “DOWNLOAD” in the top right corner, you can download the data or
the graph itself.
An example of the use of the FRED API keys
With the API keys, you
can import data from FRED into your code.
For example, if you use
Google Colaboratory, you can open a new notebook and import the fredapi library
(once only):
pip install fredapi
After this, you can
comment on the line with “pip install fredapi” and write these few lines of code
(I covered some digits of my personal API key with “*”):
# pip install fredapi
from fredapi import Fred
fred = Fred(api_key='9*98**23d****10**22c***918***a8*')
# Import data from FRED
SP500=fred.get_series('SP500', observation_start='2010-1-1')
# Plot data
import matplotlib.pyplot
as plt
SP500.plot(figsize=(16,9))
At the end, you will import the data and have the graph of S&P500:
Conclusions
To create a St. Louis Fed Economic Research account and to obtain the API keys is a very simple process and anyone can do it.
Algo traders need data to do their job and FRED is one of the most affordable resources, with no cost, so, start to use it!
A sincere wish of good
work to all!
Written by F. GRAMOLA (*).
(*) Member of S.I.A.T.,
the Italian Society of Technical Analysis (member society of I.F.T.A. –
International Federation of Technical Analysts).
Warning
We merely cite our personal opinions for educational purposes only.
All trademarks are the
property of their respective owners.
Investing and trading
are risky. Don't invest or trade money that you cannot afford to lose.
Initial photo by Chris Hardy on Unsplash.
Post a Comment