Skip to main content

LpExchangeRateTask

Fetch the current swap price for a given liquidity pool

Input: None

Returns: The swap price for a given AMM pool.

Example: Fetch the exchange rate from the Orca SOL/USDC pool

{
"lpExchangeRateTask": {
"orcaPoolAddress": "APDFRM3HMr8CAGXwKHiu2f5ePSpaiEJhaURwhsRrUUt9"
}
}

Example: Fetch the exchange rate from the Raydium SOL/USDC pool

{
"lpExchangeRateTask": {
"raydiumPoolAddress": "58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2"
}
}

See the LpExchangeRateTask typescript definition in @switchboard-xyz/common

Fields

NameTypeDescription
 inTokenAddress

string

Used alongside mercurial_pool_address to specify the input token for a swap.

 outTokenAddress

string

Used alongside mercurial_pool_address to specify the output token for a swap.

 mercurialPoolAddress

string

Mercurial finance pool address. A full list can be found here: https://github.com/mercurial-finance/stable-swap-n-pool-js

 saberPoolAddress

string

Saber pool address. A full list can be found here: https://github.com/saber-hq/saber-registry-dist

 orcaPoolTokenMintAddress

string

@deprecated** Use orcaPoolAddress

 raydiumPoolAddress

string

The Raydium liquidity pool ammId. A full list can be found here: https://raydium.io/pools

 orcaPoolAddress

string

Pool address for an Orca LP pool or whirlpool. / A full list of Orca LP pools can be found here: https://www.orca.so/pools

 portReserveAddress

string

The Port reserve pubkey. A full list can be found here: https://api-v1.port.finance/reserves