Function get_market_status

Source
pub fn get_market_status(
    ctx: Context<'_, '_, '_, '_, ReadMarket<'_>>,
    prices: Prices<u128>,
    maximize_pnl: bool,
    maximize_pool_value: bool,
) -> Result<MarketStatus>
Expand description

Calculate the current market status.

This instruction calculates and returns the current status of a market, including metrics like pool value, PnL, and other key indicators. The calculation can be configured to maximize or minimize certain values based on the provided flags.

§Accounts

See the documentation for the accounts.

§Arguments

  • prices: The current unit prices of tokens in the market, used for calculations.
  • maximize_pnl: If true, uses the maximum possible PnL values in calculations. If false, uses minimum PnL values.
  • maximize_pool_value: If true, uses the maximum possible pool value in calculations. If false, uses minimum pool value.

§Errors

  • The market account must be properly initialized.
  • The provided prices must be non-zero.
  • Any calculation errors.