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)

🚧

New orders can only be placed when the number of open orders is below 500 for that given product.

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
34MsgSeqNumMust be 1
98EncryptMethodMust be 0 (None)
108HeartBtIntMust be ≀ 30 (secs). Values greater are capped at 30. Server sends Test Request if client messages are not received in approximately (HeartBtInt x 1.5) seconds. Server terminates session if client messages are not 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 are 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.from(secret, 'base64');
    var hmac = crypto.createHmac('sha256', key);
    return hmac.update(what).digest('base64');
}

🚧

To establish multiple FIX connections, generate a new API key for each one. The maximum is 7 connections per profile. Do not use a single API key for multiple connections at the same time.

🚧

The value of SendingTime 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.

🚧

Do not close a connection without logging out of the session first or it triggers 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 cannot 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 is 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 is rejected and no part of it executes. Open Post-Only orders are treated as Good Till Cancel.

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

Errors

If a trading error occurs (for example, the 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 15 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 cannot place any new orders until the total number of open orders is below 500. If the total number of open orders in the batch causes the profile to exceed the 500 maximum, the entire batch is 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 contains the ClOrdID if the value is supplied. If the order cannot be found, the ExecutionReport has OrderID=0.

Order Cancel Batch Request (U4)

Sent by the client to cancel multiple orders. Maximum of 15 orders per 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 takes 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 is sent. When orders are cancelled, an Execution Report (8) is 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) is 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
6AvgPxCalculated average price of all fills on this order
11ClOrdIDOnly present on order acknowledgements, ExecType=New (150=0)
14CumQtyCurrently executed quantity for chain of orders
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)
151LeavesQtyQuantity open for further execution
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
58TextHuman-readable description of the reject or cancel (optional)

  • 101:Time In Force
  • 102:Self-trade Prevention
  • 103:Admin
  • 104:Price Bound Order Protection
  • 105:Insufficient Funds
  • 106:Insufficient Liquidity
  • 107:Broker

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)

Modify Order Request (G)

πŸ‘

Beta Feature!

Modify Order Request is in beta and available for testing in your sandbox. See also: WebSocket Full Channel, Change.

Supports the Order Replace Request outlined in the FIX protocol.

Example FIX Request:

 BeginString=FIX.4.2 BodyLength=265 MsgType=ORDER_CANCEL_REPLACE_REQUEST MsgSeqNum=17 SenderCompID=00000000100000000000000000000003 SendingTime=20220609-04:01:48.757 TargetCompID=Coinbase ClOrdID=907b6ae6-bcbe-441a-b7bb-d932afdb9edb OrderID=71de0cdf-938f-495b-9fad-108837bde704 OrderQty=2 OrdType=LIMIT OrigClOrdID=907b6ae6-bcbe-441a-b7bb-d932afdb9eda Price=100.00 Side=BUY Symbol=ETH-USD TransactTime=20220609-04:01:48.757 CheckSum=107

Example Execution Report:

BeginString=FIX.4.2 BodyLength=253 MsgType=EXECUTION_REPORT MsgSeqNum=18 SenderCompID=Coinbase SendingTime=20220609-04:01:48.766 TargetCompID=00000000100000000000000000000003 ExecID=450d0b12-e994-48de-9f74-0f43c74fd054 ExecTransType=NEW OrderID=71de0cdf-938f-495b-9fad-108837bde704 OrderQty=3 OrdStatus=DONE_FOR_DAY Price=100 Side=BUY Symbol=ETH-USD Text=107:Broker TransactTime=20220609-04:01:48.762 ExecType=DONE_FOR_DAY LeavesQty=0 CheckSum=150
TagNameDescription
37OrderIDUnique identifier of most recent order as assigned by broker
41OrigClOrdIDClOrdID <11> of previous order (NOT initial order of the day) when canceling or replacing an order
11ClOrdIDUnique identifier of replacement order as assigned by institution.
55SymbolMust match original order
54SideMust match original side
38OrderQtyTotal Intended Order Quantity (including the amount already executed for this chain of orders)
60TransactTimeTime this order request was initiated/released by the trader or trading system
40OrdTypeOnly limit orders are supported for now (2)
44PricePrice per share

🚧

Each Modify Order Request, per order, must be processed in turn. That is, a client can only send a Modify Order Request after the previous Modify Order Request message for the same order has been fully processed.

🚧

Clients may experience a non-standard FIX OrderCancelReject with text (when processing the last cancel replace request). This occurs when our system is backlogged and unable to process this Modify Order Request (or OrderCancelReplaceRequest).

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 was not present. This is not 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