{
  "openapi": "3.1.0",
  "info": {
    "title": "Atlas best execution API",
    "version": "1",
    "description": "Merged order books across perps venues and the cheapest split of an order across them after each venue's taker fee. Prices and sizes are exact decimals written as strings. The service advises and passes on orders your client signed; it never holds keys or funds."
  },
  "servers": [
    {
      "url": "https://exec.at.market"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authorization: Bearer <key>, or the x-api-key header."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "bad_request",
                  "unauthorized",
                  "key_revoked",
                  "rate_limited",
                  "not_found",
                  "method_not_allowed",
                  "unknown_asset",
                  "no_fresh_books",
                  "upstream_unavailable",
                  "venue_not_supported",
                  "bad_signature",
                  "upgrade_required",
                  "internal"
                ]
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "Rules": {
        "type": "object",
        "description": "The venue's price grid, size step and minimums for the market, in the venue's own units.",
        "properties": {
          "price": {
            "type": "object",
            "description": "{\"tick\":{\"tick\":\"0.1\"}} or {\"sig_figs\":{\"sig\":5,\"max_dp\":1}}."
          },
          "size_step": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "Sizes are whole multiples of this.",
            "example": "60431.5"
          },
          "min_size": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "description": "The smallest size.",
                "example": "60431.5"
              },
              {
                "type": "null"
              }
            ]
          },
          "min_notional": {
            "type": "object",
            "description": "{\"quote\":{\"min\":\"10\"}} or \"none\"."
          },
          "max_leverage": {
            "type": [
              "integer",
              "null"
            ]
          },
          "close_only": {
            "type": "boolean"
          },
          "isolated_only": {
            "type": "boolean"
          }
        }
      },
      "VenueState": {
        "type": "object",
        "description": "A venue's market for the asset and how its book stands. Prices are per unit of the asset, sizes in units of it.",
        "properties": {
          "venue": {
            "type": "string"
          },
          "venue_name": {
            "type": "string"
          },
          "market": {
            "type": "string",
            "description": "The venue's own name for the market: what an order there names."
          },
          "instrument": {
            "type": "string",
            "description": "venue:perp:market"
          },
          "quote": {
            "type": "string",
            "example": "USDC"
          },
          "multiplier": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "Units of the asset a contract.",
            "example": "1"
          },
          "taker_bps": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "The taker fee used, bps.",
            "example": "4.5"
          },
          "state": {
            "type": "string",
            "enum": [
              "fresh",
              "stale",
              "no_book",
              "excluded",
              "below_minimum"
            ]
          },
          "age_ms": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Since the venue's socket last said anything."
          },
          "best_bid": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "description": "Best bid.",
                "example": "60431.5"
              },
              {
                "type": "null"
              }
            ]
          },
          "bid_size": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "description": "Size at the best bid.",
                "example": "60431.5"
              },
              {
                "type": "null"
              }
            ]
          },
          "best_ask": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "description": "Best ask.",
                "example": "60431.5"
              },
              {
                "type": "null"
              }
            ]
          },
          "ask_size": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "description": "Size at the best ask.",
                "example": "60431.5"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "Top": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "price": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "Price",
            "example": "60431.5"
          },
          "size": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "That venue's size there",
            "example": "60431.5"
          },
          "venue": {
            "type": "string"
          },
          "venue_name": {
            "type": "string"
          }
        }
      },
      "MergedLevel": {
        "type": "object",
        "properties": {
          "price": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "Price per unit",
            "example": "60431.5"
          },
          "size": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "Every venue's size at the price",
            "example": "60431.5"
          },
          "venues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "venue": {
                  "type": "string"
                },
                "size": {
                  "type": "string",
                  "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                  "description": "This venue's size",
                  "example": "60431.5"
                }
              }
            }
          }
        }
      },
      "Book": {
        "type": "object",
        "properties": {
          "asset": {
            "type": "string"
          },
          "best_bid": {
            "$ref": "#/components/schemas/Top"
          },
          "best_ask": {
            "$ref": "#/components/schemas/Top"
          },
          "mid": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "description": "Halfway between the best bid and ask over every fresh venue.",
                "example": "60431.5"
              },
              {
                "type": "null"
              }
            ]
          },
          "spread": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "description": "Best ask less best bid.",
                "example": "60431.5"
              },
              {
                "type": "null"
              }
            ]
          },
          "spread_bps": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "description": "The spread against the mid, bps.",
                "example": "60431.5"
              },
              {
                "type": "null"
              }
            ]
          },
          "crossed": {
            "type": "boolean",
            "description": "One venue's best bid is at or over another's best ask."
          },
          "bids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MergedLevel"
            },
            "description": "Highest first."
          },
          "asks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MergedLevel"
            },
            "description": "Lowest first."
          },
          "venues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VenueState"
            }
          }
        }
      },
      "Child": {
        "type": "object",
        "description": "One order to send to one venue market.",
        "properties": {
          "venue": {
            "type": "string"
          },
          "venue_name": {
            "type": "string"
          },
          "market": {
            "type": "string"
          },
          "instrument": {
            "type": "string"
          },
          "quote": {
            "type": "string"
          },
          "side": {
            "type": "string",
            "enum": [
              "buy",
              "sell"
            ]
          },
          "size": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "In the venue's contracts, on its size step.",
            "example": "60431.5"
          },
          "limit_price": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "The worst level taken, in the venue's price: an immediate-or-cancel limit here takes exactly these levels if the book has not moved.",
            "example": "60431.5"
          },
          "average_price": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "The expected average, in the venue's price.",
            "example": "60431.5"
          },
          "asset_size": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "The size in units of the asset.",
            "example": "60431.5"
          },
          "notional": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "Dollars filled, before the fee.",
            "example": "60431.5"
          },
          "fee_bps": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "Taker fee used, bps.",
            "example": "60431.5"
          },
          "fee": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "The fee in dollars.",
            "example": "60431.5"
          },
          "levels": {
            "type": "integer"
          }
        }
      },
      "Fill": {
        "type": "object",
        "properties": {
          "filled": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "Units of the asset filled.",
            "example": "60431.5"
          },
          "notional": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "Dollars filled before fees.",
            "example": "60431.5"
          },
          "average_price": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "description": "Per unit, before fees.",
                "example": "60431.5"
              },
              {
                "type": "null"
              }
            ]
          },
          "fees": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "Dollars.",
            "example": "60431.5"
          },
          "total": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "A buy pays this in all; a sell receives it.",
            "example": "60431.5"
          },
          "all_in_price": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "description": "Per unit, after fees.",
                "example": "60431.5"
              },
              {
                "type": "null"
              }
            ]
          },
          "slippage_bps": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "description": "The average before fees against the mid, bps, positive when worse.",
                "example": "60431.5"
              },
              {
                "type": "null"
              }
            ]
          },
          "cost_bps": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "description": "The average after fees against the mid, bps.",
                "example": "60431.5"
              },
              {
                "type": "null"
              }
            ]
          },
          "complete": {
            "type": "boolean",
            "description": "The whole amount filled, to within one size step. False when the order is larger than all visible depth."
          },
          "unfilled": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "What is left, in the order's unit.",
            "example": "60431.5"
          },
          "children": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Child"
            }
          }
        }
      },
      "Quote": {
        "type": "object",
        "properties": {
          "asset": {
            "type": "string"
          },
          "order": {
            "type": "object",
            "properties": {
              "side": {
                "type": "string"
              },
              "amount": {
                "type": "object",
                "description": "{\"size\":\"5\"} or {\"notional\":\"250000\"}."
              }
            }
          },
          "mid": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "description": "Mid over every fresh venue.",
                "example": "60431.5"
              },
              {
                "type": "null"
              }
            ]
          },
          "route": {
            "$ref": "#/components/schemas/Fill"
          },
          "single_venue": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "venue": {
                "type": "string"
              },
              "venue_name": {
                "type": "string"
              },
              "fill": {
                "$ref": "#/components/schemas/Fill"
              }
            },
            "description": "The order on the best single venue. Null when only one venue is fresh."
          },
          "saving": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "amount": {
                "type": "string",
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "description": "Dollars.",
                "example": "60431.5"
              },
              "bps": {
                "type": "string",
                "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
                "description": "Against the single venue's all-in price.",
                "example": "60431.5"
              }
            },
            "description": "Null unless the route and the single venue both fill the whole order."
          },
          "venues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VenueState"
            }
          }
        }
      },
      "QuoteRequest": {
        "type": "object",
        "required": [
          "asset",
          "side"
        ],
        "properties": {
          "asset": {
            "type": "string",
            "example": "BTC"
          },
          "side": {
            "type": "string",
            "enum": [
              "buy",
              "sell"
            ]
          },
          "size": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "Units of the asset. Give size or notional.",
            "example": "5"
          },
          "notional": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "Dollars of fills before fees. Give size or notional.",
            "example": "250000"
          },
          "max_age_ms": {
            "type": "integer",
            "default": 10000,
            "maximum": 60000
          },
          "venues": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "fees": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Your own taker fee per venue, bps, in place of the base rate.",
            "example": {
              "<venue id>": "3.5"
            }
          }
        }
      },
      "Venue": {
        "type": "object",
        "properties": {
          "venue": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "website": {
            "type": [
              "string",
              "null"
            ]
          },
          "collateral": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "taker_bps": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "Base taker fee, bps.",
            "example": "60431.5"
          },
          "maker_bps": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "Base maker fee, bps.",
            "example": "60431.5"
          },
          "fee_tier": {
            "type": "string"
          },
          "fee_source": {
            "type": "string"
          },
          "markets": {
            "type": "integer",
            "description": "Assets it trades that can be routed."
          },
          "listing": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "fresh",
                  "stale",
                  "unavailable"
                ]
              },
              "read_at_ms": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "age_ms": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "error": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "orders": {
            "type": "boolean",
            "description": "POST /v1/orders/prepare and POST /v1/orders work for it."
          },
          "fills": {
            "type": "boolean",
            "description": "The stream can follow an account's fills on it."
          },
          "signing": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "eip712_l1_action",
              "eip712_agent_message",
              "api_key_transaction",
              null
            ]
          },
          "order_account": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The account fields a prepare takes; ? marks an optional one."
          },
          "fills_account": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "address",
              "account_index",
              null
            ]
          },
          "book": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/VenueState"
              },
              {
                "type": "null"
              }
            ],
            "description": "With ?asset=, its book for the asset."
          }
        }
      },
      "ChildOrder": {
        "type": "object",
        "required": [
          "market",
          "side",
          "size",
          "limit_price"
        ],
        "properties": {
          "market": {
            "type": "string"
          },
          "side": {
            "type": "string",
            "enum": [
              "buy",
              "sell"
            ]
          },
          "size": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "Venue contracts.",
            "example": "60431.5"
          },
          "limit_price": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "Venue price.",
            "example": "60431.5"
          }
        }
      },
      "PrepareRequest": {
        "type": "object",
        "required": [
          "venue",
          "orders"
        ],
        "properties": {
          "venue": {
            "type": "string"
          },
          "orders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChildOrder"
            },
            "maxItems": 20,
            "description": "A quote's route.children for this venue."
          },
          "slippage_bps": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
            "description": "Room added to each limit against the trader, 0 to 500.",
            "example": "10"
          },
          "account": {
            "type": "object",
            "description": "The fields GET /v1/venues lists as order_account for the venue: vault_address (optional) for eip712_l1_action; user and signer (the agent that signs) for eip712_agent_message; account_index, api_key_index and nonce (optional, read from the venue when left out) for api_key_transaction."
          }
        }
      },
      "SubmitRequest": {
        "type": "object",
        "required": [
          "venue"
        ],
        "description": "eip712_l1_action: action (the prepared text, unchanged), nonce, vault_address, signature (0x, r, s, v). eip712_agent_message: msg (unchanged), signature. api_key_transaction: tx_type, tx_info (with its Sig).",
        "properties": {
          "venue": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "nonce": {
            "type": "integer"
          },
          "vault_address": {
            "type": [
              "string",
              "null"
            ]
          },
          "signature": {
            "type": "string"
          },
          "msg": {
            "type": "string"
          },
          "tx_type": {
            "type": "integer"
          },
          "tx_info": {
            "type": "string"
          }
        }
      },
      "SubmitResult": {
        "type": "object",
        "properties": {
          "venue": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "description": "The venue's HTTP status."
          },
          "signer": {
            "type": [
              "string",
              "null"
            ],
            "description": "The address the signature recovers to."
          },
          "answer": {
            "description": "The venue's reply as it came."
          }
        }
      }
    }
  },
  "paths": {
    "/v1/health": {
      "get": {
        "summary": "Service health",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/openapi.json": {
      "get": {
        "summary": "This document",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/venues": {
      "get": {
        "summary": "Covered venues, their fees and freshness",
        "parameters": [
          {
            "name": "asset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Adds each venue's book state for this asset."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "asset": {
                      "type": "string"
                    },
                    "venues": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Venue"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/markets": {
      "get": {
        "summary": "Assets and venue markets",
        "description": "Without asset: every asset with the venues that trade it. With asset: that asset's market on each venue, with its rules.",
        "parameters": [
          {
            "name": "asset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "400": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/books/{asset}": {
      "get": {
        "summary": "Merged order book",
        "parameters": [
          {
            "name": "asset",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "BTC"
          },
          {
            "name": "depth",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "group",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "description": "Bucket prices to this step: bids down, asks up.",
              "example": "60431.5"
            },
            "required": false
          },
          {
            "name": "max_age_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 60000,
              "default": 10000
            },
            "description": "A venue whose book is older than this is left out, ms."
          },
          {
            "name": "venues",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Only these venues, comma-separated venue ids."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Book"
                }
              }
            }
          },
          "404": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "400": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/quote": {
      "get": {
        "summary": "Best execution route",
        "parameters": [
          {
            "name": "asset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "side",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "buy",
                "sell"
              ]
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "description": "Units of the asset.",
              "example": "60431.5"
            }
          },
          {
            "name": "notional",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
              "description": "Dollars.",
              "example": "60431.5"
            }
          },
          {
            "name": "fees",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "venue:bps pairs, comma-separated."
          },
          {
            "name": "max_age_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 60000,
              "default": 10000
            },
            "description": "A venue whose book is older than this is left out, ms."
          },
          {
            "name": "venues",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Only these venues, comma-separated venue ids."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Quote"
                }
              }
            }
          },
          "404": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "400": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Best execution route (JSON body)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuoteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Quote"
                }
              }
            }
          },
          "404": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "400": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orders/prepare": {
      "post": {
        "summary": "Unsigned venue orders for a route's children",
        "description": "Answers each venue's own order before it is signed. Your client signs it with its own key and sends it to POST /v1/orders. The service holds no keys.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrepareRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "501": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "400": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orders": {
      "post": {
        "summary": "Pass a signed order to its venue",
        "description": "Checks the signature (it must recover to the signer the order names, where the venue uses one) and posts the order to the venue once. Never retried.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmitRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubmitResult"
                }
              }
            }
          },
          "501": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "400": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/stream": {
      "get": {
        "summary": "WebSocket: merged book and fills",
        "description": "Open as a WebSocket (wss://exec.at.market/v1/stream?asset=BTC&key=...). Every 500 ms: {\"type\":\"book\",\"at_ms\":...,\"book\":Book}. With fills=venue:account,...: {\"type\":\"fills\",\"venue\",\"account\",\"snapshot\",\"fills\":[...]} as the venue publishes them. Send \"ping\" for {\"type\":\"pong\"}. A stream closes after 60 minutes; open a new one. Each stream minute is counted against the key.",
        "parameters": [
          {
            "name": "asset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "depth",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20
            }
          },
          {
            "name": "fills",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Up to 5 venue:account pairs. An account is an address or an account index, as GET /v1/venues lists in fills_account."
          },
          {
            "name": "key",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "The API key, for clients that cannot set headers on a WebSocket. It is not logged."
          }
        ],
        "responses": {
          "101": {
            "description": "Switching protocols"
          },
          "426": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "400": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  }
}