open-index/open-npm huggingface dataset:
npm package: @stock-icons/stock-icons
Description: React stock icon resolver and component
Latest version: 1.0.1

# @stock-icons/stock-icons

React+TypeScript library for resolving stock logo URLs and rendering icons.

## Features

- `getStockLogo({ symbol, domain?, image? })` with priority path: image → domain → dataset → CDN fallback
- `getStockLogoCached(...)` with map-based caching
- `<StockIcon symbol='AAPL' />` component with lazy loading and onError fallback
- ESM+CJS build via tsup

## Install

```bash
npm install @stock-icons/stock-icons
npm install react
```

## Usage

```tsx
import { StockIcon } from "@stock-icons/stock-icons";

export function Example() {
  return (
    <div className="flex gap-4 items-center">
      <StockIcon symbol="AAPL" size={48} />
      <h1>APPLE</h1>
    </div>
  );
}
```

If you want `getStockLogo` as well, you can also do:

```tsx
import { StockIcon, getStockLogo } from "@stock-icons/stock-icons";

export function ExampleWithImage() {
  return (
    <div className="flex gap-4 items-center">
      <StockIcon symbol="AAPL" size={48} />
      <img
        src={getStockLogo("NFLX")}
        alt="Netflix logo"
        width={48}
        height={48}
      />
    </div>
  );
}
```


## Dataset generation scripts

```bash
npm run fetch:stocks
npm run enrich:top100
```

Output files:

- `stocks.json`
- `stocks-with-domain.json`

## Build

```bash
npm install
npm run build
```