Using the Fred Data API sample code
Overview
We created this study to demonstrate how users can tap the vast, freely available online data resources published by any number of organizations, and use them directly in CQG IC charts, studies, conditions, and trading systems. Never has it been so easy to integrate quantitative fundamental data into your trading decisions.
In this example, we show you how to connect to the United States Federal Reserve database (FRED) curated by the St. Louis branch. We especially appreciate their thorough and elegant job of organizing their data sets, providing a programmatic interface to access them, and making the process of acquiring their API key easy. Traders with no programming experience should be able to follow this guide to access FRED data. Traders with some programming knowledge should be able to modify the source code to access other data sources as well.
We will be following this guide with other examples demonstrating how to:
- access over 1.2 million time series datasets from the U.S. Department of Energy's U.S. Energy Information Administration;
- read any time series data file (.csv, .xls, .txt, etc.) stored locally into CQG IC; and
- access SQL server database data from within CQG IC.
Most of the data accessible via the Fred Data example is of monthly—or longer—frequency, so in most cases, it won't make sense to view the data in charts using intervals smaller than weekly bars.
Requirements
- Current subscription to CQG IC
- Visual Studio or other .Net IDE installed on your computer (the free "Express" version should work fine)
- Download the Fred Data API sample code below
- Register for an API key from the Federal Reserve
- A User Operators folder where you will move the file you build with Visual Studio, usually located here: C:\Users\Public\Documents\CQGNet\Private\User Operators