Get liquidity pool value
Line 1: | Line 1: | ||
− | '''$liquidity | + | '''$liquidity value''' is a function that calculates the value of your investment in a liquidity pool on a decentralized exchange, represented in USD. |
+ | |||
+ | This function aggregates and expresses the value of your liquidity provider (LP) tokens in USD, providing insight into the current value of your investment. | ||
== Parameters == | == Parameters == | ||
− | '''Exchange:''' The decentralized exchange | + | '''Exchange:''' The decentralized exchange where the liquidity pool resides. The available exchanges will be dependent on the "SwapNames" list set in your environment. |
− | '''Token A ID | + | '''Token A ID''' and '''Token B ID:''' The pair of tokens involved in the liquidity pool for which you want to calculate the value of your investment. The available tokens will be dependent on the "CoinNames" list set in your environment. |
− | + | ||
− | '''Token B ID:''' The | + | |
== Return Value == | == Return Value == | ||
− | + | Returns a string that represents the value of your investment in the given liquidity pool in USD. | |
− | + | ||
== Example == | == Example == | ||
− | |||
<pre> | <pre> | ||
− | + | log("Value of investment in DAI-USDC SushiSwap pool: {$liquidity value("SushiSwap", "DAI", "USDC")}") | |
− | + | ||
− | log(" | + | |
</pre> | </pre> | ||
− | + | The output will display the value of your investment in the specified liquidity pool, represented in USD. | |
− | + | ||
− | The | + | |
+ | Example Output: | ||
<blockquote> | <blockquote> | ||
− | + | <p>Value of investment in DAI-USDC SushiSwap pool: 500 USD</p> | |
</blockquote> | </blockquote> | ||
+ | |||
+ | Remember, the actual value will vary depending on the current prices of the tokens and the amount of liquidity you have provided to the pool. |
Revision as of 19:08, 4 July 2023
$liquidity value is a function that calculates the value of your investment in a liquidity pool on a decentralized exchange, represented in USD.
This function aggregates and expresses the value of your liquidity provider (LP) tokens in USD, providing insight into the current value of your investment.
Parameters
Exchange: The decentralized exchange where the liquidity pool resides. The available exchanges will be dependent on the "SwapNames" list set in your environment.
Token A ID and Token B ID: The pair of tokens involved in the liquidity pool for which you want to calculate the value of your investment. The available tokens will be dependent on the "CoinNames" list set in your environment.
Return Value
Returns a string that represents the value of your investment in the given liquidity pool in USD.
Example
log("Value of investment in DAI-USDC SushiSwap pool: {$liquidity value("SushiSwap", "DAI", "USDC")}")
The output will display the value of your investment in the specified liquidity pool, represented in USD.
Example Output:
Value of investment in DAI-USDC SushiSwap pool: 500 USD
Remember, the actual value will vary depending on the current prices of the tokens and the amount of liquidity you have provided to the pool.