Create RFQ
Ask makers for private quotes on a stable funding perp (an RFQ), giving a size and optionally a side.
On this page
Write a small program that calls `rfq.create_rfq` on Grvt {environment} {using}.
Target environment: {environment} (chain ID {chainId}). Recorded signing cases keep their original environment.
{executionGuidance}
Read this first: {origin}/bundle/reference/rpc/create_rfq.md (~56 KB, plain Markdown: this page plus the AGENTS.md rules, Authentication and sessions, Errors and retries, Python SDK, Environments).
Fetch other pages from the index at {origin}/llms.txt only as you need them. {origin}/downloads/contract.json is a machine-readable contract for tools, not for reading.
Rules: follow AGENTS.md; do not send requests without the user asking you to; read credentials from environment variables; never retry writes automatically; show me the code and how to run it. URLs and generated code samples on this page: Testnet (chain ID 326). Other code on this page doesn't change: it stays on testnet until you switch it in your code. Tutorials, signing cases and live tools always use testnet.
A taker solicits private quotes for one STABLE_PERP instrument by giving a size and, optionally, a direction (rfq.side; leave it out for a two-way request). The request is unsigned: creating an RFQ commits the taker to nothing.
End-to-end flow:
- The taker submits an RFQ here. (In the Grvt UI, entering a size on the trade page is the RFQ.)
- Grvt broadcasts the RFQ to qualified makers on the
v1.rfqstream, with an anonymous id instead of the taker's account and without its side. Makers can add ECN orders bound to it (metadata.rfq_id). - The
v1.quotestream sends the taker, for each side of the book, the average fill price for the RFQ size and how much of it can fill, as the book changes. - The taker accepts by signing an IOC limit order with create_order and
metadata.rfq_idset (one leg; its side must matchrfq.sidewhen that is set). Or the taker walks away and lets the RFQ expire.
The created RFQ is returned in the response. A sub-account may hold at most one open RFQ per instrument. The RFQ lives until rfq.expiry; then Grvt expires it and cancels the makers' orders bound to it. The sub-account must be in multi-asset mode.
| SDK | client. |
|---|---|
| HTTP | POST https:/, or /lite/v1/create_rfq for lite names (the SDKs' default) |
| WebSocket | method v1/create_rfq on wss:/, or /ws/lite for lite names |
| Auth | Session required (Authentication) |
| Retries | Write: never retried automatically (why) |
| Contract id | rfq.create_rfq (RPCCreateRfqV1) |
Request
Body type ApiCreateRfqRequest. Fields the server fills are left out.
- The sub-account initiating the RFQ
- When the RFQ expires, in unix nanoseconds. Default 60s, cap 300s (per-instrument config)
- The instrument to trade. Must be kind = STABLE_PERP
- Requested size (positive). Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
- Optional — omitted = two-way request. The Grvt UI always fills it; API takers may withhold direction and accept two-way quotes
3 values
Response
Body type ApiCreateRfqResponse (the same object is the JSON-RPC result over WebSocket).
- Set by the server. The exchange's 128-bit id for the RFQ.
- The sub-account initiating the RFQ
- When the RFQ expires, in unix nanoseconds. Default 60s, cap 300s (per-instrument config)
- The instrument to trade. Must be kind = STABLE_PERP
- Requested size (positive). Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
- Optional — omitted = two-way request. The Grvt UI always fills it; API takers may withhold direction and accept two-way quotes
3 values
Errors
Errors come back as {"code", "message", "status"} (lite {"c", "m", "s"}) with the HTTP status. Codes this call can return (all error codes):
2061InstrumentNotSupported400- Unsupported Instrument Requested
2065InvalidContractGrainSize400- Order size too granular
2141RfqSubAccountDoesNotMatchLoggedInUser403- RFQ sub account does not match logged in user
2142RfqInstrumentNotStablePerp400- RFQ instrument must be a stable perpetual
2143RfqSizeBelowMinimum400- RFQ size is below the instrument minimum size
2144RfqSizeAboveMaximum400- RFQ size exceeds the instrument maximum position size
2145RfqInvalidExpiry400- RFQ expiry is invalid
2146RfqAlreadyExistsForAsset400- An open RFQ already exists for this sub account and instrument
2147StablePerpRequiresMultiAssetMode400- stable perp orders require a multi-asset-mode sub-account
7726SfpMarketClosed400- The Stable Funding Perpetual market is closed.
Plus 6 errors any call can return
1000Unauthorized401- You need to authenticate prior to using this functionality
1001Forbidden403- You are not authorized to access this functionality
1002InternalServer500- Internal Server Error
1003InvalidRequest400- Request could not be processed due to malformed syntax
1004NotFound404- Data Not Found
1006RateLimit429retryable- You have surpassed the allocated rate limit for your tier
Example
Example code
import os
from decimal import Decimal
from grvt import Grvt, Timestamp, models as m
with Grvt(
env=os.environ.get("GRVT_ENV", "testnet"),
api_key=os.environ["GRVT_API_KEY"],
) as client:
resp = client.create_rfq(
rfq=m.RfqInput(
sub_account_id=os.environ["GRVT_SUB_ACCOUNT_ID"],
expiry=Timestamp(int("1697788800000000000")),
instrument="AAPL_USDC_SFP",
size=Decimal("10.5"),
),
)
print(resp)
Raw HTTP (set GRVT_DOMAIN, see Environments; GRVT_COOKIE and GRVT_ACCOUNT_ID come from login):
With full field names:
curl -sS "https://trades.testnet.grvt.io/full/v1/create_rfq" \
-H "Content-Type: application/json" \
-H "Cookie: gravity=$GRVT_COOKIE" \
-H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
--data @- <<EOF
{
"rfq": {
"sub_account_id": "$GRVT_SUB_ACCOUNT_ID",
"expiry": "1697788800000000000",
"instrument": "AAPL_USDC_SFP",
"size": "10.5"
}
}
EOFWith lite field names:
curl -sS "https://trades.testnet.grvt.io/lite/v1/create_rfq" \
-H "Content-Type: application/json" \
-H "Cookie: gravity=$GRVT_COOKIE" \
-H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
--data @- <<EOF
{
"r": {
"sa": "$GRVT_SUB_ACCOUNT_ID",
"e": "1697788800000000000",
"i": "AAPL_USDC_SFP",
"s": "10.5"
}
}
EOF