Skip to main content

Overview

The Analytics API provides market intelligence including top gainers/losers, most active stocks, sector analysis, and market breadth data.

Methods

getTopGainers()

const gainers = await client.analytics.getTopGainers();
gainers.forEach(stock => {
  console.log(`${stock.symbol}: +${stock.changePercent}%`);
});

getTopLosers()

const losers = await client.analytics.getTopLosers();

getMostActive()

const active = await client.analytics.getMostActive();

getSectorTickers(sector)

const techStocks = await client.analytics.getSectorTickers('Technology');

getSectorPerformance()

const sectors = await client.analytics.getSectorPerformance();

getAnalystRatings(symbol)

const ratings = await client.analytics.getAnalystRatings('AAPL');

getMarketBreadth()

const breadth = await client.analytics.getMarketBreadth();
console.log(`Advancers: ${breadth.advancers}`);
console.log(`Decliners: ${breadth.decliners}`);

TypeScript Types

interface Stock {
  symbol: string;
  price: number;
  changePercent: number;
  volume: number;
}

interface MarketBreadth {
  advancers: number;
  decliners: number;
  unchanged: number;
}

Examples

const gainers = await client.analytics.getTopGainers();

console.log('Top 5 Gainers:');
gainers.slice(0, 5).forEach(stock => {
  console.log(`${stock.symbol}: $${stock.price} (+${stock.changePercent}%)`);
});