Request for Quote (RFQ)
POST https://api.sfox.com/v1/quote
Returns an actionable one-sided quote for the specified currency pair.
After sending an RFQ, the API will return a quote with a price at which a trade can be executed. If you agree with the price, you can request the execution of the trade using the orders endpoint.
In the orders request, you will need to specify the same:
currency_pairquantityquote_idand, if specified in the quote request, the
client_quote_id
Request Body
pair required
string
The currency pair for the quote. e.g. btcusd
side required
string
The side for the quote (whether you are buying or selling). Possible values:
buy: You want to buysell: You want to sell
quantity required
number
The base currency quantity for the quote (e.g. 10 ). Must be <= the maximum quote quantity for the given pair.
amount
number
The quote currency quantity for the quote (e.g. 300000.0000 ). Required if quantity is not included in the request.
client_quote_id
string
An optional idempotent identifier for your quote. If specified, you must specify the same value in the client_order_id field of your order request to execute on the quote.
Response Body
quote_id
Unique identifier for the quote. Note: to execute an order on this quote you will specify this quote_id in your order request
quantity
The base currency quantity of the quote
amount
The quote currency amount of the quote
pair
The currency pair for the quote request
side
The quote side–whether you are buying or selling
date_expiry
The datetime the quote will expire
date_quote
The datetime the quote was generated
buy_price
The quote price–the price to buy this quantity. Returned if side = buy, else not included.
sell_price
The quote price–the price to sell this quantity. Returned if side = sell, else not included.
Responses
Example Request
curl -X POST \
-H 'Content-type: application/json' \
-H 'Authorization: Bearer <API_TOKEN>' \
--data '{ "pair": "btcusd",
"side": "buy",
"quantity": 1 }' \
'https://api.sfox.com/v1/quote'const axios = require('axios');
axios({
method: 'post',
url: 'https://api.sfox.com/v1/quote',
headers: {
'Authorization': 'Bearer <API_KEY>'
},
data: {
pair: 'btcusd',
side: 'buy',
quantity: 1
}
}).then(response => {
console.log(response)
}).catch(err => {
console.error(err)
});import requests
data = requests.post(
"https://api.sfox.com/v1/quote",
headers={
"Authorization": "Bearer <API_KEY>",
},
data={
"pair": "btcusd",
"side": "buy",
"quantity": 1
}
)
print(data)End-to-End Example
The following example details the end-to-end process of requesting a quote from the RFQ endpoint and executing an order to trade on that quote
RFQ
Request: Requested a quote to purchase 1 BTC on the BTC/USD pair
Response: Received a purchase price of
23243.49136824for 1 BTC with Quote IDcb436399-9db7-11ed-8ea6-0e5724aafd6bwhich is later specified in the orderrequest
Request
curl -X POST \
-H 'Content-type: application/json' \
-H 'Authorization: Bearer <API_TOKEN>' \
--data '{ "pair": “btcusd”,
"side": "buy",
“quantity”: 1 }' \
'https://api.sfox.com/v1/quote'Response
{
"quote_id": "cb436399-9db7-11ed-8ea6-0e5724aafd6b",
"quantity": 1,
"pair": "btcusd",
"side": "BUY",
"date_expiry": "2023-01-26T20:27:18.310Z",
"date_quote": "2023-01-26T20:27:03.310Z",
"buy_price": 23243.49136824
}Order Execution
Request: Placed an order to buy 1 BTC on the BTC/USD pair and specified the previously received quote ID
cb436399-9db7-11ed-8ea6-0e5724aafd6bResponse: Received an “Order Filled” response, purchasing 1 BTC at the previously quoted unit price of
23243.49136824
Request
curl -X POST \
-H 'Content-type: application/json' \
-H 'Authorization: Bearer <API_TOKEN>' \
--data '{ "currency_pair": “btcusd”,
"quantity": 1,
"quote_id": "cb436399-9db7-11ed-8ea6-0e5724aafd6b" }' \
'https://api.sfox.com/v1/orders/buy'Response
{
"id": 1754344,
"side_id": 500,
"action": "Buy",
"algorithm_id": 150,
"algorithm": "Instant",
"type": "Instant",
"pair": "btcusd",
"quantity": 1,
"price": 23243.49136824,
"amount": 0,
"net_market_amount": 0,
"filled": 1,
"vwap": 23243.49136824,
"filled_amount": 23243.49136824,
"fees": 0,
"net_proceeds": -23243.49136824,
"status": "Done",
"status_code": 300,
"routing_option": "BestPrice",
"routing_type": "None",
"time_in_force": "FOK",
"expires": null,
"dateupdated": "2023-01-26T20:27:06.000Z", "client_order_id": "",
"user_tx_id": "",
"o_action": "Buy",
"algo_id": 150,
"algorithm_options": null,
"destination": "",
"quote_id": "cb436399-9db7-11ed-8ea6-0e5724aafd6b"
}Last updated