MarketThree.calcGlobalFeeRate() static method calculates the global fee rate and total value locked (TVL) metrics by comparing two market snapshots taken at different times.
Usage
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
marketSnapshotDataCurrent | MarketSnapshotData | Yes | Current market snapshot data |
marketSnapshotDataHistory | MarketSnapshotData | Yes | Historical market snapshot data for comparison |
MarketSnapshotData Type
Returns
Returns an object with:| Property | Type | Description |
|---|---|---|
totalFeeRate | number | The calculated fee rate (total fees / TVL) |
totalFeesInBaseToken | number | Total fees earned in base token terms (PT + SY combined) |
tvlInBaseToken | number | Total value locked in base token terms (PT + SY liquidity) |
Calculation Details
The method performs the following calculations:-
Calculate PT fees in base token:
-
Calculate SY fees in base token:
-
Calculate TVL:
-
Calculate total fee rate: