# Rails Trading Developer API Documentation - [Rails Trading Developer API Documentation](https://docs.rails.xyz/index.md) - [Introduction](https://docs.rails.xyz/latest/introduction.md): Welcome to Rails Trading Developer API Documentation - [Get Set Up With Rails](https://docs.rails.xyz/latest/get-set-up-with-rails.md): Quickstart guide for developers to begin using Rails Trading APIs - [Go SDK](https://docs.rails.xyz/latest/go-sdk.md): Install the Go client for the Rails API and make your first request. - [Configuration](https://docs.rails.xyz/latest/go-sdk/configuration.md): Options for the Go SDK clients, client-side pacing, and instrumentation hooks. - [Errors and Retries](https://docs.rails.xyz/latest/go-sdk/errors.md): What a Go SDK error carries, which sentinel says what happened to the request, and what the SDK retries. - [Environments](https://docs.rails.xyz/latest/environments.md): Integration Environments for Market Makers - [Deposit & Withdraw](https://docs.rails.xyz/latest/deposit-withdraw.md): Guide on how to deposit & withdraw funds on Sandbox for testing - [Perpetuals vs Options](https://docs.rails.xyz/latest/perps-vs-options.md): Choosing between Rails Perpetuals and Options - [WebSocket Session](https://docs.rails.xyz/latest/websocket-session.md): Maintain continuity across brief WebSocket disconnections, with automatic backfill of missed order events. - [Navigating the Docs](https://docs.rails.xyz/latest/navigating-the-docs.md): Guide on how to use the API documentation effectively. - [API Keys](https://docs.rails.xyz/latest/api-keys.md): Guide on How to Set up Your API Keys - [API Authorization](https://docs.rails.xyz/latest/authorization.md): Understanding API authorization - [Get Access Token](https://docs.rails.xyz/latest/get-access-token.md): This endpoint generates an access token for the HTTP and WebSocket APIs. - [Changelog](https://docs.rails.xyz/latest/changelog.md): Keep track of changes and upgrades to the Rails API - [Error Reference](https://docs.rails.xyz/latest/error-reference/error-code.md): Every error a Rails API returns carries a code and a slug. Branch on the code; the message is for people. - [Overview](https://docs.rails.xyz/latest/perps/guides/overview.md): Trading perpetuals on Rails - [Market Data](https://docs.rails.xyz/latest/perps/guides/market-data.md): Understanding market specific data - [Order Book](https://docs.rails.xyz/latest/perps/guides/order-book.md): Maintaining a local order book - [Order Creation](https://docs.rails.xyz/latest/perps/guides/order-creation.md): Understanding order types and creation workflows - [Order Modification](https://docs.rails.xyz/latest/perps/guides/order-modification.md): Understanding order modification workflows - [Order Cancellation](https://docs.rails.xyz/latest/perps/guides/order-cancellation.md): Understanding order cancellation strategies and best practices - [Open Orders](https://docs.rails.xyz/latest/perps/guides/open-orders.md): Understanding and managing open orders - [Account Information](https://docs.rails.xyz/latest/perps/guides/account-info.md): Checking Your Account Information - [Recent Trades](https://docs.rails.xyz/latest/perps/guides/recent-trades.md): Getting recent trade executions on a market - [Risk Management](https://docs.rails.xyz/latest/perps/guides/risk-management.md): How Rails protects accounts through liquidation and proactive order cancellation. - [Rate Limits](https://docs.rails.xyz/latest/perps/guides/rate-limits.md): API Rate Limits and Usage Policies - [Error Codes](https://docs.rails.xyz/latest/perps/guides/error-codes.md): Error codes returned by the Perpetuals order, margin and leverage routes. - [FAQs](https://docs.rails.xyz/latest/perps/guides/faqs.md): Frequently asked questions about the Rails API - [Mark Price](https://docs.rails.xyz/latest/perps/formulas/mark-price.md) - [Position Metrics, Margin & Liquidation Price](https://docs.rails.xyz/latest/perps/formulas/position-metrics.md) - [Account Equity & Balances](https://docs.rails.xyz/latest/perps/formulas/account-balance.md) - [Funding](https://docs.rails.xyz/latest/perps/formulas/funding.md) - [Quickstart](https://docs.rails.xyz/latest/perps/go-sdk/quickstart.md): Place and cancel your first perpetuals order with the Go SDK. - [Orders](https://docs.rails.xyz/latest/perps/go-sdk/orders.md): Place, modify, and cancel perpetuals orders with the Go SDK, recover from a command that got no answer, and pace your requests. - [Streams & Account](https://docs.rails.xyz/latest/perps/go-sdk/streams-and-account.md): Read your perpetuals account, follow fills and market data, and keep a local order book with the Go SDK. - [Overview](https://docs.rails.xyz/latest/perps/websocket-api/overview.md): Real-time market data, order updates, and execution events for Rails Perpetuals. - [Common Requests](https://docs.rails.xyz/latest/perps/websocket-api/common-requests.md): Available on every connection: ping, subscribe, and unsubscribe, plus the connection shutdown notice. - [Order Creation Stream](https://docs.rails.xyz/latest/perps/websocket-api/order-creation-stream.md): Create, modify, and cancel orders, update isolated margin, and receive fill/rejection notifications. - [Account Trades Stream](https://docs.rails.xyz/latest/perps/websocket-api/account-trades-stream.md): Real-time trade updates for your account, across all markets. - [Public Trades Stream](https://docs.rails.xyz/latest/perps/websocket-api/public-trades-stream.md): Real-time trade updates and snapshots for a specific market. - [Order Book Stream](https://docs.rails.xyz/latest/perps/websocket-api/order-book-stream.md): Real-time order book updates and snapshots for a specific market. - [Get Order Book](https://docs.rails.xyz/latest/perps/rest-api/get-order-book.md): This endpoint retrieves the latest order book snapshot for a given market, including a snapshot timestamp. - [Get Market Data](https://docs.rails.xyz/latest/perps/rest-api/get-market-data.md): This endpoint retrieves market data for a given list of markets. - [Get Supported Markets](https://docs.rails.xyz/latest/perps/rest-api/get-supported-markets.md): This endpoint retrieves all the supported markets by our exchange. - [Get Product Specifications](https://docs.rails.xyz/latest/perps/rest-api/get-product-specifications.md): This endpoint retrieves product specifications. - [Get Contract Specifications](https://docs.rails.xyz/latest/perps/rest-api/get-contract-specifications.md): This endpoint retrieves perpetual contract specifications. - [Update Margin Mode](https://docs.rails.xyz/latest/perps/rest-api/update-margin-mode.md): This endpoint updates the margin mode for a given market. - [Update Leverage](https://docs.rails.xyz/latest/perps/rest-api/update-leverage.md): This endpoint updates the leverage for a given market. - [Get Order By ID](https://docs.rails.xyz/latest/perps/rest-api/get-order-by-id.md): This endpoint retrieves a single open or recently closed order by order ID or client request ID. - [Get Open Orders](https://docs.rails.xyz/latest/perps/rest-api/get-open-orders.md): This endpoint retrieves the open orders of your account, optionally filtered by market. - [Get Completed Orders](https://docs.rails.xyz/latest/perps/rest-api/get-completed-orders.md): This endpoint retrieves the completed orders (fills) of your account across all markets. - [Cancel Orders](https://docs.rails.xyz/latest/perps/rest-api/cancel-orders.md): This endpoint cancels orders by market or across all markets. - [Get Account Balances](https://docs.rails.xyz/latest/perps/rest-api/get-account-balances.md): This endpoint retrieves the account balances. - [Get Account Positions](https://docs.rails.xyz/latest/perps/rest-api/get-account-positions.md): This endpoint retrieves the account positions by market. - [Get Account Fundings](https://docs.rails.xyz/latest/perps/rest-api/get-account-fundings.md): This endpoint retrieves the account fundings. - [Get Account Deposits](https://docs.rails.xyz/latest/perps/rest-api/get-account-deposits.md): This endpoint retrieves the account deposits. - [Get Account Withdrawals](https://docs.rails.xyz/latest/perps/rest-api/get-account-withdrawals.md): This endpoint retrieves the account withdrawals. - [Overview](https://docs.rails.xyz/latest/options/guides/overview.md): Trading options on Rails - [Instruments & Symbols](https://docs.rails.xyz/latest/options/guides/instruments-and-symbols.md): How contracts are named and identified - [Market Data](https://docs.rails.xyz/latest/options/guides/market-data.md): Contracts, quotes, order books, and trades - [Pricing & Greeks](https://docs.rails.xyz/latest/options/guides/pricing-and-greeks.md): How prices, implied volatility, and Greeks work - [Order Lifecycle](https://docs.rails.xyz/latest/options/guides/order-lifecycle.md): Order types, flags, and the lifecycle of an order - [Positions & Account](https://docs.rails.xyz/latest/options/guides/positions-and-account.md): Tracking positions, balances, and PnL - [Margin & Liquidation](https://docs.rails.xyz/latest/options/guides/margin-and-liquidation.md): How margin works for long and short positions, and how liquidation works - [Settlement & Expiry](https://docs.rails.xyz/latest/options/guides/settlement-and-expiry.md): How contracts expire and settle in cash - [Rate Limits](https://docs.rails.xyz/latest/options/guides/rate-limits.md): API Rate Limits and Usage Policies - [Error Codes](https://docs.rails.xyz/latest/options/guides/error-codes.md): Error codes returned by the Options order routes. - [FAQs](https://docs.rails.xyz/latest/options/guides/faqs.md): Frequently asked questions about Rails Options - [Pricing & Greeks](https://docs.rails.xyz/latest/options/formulas/pricing-and-greeks.md) - [Margin & Fees](https://docs.rails.xyz/latest/options/formulas/margin-and-fees.md) - [Position Metrics](https://docs.rails.xyz/latest/options/formulas/position-metrics.md) - [Account Equity & Balances](https://docs.rails.xyz/latest/options/formulas/account-balance.md) - [Settlement](https://docs.rails.xyz/latest/options/formulas/settlement.md) - [Quickstart](https://docs.rails.xyz/latest/options/go-sdk/quickstart.md): Find an options contract and place and cancel your first order on it with the Go SDK. - [Orders](https://docs.rails.xyz/latest/options/go-sdk/orders.md): Place, modify, and cancel options orders with the Go SDK, sweep a contract with a cancel-all, and pace your requests. - [Streams & Account](https://docs.rails.xyz/latest/options/go-sdk/streams-and-account.md): Read your options account, and follow quotes, Greeks, positions, and open orders with the Go SDK. - [Overview](https://docs.rails.xyz/latest/options/websocket-api/overview.md): Real-time contracts, quotes, order books, trades, positions, account state, and order management for Rails Options. - [Common Requests](https://docs.rails.xyz/latest/options/websocket-api/common-requests.md): Available on every connection: ping, subscribe, and unsubscribe, plus the connection shutdown notice. - [Order Management Stream](https://docs.rails.xyz/latest/options/websocket-api/order-management-stream.md): Create, modify, cancel, and cancel all orders, with fill and liquidation notifications. - [Contracts Stream](https://docs.rails.xyz/latest/options/websocket-api/contracts-stream.md): Contract definitions with live mark price, IV, and Greeks. - [Quotes Stream](https://docs.rails.xyz/latest/options/websocket-api/quotes-stream.md): Top-of-book bid/ask prices with implied volatility per contract. - [Order Book Stream](https://docs.rails.xyz/latest/options/websocket-api/order-book-stream.md): Full order book snapshots and deltas for a contract. - [Public Trades Stream](https://docs.rails.xyz/latest/options/websocket-api/public-trades-stream.md): Real-time public trade executions for a contract. - [Positions Stream](https://docs.rails.xyz/latest/options/websocket-api/positions-stream.md): Open positions with mark price, margin, and PnL. - [Open Orders Stream](https://docs.rails.xyz/latest/options/websocket-api/open-orders-stream.md): Your open orders and incremental updates. - [Recent Orders Stream](https://docs.rails.xyz/latest/options/websocket-api/recent-orders-stream.md): Recent order history. - [Account Summary Stream](https://docs.rails.xyz/latest/options/websocket-api/account-summary-stream.md): Balance, margin used, and PnL. - [Settlements Stream](https://docs.rails.xyz/latest/options/websocket-api/settlements-stream.md): Settlement results at expiry. - [Get Expirations](https://docs.rails.xyz/latest/options/rest-api/get-expirations.md): List available expiration dates for a market. - [Get Contracts](https://docs.rails.xyz/latest/options/rest-api/get-contracts.md): List the contracts for a market and expiration date. - [Create Order](https://docs.rails.xyz/latest/options/rest-api/create-order.md): Submit a new order. - [Modify Order](https://docs.rails.xyz/latest/options/rest-api/modify-order.md): Change the price and quantity of an open order. - [Cancel Order](https://docs.rails.xyz/latest/options/rest-api/cancel-order.md): Cancel an open order. - [Cancel All Orders](https://docs.rails.xyz/latest/options/rest-api/cancel-all-orders.md): Queue a cancel for every open order, or every open order in one contract. - [Get Open Orders](https://docs.rails.xyz/latest/options/rest-api/get-open-orders.md): Retrieve your resting orders. - [Get Order Status](https://docs.rails.xyz/latest/options/rest-api/get-order-status.md): Retrieve the current state of an order. - [Get Account Summary](https://docs.rails.xyz/latest/options/rest-api/get-account-summary.md): Retrieve account balance, margin usage, and PnL. - [Get Positions](https://docs.rails.xyz/latest/options/rest-api/get-account-positions.md): Retrieve your open positions. - [Get Recent Orders](https://docs.rails.xyz/latest/options/rest-api/get-account-orders.md): Retrieve your recent filled and cancelled orders. - [Get Account Deposits](https://docs.rails.xyz/latest/options/rest-api/get-account-deposits.md): This endpoint retrieves the account deposits. - [Get Account Withdrawals](https://docs.rails.xyz/latest/options/rest-api/get-account-withdrawals.md): This endpoint retrieves the account withdrawals. ## OpenAPI Specs - [auth](/latest/openapi/auth.json) - [matching](/latest/options/openapi/matching.json) - [options](/latest/options/openapi/options.json) - [account](/latest/perps/openapi/account.json) - [market](/latest/perps/openapi/market.json) - [order](/latest/perps/openapi/order.json) ## AsyncAPI Specs - [test](/latest/asyncapi/test.json) - [options-ws](/latest/options/asyncapi/options-ws.yaml) - [perps-ws](/latest/perps/asyncapi/perps-ws.yaml) - [test-authenticated-stream](/latest/perps/asyncapi/test-authenticated-stream.yaml) - [test-public-stream](/latest/perps/asyncapi/test-public-stream.yaml) This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.