GuidesAPI Reference
DocumentationLog In

FIX API

FIX (Financial Information eXchange) is a standard protocol which can be used to enter orders, submit cancel requests, and receive fills. Users of the FIX API will typically have existing software using FIX for order management. Users who are not familiar with FIX should first consider using the REST API.

📘

FIX API Endpoint URL

tcp+ssl://fix.prime.coinbase.com:4198

Resend requests are not supported in the beta version of the FIX API, although support for this feature is forthcoming. Presently, every connection establishes a new session and a new set of session sequence numbers.

Connectivity

Before logging onto a FIX session, clients must establish a secure connection to the FIX gateway (fix.prime.coinbase.com:4198). If your FIX implementation does not support establishing a TCP SSL connection natively, you will need to setup a local proxy such as stunnel to establish a secure connection to the FIX gateway. See the SSL Tunnels section for more details and examples.

📘

Sessions are forcibly logged out every day between 5pm ET and 5:05pm ET for a maintenance window. All users are required to restart their sessions during this time and reset sequence numbers to 0.

Rate Limiting

During the beta period, requests are limited to 50 calls per second.

Messages

The baseline specification for this API is FIX 4.2. We've made note below the places in which the FIX API for Coinbase Prime extends (or clarifies) the FIX spec. For example, there are custom tags in 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 to use the service account ID associated with the API key as your SenderCompID and the string "COIN" as the TargetCompID. This is typically accomplished via your FIX client's configuration file.

TagNameDescription
8BeginStringMust be FIX.4.2
49SenderCompIDService Account ID (on messages from the client)
56TargetCompIDMust be COIN (on messages from the client)

Logon (A)

// create a new Logon message
var logon = new Msgs.Logon();
logon.SendingTime = new Date();
logon.passphrase = '...';

var presign = [
 logon.SendingTime,
 logon.MsgType,
 session.outgoing_seq_num,
 apiKey,
 session.target_comp_id,
 passphrase
].join('');

// add the presign string to the RawData field of the Logon message
logon.RawData = sign(presign, secret);

// send the logon message to the server
session.send(logon);

function sign(what, secret) {
 var key = Buffer(secret, 'base64');
 var hmac = crypto.createHmac('sha256', key);
 return hmac.update(what).digest('base64');
}

Sent by the client to initiate a session, and by the server as an acknowledgement. Only one session may exist per API key; sending a Logon message within an established session, or while the first session is still running, results in an error.

TagNameDescription
554PasswordClient API passphrase
96RawDataClient message signature (see below)
9407Access KeyClient API key
1AccountPortfolio ID associated with this API key

The Logon message sent by the client must be signed for security. The prehash string is the following fields 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.

A single API key must not be used in multiple connections at the same time. To establish multiple FIX connections, please 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 will be rejected.

New Order Single (D)

Sent by the client to enter an order. Each profile can place a maximum of 500 open orders on a product. Once reached, the profile will not be able to place any new orders until the total number of open orders is below 500.

Note that not every tag is required for every order; the requiredness for individual tags is dependent on the target strategy used. See the table below for more information.

TagNameDescriptionNotes
1AccountThe portfolio ID
152CashOrderQtyOrder size in quote units (e.g. USD)Either this or OrderQty must be supplied.
11ClOrdIDA string selected by client to identify the order
126ExpireTimeIndicates the time and date of order expirationRequired for TWAP orders and Limit GTD orders
38OrderQtyOrder size in base units (e.g. BTC). Either this or CashOrderQty must be supplied.
40OrderTypeThe order type; see the table below for a list.
44PxIndicates the price of the orderRequired for Limit, TWAP, and SOR orders
54SideMust be 1 to buy or 2 to sell
168EffectiveTimeIndicates the start timeRequired for TWAP orders
847TargetStrategyThe target strategy of the order to place; see the table below for a list.
55SymbolThe product to be traded (e.g. BTC-USD)
59TimeInForceA valid TimeInForce value; see the table below for a list.

TargetStrategy Values

ValueDescriptionOrderTypeTimeInForce
LLimit orderMust be 2 (Limit)Must be 1 (GTC) or 6 (GTD); 44 (price) must also be provided
MMarket orderMust be 1 (Market)Must be 3 (IOC)
TTWAP orderMust be 2 (Limit)Must be 6 (GTD); 44 (price) must also be provided
SSOR orderMust be 1 (Market)Must be 3 (IOC); 44 (price) must also be provided

OrderType Values

ValueDescription
1Market
2Limit

TimeInForce Values

ValueDescription
1Good Till Cancel (GTC)
3Immediate or Cancel (IOC)
6Good Till Date (GTD)

Order Cancel Request (F)

Sent by the client to cancel an order.

