# FIX Order Entry

For assistance or information regarding implementation of the FIX API, please contact <support@sfox.com>

{% hint style="info" %}
sFOX uses FIX 4.4
{% endhint %}

## Connectivity

Before logging onto a FIX session, you must establish a secure connection to the FIX gateway

### Endpoints <a href="#endpoints" id="endpoints"></a>

<table><thead><tr><th width="168.33333333333331">Environment</th><th width="437">Value</th><th>SSL Required</th></tr></thead><tbody><tr><td>Production</td><td><code>fix.sfox.com:5001</code></td><td>Y</td></tr><tr><td>Sandbox</td><td><code>fix.staging.sfox.com:5001</code> <br><br><a href="mailto:support@sfox.com">Contact support</a> <em>for access to the Sandbox environment.</em></td><td>Y</td></tr></tbody></table>

### TCP SSL

If your FIX implementation does not support establishing a native TCP SSL connection with SNI support, set up a local proxy such as [stunnel](https://www.stunnel.org/) to establish a secure connection to the FIX gateway. Refer to our [QuickFIX Integration Guide](/fix-api/quickfix-guide.md) for details and examples

## Standard Header

A standard header is required at the start of each message

{% hint style="info" %}
`SenderCompID`s must be provided by sFOX. Contact <support@sfox.com> to be provided with a `SenderCompID` for your session.
{% endhint %}

<table><thead><tr><th width="83">Tag</th><th width="200.99111900532864">Name</th><th width="466.5107282855374">Description</th></tr></thead><tbody><tr><td>108</td><td>HeartBtInt</td><td>Must be &#x3C;= <code>30</code> (seconds)</td></tr><tr><td>8</td><td>BeginString</td><td>Must be <code>FIX.4.4</code></td></tr><tr><td>49</td><td>SenderCompID</td><td>Value provided by sFOX. Must be unique per session</td></tr><tr><td>56</td><td>TargetCompID</td><td>Must be <code>SFOX</code></td></tr><tr><td></td><td>StartDay</td><td><code>Sunday</code></td></tr><tr><td></td><td>EndDay</td><td><code>Sunday</code></td></tr><tr><td></td><td>StartTime</td><td><code>00:00:01</code></td></tr><tr><td></td><td>EndTime</td><td><code>00:00:00</code></td></tr><tr><td></td><td>TimeZone</td><td>Must be <code>ETC</code> or <code>UTC</code></td></tr></tbody></table>

## Messages

### Logon – A <a href="#logon-a" id="logon-a"></a>

Sent by the client to initiate a session and by the server as an acknowledgement.

{% hint style="info" %}
Only one session may exist per SenderCompId. Attempting to logon using a SenderCompId of an active session will result in an error.
{% endhint %}

<table><thead><tr><th width="99">Tag</th><th width="200">Name</th><th width="105">Required</th><th width="358.71428571428567">Description</th></tr></thead><tbody><tr><td>554</td><td>Password</td><td>Y</td><td>Your API Key (generate one <a href="https://trade.sfox.com/account/api">here</a>)</td></tr><tr><td>20040</td><td>CancelOnDisconnect</td><td>N</td><td>String Field: Optionally cancel all orders on disconnect (logout or otherwise). <em>Note: this cancels orders on the entire account.</em><br><br><code>Y</code> - Cancel on Disconnect</td></tr></tbody></table>

{% hint style="warning" %}
**QuickFIX:** If you are implementing the FIX protocol using QuickFIX please refer to our [QuickFIX Integration Guide](/fix-api/quickfix-guide.md)
{% endhint %}

### NewOrderSingle – D <a href="#new-order-single-d" id="new-order-single-d"></a>

<table><thead><tr><th width="88" data-type="number">Tag</th><th width="159">Name</th><th width="186">Required</th><th>Description</th></tr></thead><tbody><tr><td>11</td><td>ClOrdID</td><td>Y</td><td>Client provided order ID, must be unique per-account. If placing an order on behalf of a quote, this value should match your QuoteReqID (see <a data-mention href="#order-status-request-h">#order-status-request-h</a>)</td></tr><tr><td>55</td><td>Symbol</td><td>Y</td><td><p>Trading pair in lowercase <code>basequote</code> format i.e. <code>btcusd</code></p><p>(see: <a href="#security-list-request-x">Security List</a>)</p></td></tr><tr><td>54</td><td>Side</td><td>Y</td><td><p><code>1</code>: Buy</p><p><code>2</code>: Sell</p></td></tr><tr><td>40</td><td>OrdType</td><td>Y</td><td><p><code>1</code>: Market</p><p><code>2</code>: Limit</p><p><code>3</code>: Stop</p><p>or one of our Algorithm IDs</p></td></tr><tr><td>44</td><td>Price</td><td>Y (excluding Market orders)</td><td>Limit Price</td></tr><tr><td>38</td><td>OrderQty</td><td>Y</td><td>For limit orders, this is the quantity to trade in the base currency. For Market Sell orders, this is the amount in the base currency.</td></tr><tr><td>152</td><td>CashOrderQty</td><td>Y (OrdType = <code>1</code> AND Side = <code>1</code> or OrdType = <code>3</code> (stop) AND Side = <code>1</code> (buy)</td><td>For market buy orders, this is the amount to spend in the quote currency</td></tr><tr><td>21</td><td>HandleInst (custom usage)</td><td>N</td><td>How to execute the order:<br><code>1</code>: Smart<br><code>2</code>: NetPrice (default)</td></tr><tr><td>59</td><td>TimeInForce</td><td>N</td><td>The lifetime of the order:<br><code>1</code>: good till cancel (default)<br><code>3</code>: immediate or cancel</td></tr><tr><td>20025</td><td>Destination (custom)</td><td>N</td><td>Specific destination:<br><code>ox</code><br><code>darkpool</code></td></tr><tr><td>117</td><td>QuoteID</td><td>N</td><td>QuoteID you'd like to place an order on behalf of (see <a data-mention href="#order-status-request-h">#order-status-request-h</a>)</td></tr></tbody></table>

<table><thead><tr><th width="125">Tag</th><th width="157">Name</th><th width="149">Algorithm</th><th width="105">Required</th><th width="297">Description</th><th>Default</th></tr></thead><tbody><tr><td>20000</td><td>StopAmount</td><td><code>308</code>: Trailing Stop</td><td>N</td><td>The fixed amount to trail the market price by</td><td></td></tr><tr><td>20001</td><td>StopPercent</td><td><code>308</code>: Trailing Stop</td><td>N</td><td>The percentage to trail the market price by (given as a decimal: 10% = 0.1)</td><td></td></tr><tr><td>20010</td><td>Interval</td><td><code>307</code>: TWAP</td><td>Y</td><td>The frequency at which TWAP trades are executed (in seconds)</td><td></td></tr><tr><td>20011</td><td>TotalTime</td><td><code>307</code>: TWAP</td><td>Y</td><td>The maximimum time a TWAP order will stay active (in seconds). Must be >= 15 minutes (900 seconds) and the interval (tag 20010)</td><td></td></tr><tr><td>20020</td><td>RoutingOption</td><td><p><code>301</code>: Gorilla</p><p><code>303</code>: Hare</p></td><td>Y</td><td>How SFOX will trade your order, <code>BestPrice</code> or <code>Fast</code></td><td></td></tr></tbody></table>

### RequestForQuote - R

<table><thead><tr><th width="88">Tag</th><th width="137">Name</th><th width="104">Required</th><th>Description</th></tr></thead><tbody><tr><td>131</td><td>QuoteReqID</td><td>Y</td><td>Client provided quote request ID. This identifier will also be used in any follow-up order placed on behalf of the returned quote as the ClOrdID</td></tr><tr><td>55</td><td>Symbol</td><td>Y</td><td><p>Trading pair in lowercase <code>basequote</code> format i.e. <code>btcusd</code></p><p>(see: <a href="#security-list-request-x">Security List</a>)</p></td></tr><tr><td>54</td><td>Side</td><td>Y</td><td><p><code>1</code>: Buy</p><p><code>2</code>: Sell</p></td></tr><tr><td>38</td><td>OrderQty</td><td>Y</td><td>Quantity of base currency you're interested in quoting a buy/sell order on</td></tr></tbody></table>

### OrderStatusRequest – H <a href="#order-status-request-h" id="order-status-request-h"></a>

<table><thead><tr><th width="96">Tag</th><th width="168">Name</th><th width="108">Required</th><th width="391.71428571428567">Description</th></tr></thead><tbody><tr><td>11</td><td>ClOrdID</td><td>Y</td><td>Original ClOrdID when creating the order</td></tr><tr><td>790</td><td>OrdStatusReqID</td><td>N</td><td>Optionally provided value that will be echoed in the response</td></tr></tbody></table>

### OrderCancelRequest – F <a href="#order-cancel-request-f" id="order-cancel-request-f"></a>

<table><thead><tr><th width="93.61538461538461">Tag</th><th width="150">Name</th><th width="106">Required</th><th>Description</th></tr></thead><tbody><tr><td>11</td><td>ClOrdID</td><td>Y</td><td>Unique ID of the cancel request</td></tr><tr><td>41</td><td>OrigClOrdID</td><td>Y</td><td>Original ClOrdID provided when creating the order</td></tr></tbody></table>

### OrderCancelReplaceRequest - G

<table><thead><tr><th width="120">Tag</th><th width="170">Name</th><th width="108">Required</th><th>Description</th></tr></thead><tbody><tr><td>11</td><td>ClOrdID</td><td>Y</td><td>Client Order ID of this request</td></tr><tr><td>41</td><td>OrigClOrdID</td><td>Y</td><td>Client Order ID of the original order</td></tr><tr><td>38</td><td>OrderQty</td><td>N</td><td></td></tr><tr><td>44</td><td>Price</td><td>N</td><td></td></tr><tr><td>152</td><td>CashOrderQty</td><td>N</td><td></td></tr><tr><td>20000</td><td>StopAmount</td><td>N</td><td></td></tr><tr><td>20001</td><td>StopPercent</td><td>N</td><td></td></tr></tbody></table>

### OrderMassCancelRequest - q

<table><thead><tr><th width="88.10122394971881">Tag</th><th width="232.84848484848487">Name</th><th width="108">Required</th><th>Description</th></tr></thead><tbody><tr><td>11</td><td>ClOrdID</td><td>N</td><td>Optional client order id, echoed back in the <code>OrderMassCancelReport</code></td></tr><tr><td>530</td><td>MassCancelRequestType</td><td>Y</td><td><code>7</code> - Cancel All Orders (this will attempt to cancel all open orders for the account)</td></tr></tbody></table>

### OrderMassCancelReport - r

<table><thead><tr><th width="94.52490473522084">Tag</th><th width="238.51028393699207">Name</th><th>Description</th></tr></thead><tbody><tr><td>37</td><td>OrderID</td><td>OrderID of this report</td></tr><tr><td>11</td><td>ClOrdID</td><td>ClOrdID provided in the <code>OrderMassCancelRequest</code>, if provided</td></tr><tr><td>530</td><td>MassCancelRequestType</td><td><code>7</code> - Cancel All Orders</td></tr><tr><td>531</td><td>MassCancelResponse</td><td><code>0</code> - Request Rejected<br><code>7</code> - Cancel All Orders</td></tr><tr><td>532</td><td>MassCancelRejectReason</td><td><code>99</code> - Other (if 531 = 0)</td></tr><tr><td>533</td><td>TotalAffectedOrders</td><td>Number of orders that are affected by the request (note: it is not guaranteed all of these orders are canceled, only that a cancel is requested)</td></tr><tr><td>58</td><td>Text</td><td>Optional text to describe the error (if 531 = 0)</td></tr></tbody></table>

### ExecutionReport – 8 <a href="#execution-report-8" id="execution-report-8"></a>

<table><thead><tr><th width="108.12655138722931">Tag</th><th width="160.69564222649527">Name</th><th>Description</th></tr></thead><tbody><tr><td>37</td><td>OrderID</td><td>SFOX Assigned Order ID, when rejected this will be 0.</td></tr><tr><td>17</td><td>ExecID</td><td>SFOX Assigned Trade ID, when rejected this will be 0.</td></tr><tr><td>11</td><td>ClOrdID</td><td>Client provided order ID</td></tr><tr><td>31</td><td>LastPx</td><td>Last fill price</td></tr><tr><td>32</td><td>LastQty</td><td>Last fill quantity</td></tr><tr><td>60</td><td>TransactTime</td><td></td></tr><tr><td>55</td><td>Symbol</td><td>Trading pair</td></tr><tr><td>54</td><td>Side</td><td><p><code>1</code>: Buy</p><p><code>2</code>: Sell</p></td></tr><tr><td>40</td><td>OrdType</td><td><p><code>1</code>: Market</p><p><code>2</code>: Limit</p></td></tr><tr><td>44</td><td>Price</td><td>Client provided limit price, only if OrdType = 2</td></tr><tr><td>150</td><td>ExecType</td><td><p>Execution type:</p><p><code>0</code>: New</p><p><code>4</code>: Canceled</p><p><code>8</code>: Rejected</p><p><code>F</code>: Trade</p><p><code>I</code>: Order Status Request</p></td></tr><tr><td>39</td><td>OrdStatus</td><td><p>Current status of the order:<br><code>0</code>: New</p><p><code>1</code>: Partially Filled</p><p><code>2</code>: Filled</p><p><code>3</code>: Done</p><p><code>4</code>: Canceled</p><p><code>8</code>: Rejected</p></td></tr><tr><td>151</td><td>LeavesQty</td><td>Amount remaining of the order</td></tr><tr><td>14</td><td>CumQty</td><td>Amount filled so far of the order</td></tr><tr><td>6</td><td>AvgPx</td><td>VWAP</td></tr><tr><td>136</td><td>NoMiscFees</td><td>Number of misc fees</td></tr><tr><td>=> 137</td><td>MiscFeeAmt</td><td>Amount of fees</td></tr><tr><td>=> 138</td><td>MiscFeeCurr</td><td>Fee Currency</td></tr></tbody></table>

### OrderCancelReject – 9 <a href="#ordercancelreject-9" id="ordercancelreject-9"></a>

<table><thead><tr><th width="100.24966622162881">Tag</th><th width="174">Name</th><th>Description</th></tr></thead><tbody><tr><td>37</td><td>OrderID</td><td>SFOX Order ID, unless the order is unknown (CxlRejReason = Unknown Order)</td></tr><tr><td>11</td><td>ClOrdID</td><td>Client provided order ID of the cancel request</td></tr><tr><td>41</td><td>OrigClOrdID</td><td>Client provided order ID of the original order (echoed back from the request)</td></tr><tr><td>39</td><td>OrdStatus</td><td>Existing status of the order that could not be canceled</td></tr><tr><td>102</td><td>CxlRejReason</td><td><code>0</code>: Too Late To Cancel<br><code>1</code>: Unknown Order<br><code>99</code>: Other (already canceled)</td></tr><tr><td>434</td><td>CxlRejResponseTo</td><td><code>1</code>: Order Cancel Request<br><code>2</code>: Order Cancel Replace Request</td></tr></tbody></table>

### Security List Request - x

<table><thead><tr><th width="88.28571428571428">Tag</th><th width="246">Name</th><th width="105">Required</th><th>Description</th></tr></thead><tbody><tr><td>320</td><td>SecurityReqID</td><td>Y</td><td></td></tr><tr><td>559</td><td>SecurityListRequestType</td><td>Y</td><td>Must be <code>4</code> - All Securities</td></tr></tbody></table>

### Security List - y

<table><thead><tr><th width="111">Tag</th><th width="204.23993144815768">Name</th><th>Description</th></tr></thead><tbody><tr><td>320</td><td>SecurityReqID</td><td>SecurityReqID from the SecurityListRequest</td></tr><tr><td>322</td><td>SecurityResponseID</td><td>Unique identifier of the response</td></tr><tr><td>560</td><td>SecurityRequestResult</td><td>This will always be <code>0</code> - Valid Request</td></tr><tr><td>146</td><td>NoRelatedSym</td><td></td></tr><tr><td>-> 55</td><td>Symbol</td><td>Underlying asset symbol in lowercase <code>basequote</code> format i.e. <code>btcusd</code></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sfox.com/fix-api/fix.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
