Construct a new BaseAPI object.
An instance of the Premia SDK.
Readonly
premiaEvaluates and returns the best quote from a set of quotes based on the provided size and other options.
The function initially filters out null and undefined quotes. If all quotes are null or undefined,
it returns null. If the pool keys of the quotes are not identical, it emits a warning unless
ignoreWarnings
is set to true.
It then filters the quotes based on the minimum size and the deadline. Only RFQ quotes can be filtered by deadline. The size of the quote should be greater or equal to the minimum size provided.
It finally compares all the quotes and returns the one deemed the best using the better
method.
Array of quotes or fillable quotes to be compared.
The size to consider when comparing quotes.
Optional
minimumSize: BigNumberishThe minimum size to filter quotes by. If not provided, size
will be used.
Optional
ignoreWarnings: boolean = falseWhether to ignore warnings if pool keys for quotes compared are not identical.
The best quote from the provided set, or null if no quotes pass the filtering conditions.
Compares two quotes and returns the better one based on multiple factors.
The function considers various factors including deadline, size, price, origin and timestamp (for RFQs) in determining which quote is better. If both quotes are essentially equivalent, quoteA is returned.
If minimum size is greater than size.
If quotes have opposite directions.
The first quote or fillable quote to be compared.
The second quote or fillable quote to be compared.
The size to consider when comparing quotes.
Optional
minimumSize: BigNumberishThe minimum size to filter quotes by. If not provided, size
will be used.
Optional
ignoreWarnings: boolean = falseWhether to ignore warnings if pool keys for quotes compared are not identical.
The better quote from the two provided, or null if neither quote passes the comparison conditions.
Calculates the limit of a premium based on maximum slippage percentage.
The function computes the limit for a premium considering a given maximum slippage percentage. If the operation is a 'buy', the premium limit is increased by the slippage offset, otherwise, for a 'sell', the premium limit is decreased by the slippage offset.
The premium value used as the base for limit calculation.
The maximum slippage percentage to calculate the offset.
A flag indicating whether the operation is a 'buy' or 'sell'.
The calculated limit for the premium considering the slippage.
Generated using TypeDoc
Represents a class for handling pricing comparison operations.