TagNameDescriptionNotes
1AccountThe portfolio ID
37OrderIDOrderID assigned by Coinbase (available in any of the Execution Report messages)
41OrigClOrdIDClOrdID from the New Order Single.You will also need to supply an OrderID.
11ClOrdIdClOrdId identifying this cancel request
54SideMust be 1 to buy or 2 to sell (depending on whichever you originally submitted)
55SymbolThe product from the original order (e.g. BTC-USD)
38OrderQtyAccepted order quantity.Either this or CashOrderQty must be supplied (depending on whichever you originally submitted)
152CashOrderQtyOrder size in quote units (e.g. USD).Either this or OrderQty must be supplied (depending on which you submitted)

Order Status Request (H)

->
   MsgType=H
   OrderID=3f8b09f2-3b25-4bf3-90be-330f7d68aee3

<-
   MsgType=8
   ClOrdID=3dce15be-3ad8-4cc9-85b6-55ec34c49069
   OrderID=3f8b09f2-3b25-4bf3-90be-330f7d68aee3
   Symbol=GNT-USDC
   CumQty=0.00000000
   Side=1
   Price=0.01000000
   ExecID=ece88c19-4aaa-404f-a525-2977f26664e7
   ExecTransType=3
   OrderQty=1.00000000
   OrdStatus=0
   OrdType=2
   SenderCompID=Coinbase
   SendingTime=20200710-14:48:23.577
   TargetCompID=1e709a798e12f5a1a92e88852087d2g6
   TransactTime=20200710-14:47:11.379
   Commission=12
   ExecType=I

   Note: the Tags in this example have been replaced with Name for readability

Sent by the client to obtain information about pending and completed orders.

TagNameDescription
11ClOrdIDClOrdID of the order to be sent back
37OrderIDOrderID of the order to be sent back
54SideMust be 1 to buy or 2 to sell
55SymbolThe product to be traded (e.g. BTC-USD)

Response

The response to an Order Status Request is an ExecutionReport with ExecType=I.
The ExecutionReport will contain the ClOrdID if the value is supplied.
If the order cannot be found, the ExecutionReport will have OrderID=0.

Execution Report (8)

Sent by the server when an order is accepted, rejected, filled, or canceled. Also sent when the user sends an OrderStatusRequest.

TagNameDescriptionNotes
11ClOrdIDClOrdID of order to be sent back
37OrderIDOrderID from the ExecutionReport
55SymbolSymbol of the original order
17ExecIDFree format text string
150ExecTypeMay be 1 (Partial fill) for fills, 4 for cancelled, etc.
54SideWill be 1 for buy or 2 for sell
39OrdStatusOrder status as of the current message
38OrderQtyOrderQty as accepted.Either this or CashOrderQty will be supplied (depending on whichever you originally submitted)
152CashOrderQtyOrder size in quote units (e.g. USD).Either this or OrderQty will be supplied (depending on whichever you originally submitted).
32LastQtyAmount currently filled
151LeavesQtyAmount of order to be filled
14CumQtyTotal amount filled on this order
6AvgPxThe average price of the order
31LastPxPrice of the fill if ExecType indicates a fill, otherwise the order price
103OrdRejReasonInsufficient funds=3, Post-only=8, Unknown error=0
12CommissionThe Commission incurred for this fill

ExecType Values

ExecTypeDescription
0New Order
1Partial Fill
3Done
4Canceled
7Stopped
8Rejected
DRestated
IOrder 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.

TagNameDescription
11ClOrdIDThe same value provided by the original cancel request
37OrderIDThe same value provided by the original cancel request
41OrigClOrdIDThe same value provided by the original cancel request
39OrdStatusThe order status; see the table below for a list.
TODOOrderRejReasonThe reason the order was rejected
434CxlRejResponseToThe rejection response; see the table below for a list.

OrdStatus Values

MiscFeeTypeDescription
0New
1Partially filled
2Filled
3Done for day
4Canceled
5Replaced
6Pending Cancel (e.g. result of Order Cancel Request <F>)
7Stopped
8Rejected
9Suspended
APending New
BCalculated
CExpired
DAccepted for bidding
EPending Replace (e.g. result of Order Cancel/Replace Request <G>)

CxlRejResponseTo Values

MiscFeeTypeDescription
1Order Cancel Request <F>
2Order 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.

TagNameDescription
45RefSeqNumMsgSeqNum of the rejected incoming message
371RefTagIDTag number of the field which caused the reject (optional)
372RefMsgTypeMsgType of the rejected incoming message
58TextHuman-readable description of the error (optional)
373SessionRejectReasonCode to identify reason for the reject (for session-level rejections only)

SSL Tunnels

fix.prime.coinbase.com:4198 only accepts TCP connections secured by SSL. If your FIX client library cannot establish an SSL connection natively, you will need to run a local proxy that will establish a secure connection and allow unencrypted local connections.

Certificate pinning is no longer supported.