見出し画像

【サンプルコード】FRED APIを使って米国経済指標データを取得

経済指標データに関してはAlpha Vantage API では取得できませんので、FREDを使います。

Alpha Vantage APIを使った株価の取得はこちらの記事から。



FRED(Federal Reserve Economic Data)は、セントルイス連邦準備銀行が提供する経済データのオンラインデータベースです。

このプラットフォームは、米国および世界経済に関する広範なデータを無料で提供しており、経済研究者、政策立案者、学生、一般の人々に広く利用されています。

FREDには、国内総生産(GDP)、インフレ率、失業率、金利など、さまざまな経済指標に関する数百千もの時系列データが含まれています。


手順

1、FREDに登録

2、API Key の取得

3、コードを書く

FREDはGoogleアカウントで登録可能です。

公式サイト(外部リンク)


登録後右上My AccountからAPI KEYを選択。

取得ボタンがすぐに現れます。

ただし、使用目的をテキストメッセージで送信してくれといわれます。

無料で誰でももらえるので安心してください。

一応Chat GPTに「研究目的であることを印象良く英語で書いてください」とお願いしました。

以下の英文をコピペでOK。

審査などなしにすぐに発行されます。

"I am interested in obtaining access to the FRED API for personal use, primarily to engage in independent economic data analysis. My objective is to deepen my understanding of economic trends and indicators by exploring and analyzing the extensive range of time-series datasets available through FRED. This endeavor is driven by my keen interest in economics and my desire to develop a more nuanced perspective on how various economic factors interact and influence each other. Utilizing the FRED API will enable me to access a wealth of reliable and up-to-date economic data, which I believe will be invaluable in enhancing my analytical skills and broadening my knowledge base in the field of economics."




過去3年分のCPIデータの推移

ここから先は

1,553字 / 1画像
この記事のみ ¥ 390

この記事が参加している募集

この記事が気に入ったらサポートをしてみませんか?