import { BigNumberish, Provider } from 'ethers'; import { FillableQuote, PoolKey, PoolMinimal } from '../entities'; import { BaseAPI } from './baseAPI'; import { TokenOrAddress } from './tokenAPI'; /** * This class provides an API for interacting with options in the Premia system. * All methods are asynchronous and return promises. * * @class OptionAPI * @extends {BaseAPI} */ export declare class OptionAPI extends BaseAPI { /** * Parses a token input to return a token address string. * * @param {TokenOrAddress} token - The token input which can be either a Token object or a string representing the address. * @returns {string} - The token address as a string. */ _parseTokenAddress(token: TokenOrAddress): string; /** * Filters a list of pool objects according to the provided options. * * @param {PoolMinimal[]} pools - An array of pool objects to filter. * @param {object} options - An object containing filter conditions. * @param {BigNumberish} [options.strike] - The strike price. * @param {BigNumberish} [options.maturity] - The maturity time. * @param {string} [options.priceOracle] - The address of the price oracle (optional). * @param {string[]} [options.quoteTokens] - Array of quote tokens' addresses (optional). * @returns {PoolMinimal[]} - The filtered array of pool objects. */ _filterPools(pools: PoolMinimal[], options?: { strike?: BigNumberish; maturity?: BigNumberish; priceOracle?: string; quoteTokens?: string[]; }): PoolMinimal[]; /** * Generates a list of suggested strike prices based on the spot price. * * @param {number} spotPrice - The spot price. * @returns {number[]} - An array of suggested strike prices. */ getSuggestedStrikes(spotPrice: number): number[]; /** * Calculates the strike interval size for a specific price. * * @param {number} price - The price. * @returns {number} The strike interval size. */ getStrikeInterval(price: number): number; /** * Gets the implied volatility for a given pool, price, and spot price. * The implied volatility is calculated using the Black-Scholes model. * * @param pool {PoolMinimal} The pool object. * @param price {BigNumberish} The price of the option. * @param spotPrice {BigNumberish} The spot price of the underlying asset. * @returns {number} The implied volatility of the option. */ getImpliedVolatility(pool: PoolMinimal, price: BigNumberish, spotPrice: BigNumberish): number; /** * Gets the profit or loss for a given pool, action (buy/sell), and premium. * * @param {string} poolAddress - The address of the pool. * @param {boolean} isBuy - Whether the action is a buy. * @param {BigNumberish} premium - The premium for the transaction. * @param {Provider} provider - The custom provider to use for this call. * @returns {Promise} - A promise that resolves to the calculated profit or loss. */ getProfitLoss(poolAddress: string, isBuy: boolean, premium: BigNumberish, provider?: Provider): Promise; /** * Provides the best quote available from different sources (RFQ, Pool, Vault) based on the provided options. * * @param {Object} options - Quote options object. * @param {string} options.poolAddress - The pool's address. * @param {BigNumberish} options.size - The size of the trade. * @param {boolean} options.isBuy - Whether the quote is a buy or sell. * @param {BigNumberish} [options.minimumSize] - The minimum size of the trade (optional). * @param {string} [options.referrer] - The address of the referrer (optional). * @param {string} [options.taker] - The address of the taker (optional). * @param {number} [options.maxSlippagePercent] - The maximum slippage percent (optional). * @param {boolean} [options.showErrors] - Whether to show errors (optional). * @param {boolean} [options.showPoolErrors] - Whether to show pool errors (optional). * @param {boolean} [options.showOrderbookErrors] - Whether to show orderbook errors (optional). * @param {boolean} [options.showVaultErrors] - Whether to show vault errors (optional). * @returns {Promise} - A promise that resolves to the best quote. */ quote(options: { poolAddress: string; size: BigNumberish; isBuy: boolean; minimumSize?: BigNumberish; referrer?: string; taker?: string; maxSlippagePercent?: number; showErrors?: boolean; showPoolErrors?: boolean; showOrderbookErrors?: boolean; showVaultErrors?: boolean; poolKey?: PoolKey; pool?: PoolMinimal; }): Promise; /** * Provides the best quotes available for each pool that matches the provided options. * * @param {Object} options - Multi-quote options object. * @param {TokenOrAddress} options.token - The token object or address. * @param {BigNumberish} options.strike - The strike price. * @param {BigNumberish} options.maturity - The maturity time. * @param {boolean} options.isCall - Whether the quote is for a call option. * @param {boolean} options.isBuy - Whether the quote is for a buy or sell. * @param {BigNumberish} options.size - The size of the trade. * @param {BigNumberish} [options.minimumSize] - The minimum size of the trade (optional). * @param {string} [options.priceOracle] - The address of the price oracle (optional). * @param {string[]} [options.quoteTokens] - Array of quote tokens' addresses (optional). * @param {string} [options.referrer] - The address of the referrer (optional). * @param {string} [options.taker] - The address of the taker (optional). * @returns {Promise<(FillableQuote | null)[]>} - A promise that resolves to an array of the best quotes. */ multiQuote(options: { token: TokenOrAddress; strike: BigNumberish; maturity: BigNumberish; isCall: boolean; isBuy: boolean; size: BigNumberish; minimumSize?: BigNumberish; priceOracle?: string; quoteTokens?: string[]; referrer?: string; taker?: string; }): Promise<(FillableQuote | null)[]>; /** * Provides the best quotes available from each provider (RFQ, Pool, Vault) for each pool that matches the provided options. * * @param {Object} options - Quotes by provider options object. * @param {TokenOrAddress} options.token - The token object or address. * @param {BigNumberish} options.strike - The strike price. * @param {BigNumberish} options.maturity - The maturity time. * @param {boolean} options.isCall - Whether the quote is for a call option. * @param {boolean} options.isBuy - Whether the quote is for a buy or sell. * @param {BigNumberish} options.size - The size of the trade. * @param {BigNumberish} [options.minimumSize] - The minimum size of the trade (optional). * @param {string} [options.priceOracle] - The address of the price oracle (optional). * @param {string[]} [options.quoteTokens] - Array of quote tokens' addresses (optional). * @param {string} [options.referrer] - The address of the referrer (optional). * @param {string} [options.taker] - The address of the taker (optional). * @returns {Promise<{ [provider: string]: (FillableQuote | null)[] }>} - A promise that resolves to an object where each key is a provider and the value is an array of the best quotes. */ quotesByProvider(options: { token: TokenOrAddress; strike: BigNumberish; maturity: BigNumberish; isCall: boolean; isBuy: boolean; size: BigNumberish; minimumSize?: BigNumberish; priceOracle?: string; quoteTokens?: string[]; referrer?: string; taker?: string; }): Promise<{ [provider: string]: (FillableQuote | null)[]; }>; /** * Streams the best quotes available from each provider (RFQ, Pool, Vault) for the pool that matches the provided options. The best quote among all providers is updated in real-time and passed to a callback. * * @param {Object} options - Quote options object. * @param {string} options.poolAddress - The pool address. * @param {BigNumberish} options.size - The size of the trade. * @param {boolean} options.isBuy - Whether the quote is for a buy or sell. * @param {BigNumberish} [options.minimumSize] - The minimum size of the trade (optional). * @param {string} [options.referrer] - The address of the referrer (optional). * @param {string} [options.taker] - The address of the taker (optional). * @param {boolean} [options.forceSendRFQ] - Whether to force sending/listening for Request-for-Quotes (optional). * @param {number} [options.maxSlippagePercent] - The maximum slippage percent (optional). * @param {function} callback - Function to be called when a new best quote is available. * @returns {Promise} */ streamQuotes(options: { poolAddress: string; size: BigNumberish; isBuy: boolean; minimumSize?: BigNumberish; referrer?: string; taker?: string; forceSendRFQ?: boolean; maxSlippagePercent?: number; poolKey?: PoolKey; pool?: PoolMinimal; }, callback: (quote: FillableQuote | null) => void): Promise; /** * Streams best quotes available for each pool that matches the provided options. Quotes are updated in real-time and passed to a callback. * * @param {Object} options - Quote options object. * @param {TokenOrAddress} options.token - The token object or address. * @param {BigNumberish} options.strike - The strike price. * @param {BigNumberish} options.maturity - The maturity time. * @param {boolean} options.isCall - Whether the quote is for a call option. * @param {boolean} options.isBuy - Whether the quote is for a buy or sell. * @param {BigNumberish} options.size - The size of the trade. * @param {BigNumberish} [options.minimumSize] - The minimum size of the trade (optional). * @param {string} [options.referrer] - The address of the referrer (optional). * @param {string} [options.taker] - The address of the taker (optional). * @param {number} [options.maxSlippagePercent] - The maximum slippage percent (optional). * @param {string} [options.priceOracle] - The address of the price oracle (optional). * @param {string[]} [options.quoteTokens] - Array of quote tokens' addresses (optional). * @param {function} callback - Function to be called when new quotes are available. * @returns {Promise} */ streamMultiQuotes(options: { token: TokenOrAddress; strike: BigNumberish; maturity: BigNumberish; isCall: boolean; isBuy: boolean; size: BigNumberish; minimumSize?: BigNumberish; referrer?: string; taker?: string; maxSlippagePercent?: number; priceOracle?: string; quoteTokens?: string[]; }, callback: (quotes: (FillableQuote | null)[]) => void): Promise; /** * Streams best quotes available from each provider (RFQ, Pool, Vault) for each pool that matches the provided options. Quotes are updated in real-time and passed to a callback. * * @param {Object} options - Quote options object. * @param {TokenOrAddress} options.token - The token object or address. * @param {BigNumberish} options.strike - The strike price. * @param {BigNumberish} options.maturity - The maturity time. * @param {boolean} options.isCall - Whether the quote is for a call option. * @param {boolean} options.isBuy - Whether the quote is for a buy or sell. * @param {BigNumberish} options.size - The size of the trade. * @param {BigNumberish} [options.minimumSize] - The minimum size of the trade (optional). * @param {string} [options.referrer] - The address of the referrer (optional). * @param {string} [options.taker] - The address of the taker (optional). * @param {boolean} [options.forceSendRFQ] - Whether to force sending/listening for Request-for-Quotes (optional). * @param {number} [options.maxSlippagePercent] - The maximum slippage percent (optional). * @param {string} [options.priceOracle] - The address of the price oracle (optional). * @param {string[]} [options.quoteTokens] - Array of quote tokens' addresses (optional). * @param {function} callback - Function to be called when new quotes are available. * @returns {Promise} */ streamQuotesByProvider(options: { token: TokenOrAddress; strike: BigNumberish; maturity: BigNumberish; isCall: boolean; isBuy: boolean; size: BigNumberish; minimumSize?: BigNumberish; referrer?: string; taker?: string; forceSendRFQ?: boolean; maxSlippagePercent?: number; priceOracle?: string; quoteTokens?: string[]; }, callback: (quotes: { [provider: string]: (FillableQuote | null)[]; }) => void): Promise; /** * Cancels the streaming of quotes for the provided pool address, isCall, and isBuy parameters. * * @param {string} poolAddress - The pool address. * @param {boolean} isCall - Whether the quote is for a call option. * @param {boolean} isBuy - Whether the quote is for a buy or sell. * @returns {Promise} */ cancelStreams(poolAddress: string, isCall: boolean, isBuy: boolean): Promise; /** * Cancels all ongoing streams. * * @returns {Promise} */ cancelAllStreams(): Promise; }