# Asset Pricing Methodology

### **Overview**

Aleno computes real-time asset prices by aggregating data from both decentralized exchanges (DEXs) and centralized exchanges (CEXs). The methodology prioritizes data reliability, liquidity depth, and market representativeness.

***

### **DEX Pricing**

**1. Pool Discovery**

* For each asset, Aleno fetches all available DEX pools across supported chains and retain only the ones with enough liquidity and volume.
* Only pools that pass initialization checks (via on-chain RPC queries) and protocol whitelisting are retained.

**2. Quote Asset Selection**

* Among all valid pools for the asset, Aleno identifies the pool(s) where the counterparty token (quote asset) has:
  * The **highest USD liquidity** (`usdTvl`)
  * Reliable price reference (e.g., stablecoins like USDC/USDT or blue chips like WETH/ETH).
* Pools with illiquid or volatile quotes are excluded.

**3. Liquidity-Weighted Pricing**

* For all selected pools (possibly across multiple chains), Aleno computes the price of the asset relative to the quote using pool reserves and volumes.
* Each price is **weighted by a combination of:**
  * Pool USD liquidity (`usdTvl`)
  * 24h USD trading volume (`h24UsdVolume`)
* The final DEX price is a **liquidity + volume weighted average** across all qualifying pools.

**4. Quote Normalization via Kraken**

* To convert token pairs into a consistent USD-denominated price (e.g., USDC → USD), Aleno uses Kraken's spot market rates as an external reference for major fiat-anchored assets. This normalization step ensures consistency across DEX pools regardless of base-quote pair configuration. For example, a pool quoted in USDC is translated into a USD price using Kraken’s real-time USDC/USD rate. This guarantees accurate aggregation and comparison of prices across heterogeneous liquidity sources.

***

### **CEX Pricing**

* Prices from multiple CEXs are fetched using aggregated market data.
* Each market is filtered by:
  * Matching `symbol/quote` pair (USD or USD-pegged)
  * Verified exchange support
* Aggregation is done via a **volume-weighted average** across available markets.

***

#### **Final Aggregated Price**

The final `aggregated.price` (as seen in `/v1/assets/ticker`) is computed as:

```ts
aggregatedPrice = weightedMean([dexPrice, cexPrice], weights = [dexVolume, cexVolume])
```

* `dexPrice` is the DEX-side weighted average across pools.
* `cexPrice` is the CEX-side volume-weighted average across markets.
* Weights are proportional to `h24UsdVolume`.
