Main Content

Retrieve Historical Data Using Haver Analytics

This example shows how to connect to Haver Analytics® and retrieve historical data.

Connect to Haver Analytics

Connect to Haver Analytics using a daily file.

c = haver('c:\work\haver\haverd.dat');

Retrieve All Historical Data

Retrieve all historical data for the Haver Analytics variable FFED. The descriptor for this variable is Federal Funds [Effective] Rate (% p.a.).

variable = 'FFED'; % return data for FFED

d = fetch(c,variable);

Display the first three rows of data.

d(1:3,:)
ans =

     715511.00          2.38
     715512.00          2.50
     715515.00          2.50

d contains the numeric representation of the date and the closing value.

Retrieve Historical Data for a Date Range

Retrieve historical data from January 1, 2005, through December 31, 2005, for FFED.

fromdate = '01/01/2005'; % beginning of date range for historical data
todate = '12/31/2005'; % ending of date range for historical data 

d = fetch(c,variable,fromdate,todate);

Close the Haver Analytics Connection

close(c)

Open the Haver Analytics User Interface

Use the havertool function to open the Haver Analytics User Interface. You can observe different Haver Analytics variables in a chart format.

c = haver('c:\work\haver\haverd.dat');

havertool(c)

For details, see the havertool function.

See Also

| | |