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

# Investment universe flow

> How to combine universe configuration with investment products for complete asset data

## Overview

Building a complete investment experience requires combining data from two sources:

1. **Universe Configuration API** — Static metadata (names, descriptions, asset classes, collections)
2. **Investment Products API** — Live trading data (prices, trading status, returns)

This guide explains how to fetch, combine, and use this data effectively.

<Info>
  The Universe Configuration runs on a separate edge network for performance, while Investment Products provides
  real-time data from the main B2B API.
</Info>

## Step-by-step integration

<Steps>
  <Step title="Fetch universe configuration">
    Retrieve the static universe configuration. Include the `Accept-Language` header to specify the language for localized content (defaults to `en` if not provided).

    <CodeGroup>
      ```javascript Node.js theme={null}
      const CONFIG_BASE = 'https://{TENANT}-staging.wealthyhood.workers.dev';

      async function getUniverseConfig(language = 'en') {
      const res = await fetch(`${CONFIG_BASE}/b2b/app-config`, {
      headers: { 
        'Accept': 'application/json',
        'Accept-Language': language
      }
      });
      if (!res.ok) throw new Error(`Config fetch failed: ${res.status}`);
      return res.json();
      }

      ```

      ```bash cURL theme={null}
      curl -X GET 'https://{TENANT}-staging.wealthyhood.workers.dev/b2b/app-config' \
        -H 'Accept: application/json' \
        -H 'Accept-Language: en'
      ```
    </CodeGroup>
  </Step>

  <Step title="Fetch investment products">
    Retrieve live trading data from the Investment Products API.

    <CodeGroup>
      ```javascript Node.js theme={null}
      const API_BASE = 'https://api.wealthyhood.com';

      async function getInvestmentProducts({ token }) {
      const res = await fetch(`${API_BASE}/investment-products`, {
      headers: {
      'Authorization': `Bearer ${token}`,
      'Accept': 'application/json'
      }
      });
      if (!res.ok) throw new Error(`Products fetch failed: ${res.status}`);
      return res.json();
      }

      ```

      ```bash cURL theme={null}
      curl -X GET 'https://api.wealthyhood.com/investment-products' \
        -H 'Accept: application/json' \
        -H 'Authorization: Bearer YOUR_ACCESS_TOKEN'
      ```
    </CodeGroup>

    <Note>
      Unlike universe configuration, investment products should be fetched more frequently
      to ensure price data is current.
    </Note>
  </Step>

  <Step title="Combine the data">
    Merge universe metadata with live trading data using the asset key (e.g. `equities_apple`) as the join field.
  </Step>

  <Step title="Use discovery data for curation">
    The universe config includes curated collections for discovery screens.

    ```javascript theme={null}
    function getDiscoveryData(universeConfig, combinedAssets) {
      const { discovery } = universeConfig;
      const assetMap = new Map(combinedAssets.map((a) => [a.key, a]));

      return {
        // Top movers with live price data
        topMovers: {
          best: discovery.topMovers.best
            .map((m) => ({
              ...assetMap.get(m.asset),
              returnPercentage: m.returnPercentage
            }))
          worst: discovery.topMovers.worst
            .map((m) => ({
              ...assetMap.get(m.asset),
              returnPercentage: m.returnPercentage
            }))
        },

        // Popular assets
        popular: discovery.popularAssetsSection.map((key) => assetMap.get(key)),

        // Themed collections
        collections: Object.entries(discovery.collections)
          .map(([key, collection]) => ({
            key,
            label: collection.label,
            emoji: collection.emoji,
            assets: collection.assets.map((assetKey) => assetMap.get(assetKey))
          }))
          .filter((c) => c.assets.length > 0)
      };
    }
    ```
  </Step>
</Steps>

***

## Common use cases

### Filter by asset class

```javascript theme={null}
function getAssetsByClass(combinedAssets, assetClass) {
  return combinedAssets.filter((a) => a.assetClass === assetClass && a.listed);
}

// Get all listed equities (stocks)
const stocks = getAssetsByClass(assets, "equities");

// Get all listed ETFs
const etfs = combinedAssets.filter((a) => a.category === "etf" && a.listed);

// Get all commodities
const commodities = getAssetsByClass(assets, "commodities");
```

### Filter by sector

```javascript theme={null}
function getAssetsBySector(combinedAssets, sector) {
  return combinedAssets.filter((a) => a.sector === sector && a.listed);
}

// Get all technology stocks
const techStocks = getAssetsBySector(assets, "technology");

// Get all healthcare stocks
const healthcareStocks = getAssetsBySector(assets, "healthcare");
```

### Search assets

```javascript theme={null}
function searchAssets(combinedAssets, query) {
  const q = query.toLowerCase().trim();
  if (!q) return [];

  return combinedAssets.filter(
    (a) =>
      a.listed &&
      (a.name.toLowerCase().includes(q) ||
        a.isin.toLowerCase().includes(q) ||
        a.formalTicker?.toLowerCase().includes(q) ||
        a.searchTerms?.some((term) => term.toLowerCase().includes(q)))
  );
}

// Search for "tech" returns Apple, Microsoft, NVIDIA, etc.
const results = searchAssets(combinedAssets, "tech");
```

### Get assets by provider

```javascript theme={null}
function getAssetsByProvider(combinedAssets, providerKey) {
  return combinedAssets.filter((a) => a.provider === providerKey && a.listed);
}

// Get all Vanguard ETFs
const vanguardETFs = getAssetsByProvider(assets, "vanguard");

// Get all iShares ETFs
const isharesETFs = getAssetsByProvider(assets, "ishares");
```

### Get ready-made portfolios

```javascript theme={null}
function getReadyMadePortfolios(universeConfig, combinedAssets) {
  const { discovery } = universeConfig;
  const assetMap = new Map(combinedAssets.map((a) => [a.key, a]));

  return discovery.readyMadePortfolios.map((key) => assetMap.get(key));
}

// Get LifeStrategy portfolios
const portfolios = getReadyMadePortfolios(config, assets);
```

***

## See also

* [API Reference → Universe Configuration](/api-reference/universe-config/get-universe-config)
* [API Reference → Investment Products](/api-reference/investment-products/investment-products)
* [API Reference → Investment Product Fundamentals](/api-reference/investment-products/investment-product-by-isin)
* [Screens → Discover Assets](/screens/discover-assets)
* [Flows → Order Execution](/flows/order-execution)
