{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://coinbase.com/schemas/coinbase/order.json", "title": "Coinbase Order", "description": "A trading order on the Coinbase platform, applicable across Advanced Trade, Exchange, and Prime APIs. Represents a request to buy or sell a cryptocurrency at a specified price and quantity.", "type": "object", "required": ["product_id", "side", "order_type"], "properties": { "order_id": { "type": "string", "description": "Unique identifier for the order assigned by Coinbase" }, "client_order_id": { "type": "string", "description": "Client-specified unique identifier for the order" }, "product_id": { "type": "string", "description": "Trading pair identifier such as BTC-USD", "pattern": "^[A-Z0-9]+-[A-Z0-9]+$" }, "side": { "type": "string", "description": "Whether this is a buy or sell order", "enum": ["BUY", "SELL"] }, "order_type": { "type": "string", "description": "Type of order determining execution behavior", "enum": ["MARKET", "LIMIT", "STOP", "STOP_LIMIT", "TWAP", "BLOCK"] }, "status": { "type": "string", "description": "Current lifecycle status of the order", "enum": ["OPEN", "PENDING", "FILLED", "CANCELLED", "EXPIRED", "FAILED"] }, "time_in_force": { "type": "string", "description": "Time-in-force policy governing how long the order remains active", "enum": ["GOOD_UNTIL_CANCELLED", "GOOD_UNTIL_DATE", "IMMEDIATE_OR_CANCEL", "FILL_OR_KILL"] }, "base_size": { "type": "string", "description": "Quantity of base currency to trade", "pattern": "^[0-9]+(\\.[0-9]+)?$" }, "quote_size": { "type": "string", "description": "Quantity of quote currency to spend or receive", "pattern": "^[0-9]+(\\.[0-9]+)?$" }, "limit_price": { "type": "string", "description": "Limit price for limit and stop-limit orders", "pattern": "^[0-9]+(\\.[0-9]+)?$" }, "stop_price": { "type": "string", "description": "Trigger price for stop and stop-limit orders", "pattern": "^[0-9]+(\\.[0-9]+)?$" }, "filled_size": { "type": "string", "description": "Amount that has been filled so far", "pattern": "^[0-9]+(\\.[0-9]+)?$" }, "filled_value": { "type": "string", "description": "Total value of filled portion in quote currency", "pattern": "^[0-9]+(\\.[0-9]+)?$" }, "average_filled_price": { "type": "string", "description": "Volume-weighted average price of fills", "pattern": "^[0-9]+(\\.[0-9]+)?$" }, "total_fees": { "type": "string", "description": "Total fees charged for the order", "pattern": "^[0-9]+(\\.[0-9]+)?$" }, "number_of_fills": { "type": "integer", "description": "Number of individual fills for the order", "minimum": 0 }, "completion_percentage": { "type": "string", "description": "Percentage of the order that has been filled", "pattern": "^[0-9]+(\\.[0-9]+)?$" }, "portfolio_id": { "type": "string", "description": "Portfolio that owns the order (Prime and Advanced Trade)" }, "created_at": { "type": "string", "format": "date-time", "description": "ISO 8601 timestamp when the order was created" }, "completed_at": { "type": "string", "format": "date-time", "description": "ISO 8601 timestamp when the order was completed" }, "expiry_time": { "type": "string", "format": "date-time", "description": "ISO 8601 timestamp when the order expires" }, "post_only": { "type": "boolean", "description": "Whether the order is post-only (maker only)" } }, "$defs": { "Fill": { "type": "object", "description": "An individual fill representing partial or full execution of an order", "required": ["trade_id", "price", "size"], "properties": { "trade_id": { "type": "string", "description": "Unique trade identifier" }, "entry_id": { "type": "string", "description": "Unique fill entry identifier" }, "order_id": { "type": "string", "description": "Order that generated this fill" }, "product_id": { "type": "string", "description": "Product traded" }, "price": { "type": "string", "description": "Execution price" }, "size": { "type": "string", "description": "Fill size" }, "commission": { "type": "string", "description": "Fee charged for this fill" }, "side": { "type": "string", "description": "Trade side", "enum": ["BUY", "SELL"] }, "liquidity": { "type": "string", "description": "Whether the fill was maker or taker", "enum": ["M", "T"] }, "trade_time": { "type": "string", "format": "date-time", "description": "When the trade occurred" } } } } }