Skip to main content
The Economic Data API provides access to macroeconomic indicators, historical economic datasets, and economic event calendars. Search through thousands of economic series or track upcoming economic releases that can impact markets.

Methods

Search for economic data series by keyword or topic.
const results = await client.econ.search('GDP');
query
string
required
Search query string (e.g., “GDP”, “inflation”, “unemployment”)
Returns: Array of economic series matching the search query
const client = new Axion(apiKey);

// Search for GDP-related series
const gdpSeries = await client.econ.search('GDP');
console.log(gdpSeries.data);

// Search for inflation data
const inflationSeries = await client.econ.search('inflation');
console.log(inflationSeries.data);

dataset()

Retrieve historical data for a specific economic series.
const data = await client.econ.dataset('FRED/GDP');
seriesId
string
required
The unique identifier for the economic data series (e.g., “FRED/GDP”, “BLS/UNEMPLOYMENT”)
Returns: Historical time series data for the specified series
const client = new Axion(apiKey);

// Get GDP dataset
const gdpData = await client.econ.dataset('FRED/GDP');
console.log('GDP Data:', gdpData.data);

// Get unemployment rate
const unemploymentData = await client.econ.dataset('BLS/UNRATE');
console.log('Latest unemployment:', unemploymentData.data[0]);

calendar()

Get upcoming economic events and releases with optional filtering.
const events = await client.econ.calendar({
  from: '2024-01-01',
  to: '2024-01-31',
  country: 'US',
  minImportance: 2
});
params
object
Optional parameters to filter economic calendar events
params.from
string
Start date in YYYY-MM-DD format
params.to
string
End date in YYYY-MM-DD format
params.country
string
Two-letter country code (e.g., “US”, “GB”, “JP”)
params.minImportance
number
Minimum importance level (1-3, where 3 is highest impact)
params.currency
string
Currency code to filter events (e.g., “USD”, “EUR”)
params.category
string
Event category (e.g., “GDP”, “Employment”, “Inflation”)
Returns: Array of economic calendar events
const client = new Axion(apiKey);

// Get high-impact US events for next month
const events = await client.econ.calendar({
  from: '2024-01-01',
  to: '2024-01-31',
  country: 'US',
  minImportance: 2
});

console.log(`Found ${events.data.length} important events`);
events.data.forEach(event => {
  console.log(`${event.date}: ${event.event}`);
});

Common Use Cases

Track Inflation Indicators

const client = new Axion(apiKey);

// Search for CPI data
const cpiSearch = await client.econ.search('Consumer Price Index');
const seriesId = cpiSearch.data[0].id;

// Get historical CPI data
const cpiData = await client.econ.dataset(seriesId);
console.log('Latest CPI:', cpiData.data[0]);

Monitor Federal Reserve Decisions

const client = new Axion(apiKey);

// Get Fed-related events
const fedEvents = await client.econ.calendar({
  from: '2024-01-01',
  to: '2024-12-31',
  category: 'Central Bank',
  country: 'US',
  minImportance: 3
});

fedEvents.data.forEach(event => {
  console.log(`${event.date}: ${event.event}`);
});

Compare International GDP Growth

const client = new Axion(apiKey);

async function compareGDP() {
  const countries = ['US', 'CN', 'JP', 'DE'];
  
  for (const country of countries) {
    const search = await client.econ.search(`${country} GDP`);
    if (search.data.length > 0) {
      const gdp = await client.econ.dataset(search.data[0].id);
      console.log(`${country} GDP:`, gdp.data[0]);
    }
  }
}

compareGDP();

Error Handling

try {
  const events = await client.econ.calendar({
    from: '2024-01-01',
    to: '2024-01-31',
    country: 'US'
  });
  
  if (events.data.length === 0) {
    console.log('No events found for the specified period');
  } else {
    console.log(`Found ${events.data.length} events`);
  }
} catch (error) {
  if (error.message.includes('401')) {
    console.error('Authentication failed. Check your API key.');
  } else if (error.message.includes('404')) {
    console.error('Endpoint not found. Check the series ID.');
  } else {
    console.error('Request failed:', error.message);
  }
}

Response Format

All economic data endpoints return a consistent response structure:
interface ApiResponse {
  data: any;  // Response data
  meta?: {    // Optional metadata
    total?: number;
    page?: number;
    limit?: number;
  };
}

Rate Limits

The Economic Data API is subject to the same rate limits as other API endpoints. Check the FAQ for information about rate limits and usage quotas.