Method Name
private/rfq_get_best_quote
private/rfq_get_best_quotePerforms a "dry run" on an RFQ, returning the estimated fee and whether the trade is expected to pass.
Should any exception be raised in the process of evaluating the trade, a standard RPC error will be returned
with the error details.
Required minimum session key permission level is read_only
Parameters
| subaccount_idintegerrequired Subaccount ID |
| legsarray of objectsrequired RFQ legs |
| legs[].amountstringrequired Amount in units of the base |
| legs[].directionstringrequired Leg direction enum buysell |
| legs[].instrument_namestringrequired Instrument name |
| clientstring Optional client that sent RFQ |
| counterpartiesarray of strings Optional list of market maker account addresses to request quotes from. If not supplied, all market makers who are approved as RFQ makers will be notified. |
| directionstring Planned execution direction (default buy)enum buysell |
| extra_feestring Extra fee in USDC added to the total final fee paid by user and directly sent to client / builder (must be between 0.000001 and 1000 USDC). The referral_code field must also be filled out. See Builder Fee page in docs for more info. |
| labelstring Optional user-defined label for the RFQ |
| max_total_coststring An optional max total cost for the RFQ. Only used when the RFQ sender executes as buyer. Polling endpoints and channels will ignore quotes where the total cost across all legs is above this value. Positive values mean the RFQ sender expects to pay $, negative mean the RFQ sender expects to receive $.This field is not disclosed to the market makers. |
| min_total_coststring An optional min total cost for the RFQ. Only used when the RFQ sender executes as seller. Polling endpoints and channels will ignore quotes where the total cost across all legs is below this value. Positive values mean the RFQ sender expects to receive $, negative mean the RFQ sender expects to pay $.This field is not disclosed to the market makers. |
| partial_fill_stepstring Optional step size for partial fills. If not supplied, the RFQ will not support partial fills. |
| preferred_directionstring If disclosed, the direction the user is aiming to execute as. Default None. enum buysell |
| referral_codestring Optional referral code for the RFQ |
| rfq_idstring RFQ ID to get best quote for. If not provided, will return estimates based on mark prices |
Response
| idstring or integerrequired |
| resultobjectrequired |
| result.best_quoteobject or nullrequired Best quote for the RFQ (or null if RFQ is not created yet or quotes do not exist). This object should be used to sign a taker quote and call into execute_quote RPC. |
| result.best_quote.cancel_reasonstringrequired Cancel reason, if any enum user_requestinsufficient_marginsigned_max_fee_too_lowmmp_triggercancel_on_disconnectsession_key_deregisteredsubaccount_withdrawnrfq_no_longer_opencompliance |
| result.best_quote.creation_timestampintegerrequired Creation timestamp in ms since Unix epoch |
| result.best_quote.directionstringrequired Quote direction enum buysell |
| result.best_quote.fill_pctstringrequired Percentage of the RFQ that this quote would fill, from 0 to 1. |
| result.best_quote.last_update_timestampintegerrequired Last update timestamp in ms since Unix epoch |
| result.best_quote.legs_hashstringrequired Hash of the legs of the best quote to be signed by the taker. |
| result.best_quote.liquidity_rolestringrequired Liquidity role enum makertaker |
| result.best_quote.quote_idstringrequired Quote ID |
| result.best_quote.rfq_idstringrequired RFQ ID |
| result.best_quote.statusstringrequired Status enum openfilledcancelledexpired |
| result.best_quote.subaccount_idintegerrequired Subaccount ID |
| result.best_quote.tx_hashstring or nullrequired Blockchain transaction hash (only for executed quotes) |
| result.best_quote.tx_statusstring or nullrequired Blockchain transaction status (only for executed quotes) enum requestedpendingsettledrevertedignoredtimed_out |
| result.best_quote.walletstringrequired Wallet address of the quote sender |
| result.best_quote.legsarray of objectsrequired Quote legs |
| result.best_quote.legs[].amountstringrequired Amount in units of the base |
| result.best_quote.legs[].directionstringrequired Leg direction enum buysell |
| result.best_quote.legs[].instrument_namestringrequired Instrument name |
| result.best_quote.legs[].pricestringrequired Leg price |
| result.directionstringrequired RFQ direction. enum buysell |
| result.down_liquidation_pricestring or nullrequired Liquidation price if the trade were to be filled and the market moves down. |
| result.estimated_feestringrequired An estimate for how much the user will pay in fees ($ for the whole trade). |
| result.estimated_realized_pnlstringrequired An estimate for the realized PnL of the trade. |
| result.estimated_realized_pnl_excl_feesstringrequired An estimate for the realized PnL of the trade. with cost basis calculated without considering fees. |
| result.estimated_total_coststringrequired An estimate for the total $ cost of the trade. |
| result.filled_pctstringrequired Percentage of the RFQ that has already been filled, from 0 to 1. |
| result.invalid_reasonstring or nullrequired Reason for the RFQ being invalid, if any. enum Account is currently under maintenance margin requirements, trading is frozen.This order would cause account to fall under maintenance margin requirements.Insufficient buying power, only a single risk-reducing open order is allowed.Insufficient buying power, consider reducing order size.Insufficient buying power, consider reducing order size or canceling other orders.Consider canceling other limit orders or using IOC, FOK, or market orders. This order is risk-reducing, but if filled with other open orders, buying power might be insufficient.Insufficient buying power. |
result.is_validbooleanrequiredTrue if RFQ is expected to pass margin requirements. |
| result.orderbook_total_coststring or nullrequired Total cost of the RFQ if it were to be filled at current orderbook prices (same direction as the RFQ). If lower than estimated_total_cost, the user may want to use the orderbook instead of RFQs for this order. Will return null if any of the legs do not have orderbook data or enough liquidity for the full fill. |
| result.post_initial_marginstringrequired User's hypothetical margin balance if the trade were to get executed. |
| result.post_liquidation_pricestring or nullrequired Liquidation price if the trade were to be filled. If both upside and downside liquidation prices exist, returns the closest one to the current index price. |
| result.pre_initial_marginstringrequired User's initial margin balance before the trade. |
| result.suggested_max_feestringrequired Recommended value for max_fee of the trade. |
| result.up_liquidation_pricestring or nullrequired Liquidation price if the trade were to be filled and the market moves up. |
Example
{request_example_shell}{request_example_javascript}{request_example_python}The above command returns JSON structured like this:
{response_example_json}