API ReferencePricing and oraclesFunction
calculatePairPrice()
function calculatePairPrice(ctx, inputToken, inputUsdPrice, outputToken, outputUsdPrice): Price;Computes the price of a pair of tokens prices in relation to each other. This is the same logic that exists in the contract methods to calculate prices.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | SDKContext | The SDK context. |
inputToken | Token | The input Token. |
inputUsdPrice | PythPrice | The input token OraclePrice. |
outputToken | Token | The output Token. |
outputUsdPrice | PythPrice | The output token OraclePrice. |
Returns
The computed price.