Trading
Place orders and receive execution reports via FIX 4.4 protocol
The Trading session enables order placement and execution management via the FIX 4.4 protocol. Use this session to submit orders and receive real-time execution reports for your trading activity.
For FIX connection settings (host, port, SenderCompID, TargetCompID, credentials), contact your broker.
This page covers the Trading session only. For real-time order book streaming, use the Market Data session.
Supported message types
The following values can be assigned to the <35> MsgType field:
A— Logon (Client → B2PRIME)0— Heartbeat (Client ↔ B2PRIME)1— Test Request (Client ↔ B2PRIME)3— Reject (Client ← B2PRIME)4— Sequence Reset (Client ↔ B2PRIME)5— Logout (Client ↔ B2PRIME)D— New Order Single (Client → B2PRIME)8— Execution Report (Client ← B2PRIME)j— Business Reject (Client ← B2PRIME)
Getting started
Connection
To connect to the Trading session, use the following parameters provided by B2PRIME:
Host and port: The Trading endpoint (provided separately from the Market Data endpoint)
SenderCompID: Your client identifier for the Trading session
TargetCompID: The server identifier for the Trading session
Protocol: FIX 4.4
The Trading connection requires SSL with a self-signed certificate.
Message structure
Standard Header
All FIX messages must begin with a Standard Header containing the following fields:
8 BeginString String
Identifies the FIX version (FIX.4.4). Always the first field in a message.
9 BodyLength int
The automatically computed message length, in bytes. Always the second field.
35 MsgType String
The message type. See Supported message types for possible values. Always the third field.
34 MsgSeqNum int
The message sequence number, incremented by 1 for each consecutive message.
49 SenderCompID String
The identifier of the message sender. Provided by B2PRIME.
52 SendingTime Timestamp
The date and time when the message was sent, in UTC: YYYYMMDD-HH:MM:SS.sss.
56 TargetCompID String
The identifier of the message recipient. Provided by B2PRIME.
Standard Trailer
All FIX messages must end with a Standard Trailer:
10 CheckSum int
A three-digit checksum. Always the last field in a message.
Logon (A)
This message is sent by the client to initiate a FIX session. It must be the first message in each connection.
1 Account String
The account identifier. Required. Provided by B2PRIME.
98 EncryptMethod int
The encryption method. Required. Must be 0 (no encryption).
108 HeartBtInt int
The heartbeat interval, in seconds. Required. Indicates how often the server sends Heartbeat messages as part of a connection health check.
141 ResetSeqNumFlag Boolean
Indicates whether both parties should reset the currently used sequence numbers. Optional.
553 Username String
The client username. Required. Provided by B2PRIME.
554 Password String
The client password. Required. Provided by B2PRIME.
Session maintenance
Heartbeat (0)
This message is sent back and forth between the server and the client to check the connection status and in response to Test Request messages.
112 TestReqID String
The identifier of a Test Request in response to which this Heartbeat is sent. Conditional — required when sent in response to a Test Request.
Test Request (1)
This message is sent back and forth between the server and the client as a means of connectivity check. If a Heartbeat is not received within the expected interval, a Test Request is sent; the recipient must respond with a Heartbeat containing the same <112> TestReqID.
112 TestReqID String
The identifier of a Test Request. Required.
Sequence Reset (4)
This message indicates the sequence number of the next message from the sender, immediately following the Sequence Reset. This may be necessary to recover from a disconnect when some messages were lost or their resending is not desirable.
123 GapFillFlag Boolean
Indicates that this message replaces missing messages that won't be resent. Optional.
Possible values:
Y— Gap fill:<34>MsgSeqNum is valid and indicates the beginning of the gap fill rangeN— Sequence reset:<34>MsgSeqNum is ignored. Should only be used in disaster recovery situations
36 NewSeqNo int
The new sequence number. Required.
Logout (5)
This message is sent by the client or server to terminate a session. When terminated, the possible reason is specified in the <58> Text field.
58 Text String
The detailed information about the reason for logging out. Optional.
Reject (3)
This message is sent by the server upon receiving a malformed message from the client. The rejection reason is specified in the <373> SessionRejectReason field.
This message is unrelated to application-level rejections (Execution Report with rejected status and Business Reject).
45 RefSeqNum int
The sequence number of the rejected message (<34> MsgSeqNum). Required.
371 RefTagID int
The tag number of the field that caused message rejection. Optional.
372 RefMsgType String
The type of the rejected message (<35> MsgType). Optional.
373 SessionRejectReason int
The reason why the message is rejected. Optional.
Possible values:
0— Invalid tag number1— Required tag missing2— Tag not defined for this message type3— Undefined tag4— Tag has no value assigned5— Value is incorrect (out of range) for this tag6— Incorrect value data format7— Decryption issue8— Signature problem9— CompID issue10— SendingTime accuracy issue11— Invalid MsgType12— XML validation error13— Same tag appears more than once14— Tag specified not in required order15— Wrong order of repeating group fields16— Incorrect NumInGroup count for repeating group17— Non-"Data" value includes field delimiter (SOH character)99— Other
58 Text String
The detailed information about the rejection reason. Optional.
New Order Single (D)
This message is sent by the client to place a new order. The server responds with an Execution Report confirming the order status.
For details on supported order types, see Order types. For details on time-in-force options, see Time in force.
11 ClOrdID String
The unique client-assigned order identifier. Required.
1 Account String
The account identifier. Required. Provided by B2PRIME.
55 Symbol String
The market identifier. Required. Format: {marketType}.{baseAssetId}_{quoteAssetId}, for example: spot.btc_usdt.
54 Side char
The order side. Required.
Possible values:
1— Buy2— Sell
38 OrderQty Qty
The order quantity. Required. Must be greater than zero. The decimal precision must not exceed the market's amount scale, and the value must be at least the market's minimum amount.
40 OrdType char
The order type. Required.
Possible values:
1— Market2— Limit
59 TimeInForce char
The order's time-in-force policy. Required.
Possible values:
0— Day1— Good Till Cancel (GTC)3— Immediate or Cancel (IOC)4— Fill or Kill (FOK)6— Good Till Date (GTD)
44 Price Price
The order price. Conditional — required when <40> OrdType is 2 (Limit), must not be present when <40> OrdType is 1 (Market). Must be greater than zero. The decimal precision must not exceed the market's price scale.
126 ExpireTime UTCTimestamp
The order expiration time. Conditional — required when <59> TimeInForce is 6 (GTD), must not be present otherwise.
60 TransactTime UTCTimestamp
The time of order creation. Required.
Execution Report (8)
This message is sent by the server to confirm order status changes, including acknowledgment of new orders, fills, partial fills, cancellations, and rejections.
For details on order statuses, see Order statuses.
37 OrderID String
The server-assigned unique order identifier. Required.
11 ClOrdID String
The client-assigned order identifier from the original New Order Single. Required.
17 ExecID String
The unique execution identifier. Present for trade executions.
150 ExecType char
The type of execution being reported. Required.
Possible values:
0— New: order has been accepted4— Canceled: order has been canceled by the server (e.g., IOC order partially filled, GTD order expired, or market settings changed)8— Rejected: order has been rejectedF— Trade: order has been partially or fully filled
39 OrdStatus char
The current order status. Required.
Possible values:
0— New1— Partially filled2— Filled4— Canceled8— Rejected
1 Account String
The account identifier. Required.
55 Symbol String
The market identifier. Format: {marketType}.{baseAssetId}_{quoteAssetId}.
54 Side char
The order side. Required.
Possible values:
1— Buy2— Sell
40 OrdType char
The order type. Required.
Possible values:
1— Market2— Limit
44 Price Price
The order price. Present for Limit orders.
6 AvgPx Price
The average price of all fills on this order. Required.
14 CumQty Qty
The total filled quantity. Required.
151 LeavesQty Qty
The remaining quantity to be filled. Required. Set to 0 for Canceled or Rejected orders.
31 LastPx Price
The price of the last fill. Present when <150> ExecType is F (Trade).
32 LastQty Qty
The quantity of the last fill. Present when <150> ExecType is F (Trade).
15 Currency String
The quote asset identifier. Optional.
60 TransactTime UTCTimestamp
The transaction time. Required.
64 SettlDate String
The settlement date in YYYYMMDD format. Required.
58 Text String
Additional information, such as the rejection reason. Optional.
Business Reject (j)
This message is sent by the server to reject a message due to a business-level issue not addressed by the standard session-level Reject or Execution Report rejection.
45 RefSeqNum int
The sequence number of the rejected message (<34> MsgSeqNum). Required.
372 RefMsgType String
The type of the rejected message (<35> MsgType). Optional.
380 BusinessRejectReason int
The reason why the request is rejected. Required.
Possible values:
0— Other1— Unknown ID2— Unknown Security3— Unsupported MsgType4— Application not available5— Conditionally required field missing6— Not authorized7— DeliverTo firm not available at this time
58 Text String
The detailed information about the rejection reason. Optional.
Last updated
Was this helpful?

