Smart Order Routing (Preview)
Download OpenAPI specification:Download
Welcome to the preview documentation for the Paxos Smart Order Routing (SOR) APIs. The SOR APIs are in the early preview stage and as a result will be updated regularly as new functionality becomes ready.
This document contains proposed additions to the main Paxos API 2.0 documentation. The additions here are subject to breaking changes until merged into the main documentation.
Get Order Book
For each market the order book contains the full list of bids and asks at individual price levels with resting quantities per level.
query Parameters
market | string <market> Enum: "BTCUSD" "ETHUSD" "BCHUSD" "LTCUSD" "LINKUSD" "MATICUSD" "AAVEUSD" "UNIUSD" Filter by market name. |
level | string Enum: "LEVEL_1" "LEVEL_2" Filter by order book level. |
Responses
Response samples
- 200
- 400
- 500
{- "markets": [
- {
- "market": "BTCUSD",
- "venues": [
- {
- "id": "a80e4e12-b813-4884-8242-56559bcfcc6c",
- "name": "Paxos Exchange",
- "bids": [
- {
- "price": "1.00",
- "volume": "100"
}
], - "asks": [
- {
- "price": "1.00",
- "volume": "100"
}
]
}
]
}
]
}
Smart Order Routing (SOR) is an automated process that evaluates and routes orders across multiple exchanges and liquidity venues to get the best price execution for each order, based on the liquidity available at that time.
The SOR APIs allow you to submit orders using standard order types and then track progress as the orders are routed and executed across multiple venues.
Error Handling
Sync Error Messages
Error messages, such as request validation or server processing errors, are returned in the HTTP response for the majority of endpoints. Following the RFC 7807 standard, the JSON error response includes a title, a status and error details.
Example error message in the HTTP response:
{
"type": "about:blank",
"title": "Bad Request",
"status": 400,
"detail": "invalid side, available values: ['BUY', 'SELL']"
}
Async Error Messages
Due to the async processing of orders, some order error statuses are provided via the Get Orders and List Orders endpoints in the error_code
and error_message
fields.
Example error message in the response from Get / List Orders:
{
"orders": [
{
"id": "JE53WYesJHeeSqrT36VkA",
"error_code": 3000,
"error_message": "Insufficient Funds",
"profile_id": "ac1f1128-5521-4806-b4c5-4f992b766f08",
"status": "REJECTED",
"ref_id": "fd61ed2b-e1a0-4dd8-a7c9-7873b2911577",
"market": "BTCUSD",
…
}
]
}
Async Errors
Orders which fail asynchronously will have a status of REJECTED
.
Error Category | Error Scenario | Error Code | Error Message |
---|---|---|---|
SOR Internal Error | Internal Error | 1000 | The order was canceled due to an internal error. |
Order Argument Error | Invalid Argument | 2000 | An unsupported argument was provided in the order: {f}:{v} . |
Order Argument Error | base_amount outside allowed range | 2001 | The base_amount submitted was outside the supported range. |
Order Argument Error | quote_amount outside allowed range | 2002 | The quote_amount submitted was outside the supported range. |
Account Level Error | Insufficient Funds | 3000 | Mandatory field missing: {f} . |
Account Level Error | Permission Denied | 3001 | Your account does not have permission to trade the asset: {asset} . |
Create Order
Submit orders to the Smart Order Router.
Supported Order Types
Order Type | Status |
---|---|
Market | Supported |
Limit | * Coming Soon |
Algorithmic Order Types | * Coming Soon |
- To buy, set
side = BUY
and setquote_amount
to the dollar amount you want to spend. - To sell, set
side = SELL
and setbase_amount
to the crypto amount you want to sell.
Acknowledgement Response
This endpoint will respond with a 200 and an order ID. This response does not confirm the order has been validated, accepted or submitted to a venue. To check the status of your order you will use the Get Orders endpoint.
Idempotency
Orders which fail idempotency checks will not be returned from Get Orders or List Orders. Notifications regarding idempotency failures will be added in a future update to the SOR APIs.
Authorizations:
Request Body schema: application/json
profile_id required | string <uuid> The Profile ID the order will be associated with. |
identity_id | string <uuid> The end user that requests the trade. This field must be used in conjunction with |
account_id | string <uuid> The account under which this order is placed. The provided identity must be allowed to trade on behalf of this account. This field must be used in conjunction with |
ref_id | string The idempotence ID for order creation. Can be reused if the order has been closed for more than 24 hours. Up to 100 characters are supported. |
market required | string <market> Enum: "BTCUSD" "ETHUSD" "BCHUSD" "LTCUSD" "LINKUSD" "MATICUSD" "AAVEUSD" "UNIUSD" The trading market. |
side required | string <orderside> Enum: "BUY" "SELL" Whether this order is for a buy or a sell. |
type | string Value: "MARKET" Order type. |
quote_amount | string <decimal> The quote currency amount of purchase for a market buy order. |
base_amount | string <decimal> The base currency amount for any limit order or the exact amount to sell for a market sell order. |
object <map> Metadata to store on the quote and created order. Up to 6 key/value pairs may be stored, with each key and value at most 100 characters. |
Responses
Request samples
- Payload
{- "profile_id": "12f708db-f000-4ec0-9558-efc63cb9d948",
- "identity_id": "873989a6-8270-4e1a-89f7-d1b3f28fff3f",
- "account_id": "2d6e0dc5-a816-455d-8cd8-9eb7517799c5",
- "ref_id": "bcf0c3a12d554e9996b6ec54cca7a41e",
- "market": "BTCUSD",
- "side": "BUY",
- "type": "MARKET",
- "quote_amount": "1.00",
- "base_amount": "0.0",
- "metadata": {
- "key": "value"
}
}
Response samples
- 200
- 400
- 401
- 403
- 500
{- "profile_id": "12f708db-f000-4ec0-9558-efc63cb9d948",
- "identity_id": "873989a6-8270-4e1a-89f7-d1b3f28fff3f",
- "account_id": "2d6e0dc5-a816-455d-8cd8-9eb7517799c5",
- "ref_id": "bcf0c3a12d554e9996b6ec54cca7a41e",
- "market": "BTCUSD",
- "side": "BUY",
- "type": "MARKET",
- "quote_amount": "1.00",
- "base_amount": "0.0",
- "id": "rtZaCnAz1FvArCTVbzFL9",
- "metadata": {
- "key": "value"
}
}
Get Orders
Get the details of any order(s) created within the last 90 days.
Newly created orders may take up to 250ms before they will be returned from this endpoint.
Authorizations:
query Parameters
ids | Array of strings List of order identifiers assigned by Paxos. |
ref_ids | Array of strings The idempotence IDs provided during order creation. |
Responses
Response samples
- 200
- 400
- 401
- 403
- 500
{- "orders": [
- {
- "id": "rtZaCnAz1FvArCTVbzFL9",
- "error_code": 0,
- "error_message": "",
- "profile_id": "12f708db-f000-4ec0-9558-efc63cb9d948",
- "identity_id": "873989a6-8270-4e1a-89f7-d1b3f28fff3f",
- "account_id": "2d6e0dc5-a816-455d-8cd8-9eb7517799c5",
- "recipient_profile_id": "293e2735-ad92-4f03-9bcd-9164bd8dfc7b",
- "status": "OPEN",
- "ref_id": "bcf0c3a12d554e9996b6ec54cca7a41e",
- "market": "BTCUSD",
- "side": "BUY",
- "type": "MARKET",
- "time_in_force": "IMMEDIATE_OR_CANCEL",
- "expire_time": "2023-09-29T10:18:40+00:00",
- "price": "1.00",
- "base_amount": "0.0",
- "quote_amount": "1.00",
- "created_at": "2023-09-29T10:18:40+00:00",
- "modified_at": "2023-09-29T10:18:40+00:00",
- "filled_base_amount": "1.00",
- "filled_quote_amount": "1.00",
- "unfilled_base_amount": "1.00",
- "unfilled_quote_amount": "1.00",
- "volume_weighted_average_price": "1.00",
- "metadata": {
- "key": "value"
}
}
]
}
List Executions
Retrieves full details of underlying executions with optional filters. This endpoint returns a maximum of 1000 items per page.
This endpoint will only return executions from orders created via the SOR API.
Authorizations:
query Parameters
profile_id | string <uuid> Filter executions by the Profile ID associated with the orders. |
identity_id | string <uuid> Filter executions by the end user Identity associated with the orders. |
account_id | string <uuid> Filter executions by the Account ID associated with the orders. |
order_id | string Filter executions to those associated with a single order ID. |
ref_id | string Filter executions to those associated with a single idempotence ID. |
created_at.begin | string <rfc3339> Only return records after this timestamp, inclusive. |
created_at.end | string <rfc3339> Only return records before this timestamp, inclusive. |
page_cursor | string Cursor token for fetching the next page. If using this then do not use the limit parameter. |
limit | integer <int32> Number of results to return. The Maximum value allowed is 1000. |
Responses
Response samples
- 200
- 400
- 401
- 403
- 500
{- "executions": [
- {
- "profile_id": "12f708db-f000-4ec0-9558-efc63cb9d948",
- "identity_id": "2d6e0dc5-a816-455d-8cd8-9eb7517799c5",
- "account_id": "0def6027-c9d7-464c-9c12-b3eddc4fe92a",
- "execution_id": "AoSLkFwEpq8cu7VDcXid8",
- "created_at": "2023-10-29T10:18:40+00:00",
- "order_id": "YG7Vw7PYQjfR8fS4ZxfuA",
- "ref_id": "ba1ec5fc793ae2ab",
- "market": "BTCUSD",
- "type": "MARKET",
- "side": "BUY",
- "filled_base_amount": "1.00",
- "filled_quote_amount": "1.00",
- "price": "1.00",
- "commission": "1.00",
- "commission_asset": "USD"
}
], - "next_page_cursor": "39f1766d35a14523"
}
List Orders
Retrieve orders using custom filtering such as status, timeframe, market and side. This endpoint provides access to historical orders for the last 90 days (including last 24 hours).
Newly created orders may take up to 250ms before they will be returned from this endpoint.
Authorizations:
query Parameters
profile_id | string <uuid> Filter orders by the Profile ID. |
identity_id | string <uuid> Filter orders by the end user Identity. |
account_id | string <uuid> Filter orders by the Account ID. |
markets | Array of strings <market> Items Enum: "BTCUSD" "ETHUSD" "BCHUSD" "LTCUSD" "LINKUSD" "MATICUSD" "AAVEUSD" "UNIUSD" Filter by the trading pair. |
sides | Array of strings <orderside> Items Enum: "BUY" "SELL" Filter by the side of the order. |
statuses | Array of strings List of order statuses. |
created_at.begin | string <rfc3339> Only return records created after this timestamp, inclusive (max 90 days) [default: last 24h]. |
created_at.end | string <rfc3339> Only return records created before this timestamp, inclusive (max 90 days) [default: last 24h]. |
modified_at.begin | string <rfc3339> Only return records after this timestamp, inclusive. |
modified_at.end | string <rfc3339> Only return records before this timestamp, inclusive. |
page_cursor | string Cursor token for fetching the next page. |
limit | integer <int32> Number of results to return. The Maximum value allowed is 1000. |
Responses
Response samples
- 200
- 400
- 401
- 403
- 500
{- "orders": [
- {
- "id": "rtZaCnAz1FvArCTVbzFL9",
- "error_code": 0,
- "error_message": "",
- "profile_id": "12f708db-f000-4ec0-9558-efc63cb9d948",
- "identity_id": "873989a6-8270-4e1a-89f7-d1b3f28fff3f",
- "account_id": "2d6e0dc5-a816-455d-8cd8-9eb7517799c5",
- "recipient_profile_id": "293e2735-ad92-4f03-9bcd-9164bd8dfc7b",
- "status": "OPEN",
- "ref_id": "bcf0c3a12d554e9996b6ec54cca7a41e",
- "market": "BTCUSD",
- "side": "BUY",
- "type": "MARKET",
- "time_in_force": "IMMEDIATE_OR_CANCEL",
- "expire_time": "2023-09-29T10:18:40+00:00",
- "price": "1.00",
- "base_amount": "0.0",
- "quote_amount": "1.00",
- "created_at": "2023-09-29T10:18:40+00:00",
- "modified_at": "2023-09-29T10:18:40+00:00",
- "filled_base_amount": "1.00",
- "filled_quote_amount": "1.00",
- "unfilled_base_amount": "1.00",
- "unfilled_quote_amount": "1.00",
- "volume_weighted_average_price": "1.00",
- "metadata": {
- "key": "value"
}
}
], - "next_page_cursor": "39f1766d35a14523"
}