liquidityUnitPriceInAsset() method calculates the price per unit of liquidity in underlying asset terms, considering only the principal value (excluding fees) for a specific tick range.
Usage
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
lowerTickKey | number | Yes | Inclusive tick key for the left boundary (scaled by 10^6) |
upperTickKey | number | Yes | Exclusive tick key for the right boundary (scaled by 10^6) |
ticksOverride | Ticks | No | Optional ticks account data (defaults to the instance state) |
syExchangeRateOverride | number | No | Optional SY exchange rate (defaults to current flavor rate) |
Returns
Returns anumber representing the price per unit of liquidity in underlying asset terms (principal only).
Returns 0 if:
- No ticks exist in the specified range
- Total share supply is 0
lowerTickKey >= upperTickKey(throws error)
Calculation Details
The method:- Filters tick intervals within the specified range
- Aggregates
principalPt,principalSy, andprincipalShareSupplyacross intervals - Calculates PT asset value using time decay:
- Computes total principal value:
- Returns price per unit: