GuidesAPI Reference
DocumentationLog In

Messages

The baseline specification for this API is FIX 4.2. There are additional tags from later versions of FIX, and custom tags in the high number range as allowed by the standard.

A standard header must be present at the start of every message in both directions.

TagNameDescription
8BeginStringMust be FIX.4.2
49SenderCompIDClient API key (on messages from the client)
56TargetCompIDMust be Coinbase (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 may exist per connection; sending a Logon message within an established session is an error.

TagNameDescription
98EncryptMethodMust be 0 (None)
108HeartBtIntMust be 30 (Seconds) or less. Values greater than 30 will be capped at 30. Server will send Test Request if no client messages received in approximately (HeartBtInt x 1.5) seconds. Server will terminate session if no client messages received in approximately (HeartBtInt x 2 seconds).
554PasswordClient API passphrase
96RawDataClient message signature (see below)
8013CancelOrdersOnDisconnectS: Batch cancel all open orders placed during session; Y: Batch cancel all open orders for the current profile. The latter is more performant and recommended.
9406DropCopyFlagIf set to Y, execution reports will be generated for all user orders (defaults to Y)

The Logon message sent by the client must be signed for security. The signing method is described in Signing a Message. The prehash string is the following fields joined by the FIX field separator (ASCII code 1):

SendingTime, MsgType, MsgSeqNum, SenderCompID, TargetCompID, Password.

There is no trailing separator. The RawData field should be a base64 encoding of the HMAC signature.

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

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

// 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');
}

πŸ“˜

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. A maximum of 7 connections per profile can be established.

πŸ“˜

SendingTime value must be within 5 minutes of server time in UTC.

Logout (5)

Sent by either side to initiate session termination. The side which receives this message first should reply with the same message type to confirm session termination. Closing a connection without logging out of the session first is an error.

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.

TagNameDescription
11ClOrdIDUUID selected by client to identify the order
55SymbolRequired symbol to identify the new order E.g. BTC-USD
54SideMust be 1 to buy or 2 to sell
44PriceLimit price (e.g. in USD) (Limit order only)
38OrderQtyOrder size in base units (e.g. BTC)
152CashOrderQtyOrder size in quote units (e.g. USD) (Market order only)
40OrdTypeMust be 1 for Market, 2 for Limit, or 4 for Stop Limit
99StopPxStop price for order
59TimeInForceMust be a valid TimeInForce value. See the table below (Limit order only)
7928SelfTradePreventionOptional, see the table below

SelfTradePrevention Values

ValueDescription
DDecrement and cancel (the default)
OCancel resting order
NCancel incoming order
BCancel both orders

If an order is decremented due to self-trade prevention, an Execution Report will be sent to the client with ExecType=D indicating unsolicited OrderQty reduction (i.e. partial cancel).

See the self-trade prevention documentation for more details about this field.

TimeInForce Values

ValueDescription
1Good Till Cancel
3Immediate or Cancel
4Fill or Kill
PPost-Only

The post-only flag (P) indicates that the order should only make liquidity. If any part of the order results in taking liquidity, the order will be rejected and no part of it will execute. Open Post-Only orders will be treated as Good Till Cancel.

See the time in force documentation for more details about these values.

Errors

If a trading error occurs (e.g. user has insufficient funds), an Execution Report with ExecType=8 is sent back, signifying that the order was rejected.

New Order Batch (U6)

Sent by the client to create multiple orders. Maximum of 10 orders per message. All orders must have the same Symbol. 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. If the total number of open orders in the batch will cause the profile to exceed the 500 maximum, the entire batch will be rejected.

TagNameDescription
8014BatchIDUUID selected by client to identify this New Order Batch request
73NoOrdersNumber of orders in this message (number of repeating groups to follow). Must be less than or equal to 10.
11ClOrdIDUUID selected by client for the order. Must be the first field in the repeating group.
55SymbolRequired symbol to identify the new order (e.g. BTC-USD)
54SideMust be 1 to buy or 2 to sell
44PriceLimit price (e.g. in USD)
38OrderQtyOrder size in base units (e.g. BTC)
40OrdTypeMust be 2 for Limit
59TimeInForceMust be a valid TimeInForce value. See the table above
7928SelfTradePreventionOptional, see the table above

Order Cancel Request (F)

Sent by the client to cancel an order.

TagNameDescription
11ClOrdIDUUID selected by client to identify this cancel request
37OrderIDOrderID from the ExecutionReport with OrdStatus=New (39=0)
41OrigClOrdIDClOrdID from the New Order Single. When supplying this value, you do not need to supply an OrderID.
55SymbolRequired symbol of the order to cancel (must match Symbol of the Order).
58TextFree format text string

Order Status Request (H)

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

TagNameDescription
37OrderIDOrderID of order to be sent back.
11ClOrdIDClOrdID of order to be sent back. When supplying this value, you do not need to supply an OrderID.
55SymbolRequired symbol to identify the order 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.

Order Cancel Batch Request (U4)

Sent by the client to cancel multiple orders. Only 10 orders can be sent in a single message. All orders must have the same Symbol.

TagNameDescription
8014BatchIDUUID selected by client to identify this Order Batch Cancel Request
73NoOrdersNumber of orders in this message (number of repeating groups to follow). Must be less than or equal to 10.
41OrigClOrdIDUUID selected by client for the order. Must be the first field in the repeating group.
55SymbolRequired symbol of the order to cancel (must match Symbol of the Order)
37OrderIDOrderID from the ExecutionReport with OrdStatus=New (39=0). If present, this field will take precedence over OrigClOrdID to identify the order (optional).
11ClOrdIDUUID selected by client to identify this cancel request

Response

When the message is invalid or an unexpected error occurs, an Order Cancel Batch Reject (U5) message will be sent.
When orders are cancelled, an Execution Report (8) will be sent for each order canceled. When Order Cancel Batch Request (U4) is partially rejected (i.e. some orders are filled or already canceled), Order Cancel Reject (9) will be sent for each rejected cancel.

Execution Report (8)

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

TagNameDescription
11ClOrdIDOnly present on order acknowledgements, ExecType=New (150=0)
37OrderIDOrderID from the ExecutionReport with ExecType=New (150=0)
55SymbolSymbol of the original order
54SideMust be 1 to buy or 2 to sell
32LastSharesAmount filled (if ExecType=1). Also called LastQty as of FIX 4.3
44PricePrice of the fill if ExecType indicates a fill, otherwise the order price
38OrderQtyOrderQty as accepted (may be less than requested upon self-trade prevention)
152CashOrderQtyOrder size in quote units (e.g. USD) (Market order only)
60TransactTimeTime the event occurred
150ExecTypeMay be 1 (Partial fill) for fills, D for self-trade prevention, etc.
39OrdStatusOrder status as of the current message
103OrdRejReasonInsufficient funds=3, Post-only=8, Unknown error=0
136NoMiscFees1 (Order Status Request responses and fill reports)
137MiscFeeAmtFee amount (absolute value for Order Status Request responses, percentage value for fill reports)
138MiscFeeCurrFee currency
139MiscFeeType4 (Exchange fees) (Order Status Request responses and fill reports)
891MiscFeeBasis2 (Percentage fee basis) (fill report only)
1003TradeIDProduct unique trade id
1057AggressorIndicatorY for taker orders, N for maker orders

ExecType Values

ExecTypeDescription
0New Order
1Partial Fill
3Done
4Canceled
7Stopped
8Rejected
DRestated (Order Changed due to STP)
IOrder Status

New Order Batch Reject (U7)

Sent by the server when a New Order Batch message is rejected.

TagNameDescription
8014BatchIDBatchID from the New Order Batch message
58TextHuman-readable description of the error (optional)

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
11ClOrdIDAs on the cancel request
37OrderIDAs on the cancel request
41OrigClOrdIDAs on the cancel request
39OrdStatus4 if too late to cancel
102CxlRejReason1 if the order is unknown
434CxlRejResponseTo1 (Order Cancel Request)

Order Cancel Batch Reject (U5)

Sent by the server when an Order Cancel Batch Request cannot be satisfied, e.g. because a Symbol wasn’t present. This will not be sent if no orders can be found.

TagNameDescription
11ClOrdIDAs on the cancel request
37OrderIDAs on the cancel request

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 reject

SessionRejectReason Values

The following values can be sent by the server.

ValueDescription
1Required tag missing
5Value is incorrect (out of range) for this tag
6Incorrect data format for value
11Invalid MsgType (35)

Heartbeat (0)

Sent by both sides if no messages have been sent for (HeartBtInt x 0.75) seconds, as agreed upon during logon. May also be sent in response to a Test Request.

TagNameDescription
112TestReqIDCopied from the Test Request, if any

Test Request (1)

May be sent at any time by either side.

TagNameDescription
112TestReqIDFree text