> ## Documentation Index
> Fetch the complete documentation index at: https://finance.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Analytics

> Access market analytics, top movers, sector data, and analyst ratings with the JavaScript SDK

## Overview

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

## Methods

### getTopGainers()

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

### getTopLosers()

```javascript theme={null}
const losers = await client.analytics.getTopLosers();
```

### getMostActive()

```javascript theme={null}
const active = await client.analytics.getMostActive();
```

### getSectorTickers(sector)

```javascript theme={null}
const techStocks = await client.analytics.getSectorTickers('Technology');
```

### getSectorPerformance()

```javascript theme={null}
const sectors = await client.analytics.getSectorPerformance();
```

### getAnalystRatings(symbol)

```javascript theme={null}
const ratings = await client.analytics.getAnalystRatings('AAPL');
```

### getMarketBreadth()

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

## TypeScript Types

```typescript theme={null}
interface Stock {
  symbol: string;
  price: number;
  changePercent: number;
  volume: number;
}

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

## Examples

```javascript theme={null}
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}%)`);
});
```
