HomeDocumentationAPI Reference
Log In
API Reference

Rfq Get Best Quote

Method Name

private/rfq_get_best_quote

Performs 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_id  integer required
Subaccount ID
legs  array of objects required
RFQ legs
legs[]. amount  string required
Amount in units of the base
legs[]. direction  string required
Leg direction
enum buy sell
legs[]. instrument_name  string required
Instrument name
client  string
Optional client that sent RFQ
counterparties  array 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.
direction  string
Planned execution direction (default buy)
enum buy sell
extra_fee  string
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.
label  string
Optional user-defined label for the RFQ
max_total_cost  string
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_cost  string
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_step  string
Optional step size for partial fills. If not supplied, the RFQ will not support partial fills.
preferred_direction  string
If disclosed, the direction the user is aiming to execute as. Default None.
enum buy sell
referral_code  string
Optional referral code for the RFQ
rfq_id  string
RFQ ID to get best quote for. If not provided, will return estimates based on mark prices

Response

id  string or integer required
result  object required
result. best_quote  object or null required
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_reason  string required
Cancel reason, if any
enum user_request insufficient_margin signed_max_fee_too_low mmp_trigger cancel_on_disconnect session_key_deregistered subaccount_withdrawn rfq_no_longer_open compliance
result.best_quote. creation_timestamp  integer required
Creation timestamp in ms since Unix epoch
result.best_quote. direction  string required
Quote direction
enum buy sell
result.best_quote. fill_pct  string required
Percentage of the RFQ that this quote would fill, from 0 to 1.
result.best_quote. last_update_timestamp  integer required
Last update timestamp in ms since Unix epoch
result.best_quote. legs_hash  string required
Hash of the legs of the best quote to be signed by the taker.
result.best_quote. liquidity_role  string required
Liquidity role
enum maker taker
result.best_quote. quote_id  string required
Quote ID
result.best_quote. rfq_id  string required
RFQ ID
result.best_quote. status  string required
Status
enum open filled cancelled expired
result.best_quote. subaccount_id  integer required
Subaccount ID
result.best_quote. tx_hash  string or null required
Blockchain transaction hash (only for executed quotes)
result.best_quote. tx_status  string or null required
Blockchain transaction status (only for executed quotes)
enum requested pending settled reverted ignored timed_out
result.best_quote. wallet  string required
Wallet address of the quote sender
result.best_quote. legs  array of objects required
Quote legs
result.best_quote.legs[]. amount  string required
Amount in units of the base
result.best_quote.legs[]. direction  string required
Leg direction
enum buy sell
result.best_quote.legs[]. instrument_name  string required
Instrument name
result.best_quote.legs[]. price  string required
Leg price
result. direction  string required
RFQ direction.
enum buy sell
result. down_liquidation_price  string or null required
Liquidation price if the trade were to be filled and the market moves down.
result. estimated_fee  string required
An estimate for how much the user will pay in fees ($ for the whole trade).
result. estimated_realized_pnl  string required
An estimate for the realized PnL of the trade.
result. estimated_realized_pnl_excl_fees  string required
An estimate for the realized PnL of the trade. with cost basis calculated without considering fees.
result. estimated_total_cost  string required
An estimate for the total $ cost of the trade.
result. filled_pct  string required
Percentage of the RFQ that has already been filled, from 0 to 1.
result. invalid_reason  string or null required
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_valid  boolean required
True if RFQ is expected to pass margin requirements.
result. orderbook_total_cost  string or null required
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_margin  string required
User's hypothetical margin balance if the trade were to get executed.
result. post_liquidation_price  string or null required
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_margin  string required
User's initial margin balance before the trade.
result. suggested_max_fee  string required
Recommended value for max_fee of the trade.
result. up_liquidation_price  string or null required
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}