Prime FIX Messages
The baseline specification for this API is FIX 4.2. Below, we’ve noted the places in which the FIX API for Coinbase Prime extends (or clarifies) the FIX spec. For example, there are custom tags with a four-digit number range, as allowed by the standard, which are unique to Prime.
A standard header must be present at the start of every message in both directions. You should configure your sessions so that
SenderCompID
= the Service Account ID associated with the API key as yourSenderCompID
TargetCompID
= the stringCOIN
This is typically accomplished via your FIX client’s configuration file.
A Service Account ID is a unique ID generated when you create an API Key. You can find it to the right of your API Key in Settings.
Tag | Name | Description |
---|---|---|
8 | BeginString | Must be FIX.4.2 |
49 | SenderCompID | The Service Account ID (on messages from the client) |
56 | TargetCompID | Must be COIN (on messages from the client) |
Logon (A)
Sent by the client to initiate a session and by the server as an acknowledgement. Only one session can exist per connection — sending a Logon message within an established session results in an error.
The Logon message sent by the client must be signed for security. The prehash string has the following fields, each joined by the empty string:
{timestamp}A{seqNum}{apiKey}{targetComp}{passphrase}
.
There is no trailing separator. The RawData field should be a base64
encoding of the HMAC signature.
To establish multiple FIX connections, you must generate a new API key for each one. All messages must have a SendingTime
value within 5 seconds of server time in UTC or they are rejected.
Contact primeops@coinbase.com to create an API key for accessing multiple portfolios in a single fix connection.
Only one session can exist per connection (or API key) at a time.
Tag | Name | Description |
---|---|---|
96 | RawData | Client message signature (see below) |
554 | Password | Client API passphrase |
9406 | DropCopyFlag | If set to Y, execution reports are generated for all user orders (defaults to Y), if set to N execution reports are only generated for orders from the FIX session |
9407 | Access Key | Client API key |
Python Example
JavaScript Example
New Order Single (D)
Sent by the client to enter an order. Not every tag is required for every order — it depends on the target strategy used. See the table below for more information.
Tag | Name | Description | Notes |
---|---|---|---|
1 | Account | The portfolio ID | |
11 | ClOrdID | A string selected by client to identify the order | |
38 | OrderQty | Order size in base units (e.g., BTC). Either this or CashOrderQty must be supplied. | |
40 | OrdType | Order type. Must match TargetStrategy | See OrdType Values table |
44 | Px | Indicates the price of the order | Required for Limit and TWAP orders |
54 | Side | Must be 1 to buy or 2 to sell | |
55 | Symbol | The product to be traded (e.g., BTC-USD ) | |
59 | TimeInForce | A valid TimeInForce value; see the table below for a list. | Must match TargetStrategy |
99 | StopPx | Stop price for Stop Limit order | Specifies the stop price at which the order activates. The order is activated if the last trade price on Coinbase Exchange crosses the stop price specified on the order. |
126 | ExpireTime | Represents the time and date of order expiration | Required for TWAP/VWAP orders and Limit GTD orders, unless ParticipationRate is specified (TWAP/VWAP only) |
152 | CashOrderQty | Order size in quote units (e.g., USD) | Either this or OrderQty must be supplied. |
168 | EffectiveTime | Represents the start time | Required for TWAP/VWAP orders |
210 | MaxShow | Maximum quantity within an order to be shown to other customers (Display Size) | Only available for LIMIT orders |
847 | TargetStrategy | The target strategy of the order to place; see the table below for a list. | Requires ExpireTime and EffectiveTime for TWAP/VWAP orders. Must be SL and requires StopPx for Stop Limit orders. |
849 | ParticipationRate | Represents the estimated percent of volume for TWAP/VWAP order types. | Can be used instead of ExpireTime which it computes based on historical participation of volume rate. |
8999 | IsRaiseExact | Y or N, is this a raise exact order. If Y, the asset amount sold is adjusted so the total received after fees equals the input size. | Optional, defaults to N. Supported for SELL, Size In Quote orders only. |
TargetStrategy Values
Requires ExpireTime
and EffectiveTime
for TWAP/VWAP orders. Must be “SL” and requires StopPx for Stop Limit orders.
Value | Description | OrdType | TimeInForce |
---|---|---|---|
L | Limit order | Must be 2 (Limit) |
|
M | Market order | Must be 1 (Market) | Must be 3 (IOC) |
T | TWAP order | Must be 2 (Limit) | Must be 6 (GTD); 44 (price) must also be provided |
V | VWAP order | Must be 2 (Limit) | Must be 6 (GTD); 44 (price) must also be provided |
SL | Stop Limit order | Must be 2 (Limit) | Must be 1 (GTC) or 6 (GTD); 44 (price) and 99 (StopPx) must also be provided |
OrdType Values
Value | Description |
---|---|
1 | Market |
2 | Limit |
D | Previously Quoted |
TimeInForce Values
Must match TargetStrategy
Value | Description |
---|---|
1 | Good Till Cancel (GTC) |
3 | Immediate or Cancel (IOC) |
4 | Fill or Kill (FOK) |
6 | Good Till Date (GTD) |
RFQ
Quote Request (R)
A Quote Request (R) is the start of the RFQ process. Coinbase Prime sends a Quote Request to Liquidity Providers (LPs) on behalf of a customer looking to participate in an RFQ trade. LPs respond to a Quote Request (R) with a Quote (S).
Tag | Name | Description |
---|---|---|
131 | QuoteReqID | A string selected by client to identify the quote |
1 | Account | The portfolio id |
54 | Side | Must be 1 to buy and 2 to sell |
55 | Symbol | A product pair (e.g. BTC-USD ) |
38 | OrderQty | Order size in base units (e.g. BTC ) |
40 | OrdType | Order type. Must be 2 (i.e. Limit) |
44 | Price | Indicates the limit price of the quote |
59 | TimeInForce | Time in force for the order. Must be 4 (i.e. FOK) |
Quote (S)
Quote (S) messages are submitted by Liquidity Providers (LP) in response to a Quote Request (R) in order to participate in the competitive RFQ auction.
Tag | Name | Description |
---|---|---|
117 | QuoteID | A Coinbase generated identifier for the quote |
131 | QuoteReqID | A string selected by client to identify the quote |
1 | Account | The portfolio id |
55 | Symbol | The product pair from Quote Request <R> |
132 | BidPx | Quoted price. Only present in case of Sells |
133 | OfferPx | Quoted price. Only present in case of Buys |
134 | BidSize | Quoted size. Only present in case of Sells |
135 | OfferSize | Quoted size. Only present in case of Buys |
40 | OrdType | Order type. Must be 2 (i.e. Limit) |
62 | ValidUntilTime | Indicates expiration time of the quote (always expressed in UTC) |
Accept quote - New Order Single (D)
Sent by the client in order to accept a Quote (S). Must be accepted before expiration time indicated on Tag 62 of Quote (S). Refer to New Order Single (D) for standard fields of submitting an order.
Tag | Name | Description |
---|---|---|
[…] | […] | Standard fields for NewOrderSingle <D> |
117 | QuoteID | The quote id on tag 117 from Quote <S> |
40 | OrdType | Should be D (i.e. Previously Quoted) |
847 | TargetStrategy | Should be R (i.e. RFQ, coinbase’s custom value) |
59 | TimeInForce | Should be 4 (i.e. FOK) |
44 | Price | The price on tag 132/133 from Quote <S> |
Quote Acknowledgment (b)
Sent by the server in case the Quote Requests (R) fails.
Tag | Name | Description |
---|---|---|
117 | QuoteID | A Coinbase generated identifier for the quote (optional) |
131 | QuoteReqID | A string selected by client to identify the quote |
1 | Account | The portfolio id |
55 | Symbol | The product pair from Quote Request <R> |
297 | QuoteAckStatus | Will be always 5 (i.e. Rejected) |
300 | QuoteRejectReason | See QuoteRejectReason table |
58 | Text | Human-readable description of the error |
QuoteRejectReason
Possible values for QuoteRejectReason (see Quote Acknowledgment (b)).
Value | Description |
---|---|
1 | Unknown symbol |
2 | Exchange closed |
3 | Quote Request exceeds limit |
6 | Duplicate Quote |
8 | Invalid price |
99 | Other |
Order Cancel Request (F)
Sent by the client to cancel an order.
Tag | Name | Description | Notes |
---|---|---|---|
1 | Account | The portfolio ID | |
11 | ClOrdId | ClOrdId identifying this cancel request | |
37 | OrderID | OrderID assigned by Coinbase (available in any of the Execution Report messages) | |
38 | OrderQty | Accepted order quantity | You must supply this tag or CashOrderQty (depending on whichever you originally submitted) |
41 | OrigClOrdID | ClOrdID from the New Order Single | You must also supply an OrderID |
54 | Side | Must be 1 to buy or 2 to sell (depending on whichever you originally submitted) | |
55 | Symbol | The product from the original order (e.g., BTC-USD ) | |
152 | CashOrderQty | Order size in quote units (e.g., USD ) | You must supply this tag or OrderQty (depending on which you submitted) |
Order Status Request (H)
Sent by the client to obtain information about pending and completed orders.
Tag | Name | Description | Notes |
---|---|---|---|
11 | ClOrdID | ClOrdID of the order to be sent back | |
37 | OrderID | OrderID of the order to be sent back | Required |
54 | Side | Must be 1 to buy or 2 to sell | |
55 | Symbol | The product to be traded (e.g., BTC-USD) |
Python Example
FIX Message Request: (35=H)
FIX Message Response:
Execution Report (8)
Sent by the server when an order is accepted, rejected, filled, or canceled. Also sent when the user sends an OrderStatusRequest
.
Tag | Name | Description | Notes |
---|---|---|---|
1 | Account | The portfolio ID of the associated order | Especially pertinent if using an Org or Entity level API key |
6 | AvgPx | The average price of the order | |
11 | ClOrdID | ClOrdID of order to be sent back | |
14 | CumQty | Total amount filled on this order | |
17 | ExecID | Unique ID for fill | |
30 | LastMkt | Market of execution for last fill | |
31 | LastPx | Price of the fill if ExecType indicates a fill | |
32 | LastShares | Amount filled (if ExecType=1). Also called LastQty as of FIX 4.3 | |
37 | OrderID | OrderID from the ExecutionReport | |
38 | OrderQty | OrderQty as accepted | You must supply this tag or CashOrderQty (depending on whichever you originally submitted) |
39 | OrdStatus | Order status as of the current message | |
40 | OrdType | Order Type | 1 = Market2 = Limit3 = Stop 4 = Stop Limit |
44 | Price | Limit Price | |
50 | SenderSubID | ID of the user that initiated the request (e.g. submitted the NOS) | |
54 | Side | Must be 1 to buy or 2 to sell | |
55 | Symbol | Symbol of the original order | |
58 | Text | Human-readable description of error | UserContext populated if not null |
103 | OrdRejReason | Order Reject Reason | See OrdRejReason Values table |
13 | CommType | The Commission type | Always Absolute (3) |
12 | Commission | The Coinbase Commission incurred for this fill in quote currency | |
136 | NoMiscFees | Number of repeating groups of miscellaneous fees if any | Only included if there are fees other than the Coinbase fee |
137 | MiscFeeAmt | Miscellaneous fee value | |
138 | MiscFeeCurr | Currency of miscellaneous fee in quote currency symbol | |
139 | MiscFeeType | Indicates type of miscellaneous fee | See MiscFeeType Values table |
150 | ExecType | Describes the type of Execution Report (8) | See ExecType Values table |
151 | LeavesQty | Amount of order remaining | |
152 | CashOrderQty | Order size in quote units (e.g., USD) | You must supply this tag or OrderQty (depending on whichever you originally submitted) |
168 | EffectiveTime | StartTime for a TWAP or VWAP | |
8006 | NetAvgPrice | Filled quote size with commission divided by the filled base size |
OrdRejReason Values
OrdRejReason | Description |
---|---|
0 | Broker option |
1 | Unknown symbol |
2 | Exchange closed |
3 | Order exceeds limit |
4 | Too late to enter |
5 | Unknown Order |
6 | Duplicate Order |
99 | Other |
MiscFeeType Values
MiscFeeType | Description |
---|---|
1 | Financing fee |
2 | Client commission |
3 | CES commission |
4 | Venue fee (Cost plus pricing only; Only appears for non-zero fees) |
ExecType Values
ExecType | Description |
---|---|
0 | New Order |
1 | Partial Fill |
2 | Filled |
3 | Done |
4 | Canceled |
6 | Pending Cancel |
7 | Stopped |
8 | Rejected |
D | Restated |
A | Pending New |
I | Order Status |
Order Cancel Reject (9)
Sent by the server when an Order Cancel Request cannot be satisfied, e.g., because the order is already canceled or completely filled.
Tag | Name | Description |
---|---|---|
11 | ClOrdID | The same value provided by the original cancel request |
37 | OrderID | The same value provided by the original cancel request |
39 | OrdStatus | The order status; see the table below for a list. |
41 | OrigClOrdID | The same value provided by the original cancel request |
102 | CxlRejReason | The reason the order was rejected |
434 | CxlRejResponseTo | The rejection response; see the table below for a list |
OrdStatus Values
Valid Values | Description |
---|---|
0 | New |
1 | Partially filled |
2 | Filled |
3 | Done for day |
4 | Canceled |
5 | Replaced |
6 | Pending Cancel (e.g., result of Order Cancel Request <F> ) |
7 | Stopped |
8 | Rejected |
9 | Suspended |
A | Pending New |
B | Calculated |
C | Expired |
D | Accepted for bidding |
E | Pending Replace (e.g., result of Order Cancel/Replace Request <G> ) |
CxlRejResponseTo Values
Valid Values | Description |
---|---|
1 | Order Cancel Request <F> |
2 | Order Cancel/Replace Request <G> |
Reject (3)
Sent by either side upon receipt of a message which cannot be processed, e.g., due to missing fields or an unsupported message type.
Tag | Name | Description |
---|---|---|
45 | RefSeqNum | MsgSeqNum of the rejected incoming message |
58 | Text | Human-readable description of the error (optional) |
371 | RefTagID | Tag number of the field which caused the reject (optional) |
372 | RefMsgType | MsgType of the rejected incoming message |
373 | SessionRejectReason | Code to identify reason for the reject (for session-level rejections only) |