> For the complete documentation index, see [llms.txt](https://docs.sfox.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sfox.com/fix-api/fix-market-data.md).

# FIX Market Data

Use the FIX Market Data session to receive market data from the FIX API

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

<table><thead><tr><th width="157">Environment</th><th width="436">URL</th><th>SSL Required</th></tr></thead><tbody><tr><td>Production</td><td><code>fix-md.sfox.com:5001</code></td><td>Y</td></tr><tr><td>Sandbox</td><td><code>fix-md.staging.sfox.com:5001</code><br><a href="mailto:support@sfox.com">Contact support</a> to access the Sandbox environment</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

{% 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="94">Tag</th><th width="175">Field</th><th>Description</th></tr></thead><tbody><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></tbody></table>

### QuickFIX session configuration

Configure these values in your QuickFIX session settings. They are not transmitted FIX header fields.

| Setting   | Value          |
| --------- | -------------- |
| StartDay  | `Sunday`       |
| EndDay    | `Sunday`       |
| StartTime | `00:00:05`     |
| EndTime   | `00:00:00`     |
| TimeZone  | `ETC` or `UTC` |

## Messages

### Logon - A

{% hint style="info" %}
Only one session may exist per SenderCompID. Attempting to log on using an active SenderCompID results in an error.
{% endhint %}

<table><thead><tr><th width="92">Tag</th><th width="134">Name</th><th width="129">Required</th><th>Description</th></tr></thead><tbody><tr><td>108</td><td>HeartBtInt</td><td>Y</td><td>Heartbeat interval. Must be &#x3C;= <code>30</code> seconds.</td></tr><tr><td>554</td><td>Password</td><td>Y</td><td>Your API Key</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 %}

### Market Data Request – V <a href="#market-data-request-v" id="market-data-request-v"></a>

Subscribes the current session to Market Data

<table><thead><tr><th width="117">Tag</th><th width="231">Name</th><th width="111">Required</th><th>Description</th></tr></thead><tbody><tr><td>262</td><td>MDReqID</td><td>Y</td><td>Market data request ID, included in all MarketDataSnapshotFullRefresh updates</td></tr><tr><td>263</td><td>SubscriptionRequestType</td><td>Y</td><td><code>1</code>: Snapshot Plus Updates<br><code>2</code>: Disable Previous Snapshot Plus Updates</td></tr><tr><td>20030</td><td>FeedType</td><td>N</td><td>Market data feed. Omit this field to use NPR books.<br><code>delta</code>: Delta. Recommended for new integrations.<br><code>net</code>: Net Price.<br><code>smart</code>: Smart.<br><br><em>Notice: Net Price and Smart feeds may be deprecated in a future release.</em></td></tr><tr><td>264</td><td>MarketDepth</td><td>N</td><td>Requested order book depth per side. This field is ignored for the delta feed. Delta snapshots are capped by the <code>ob-delta</code> service configuration.</td></tr><tr><td>20050</td><td>LastPublished</td><td>N</td><td>Set to <code>1</code> to include last-published timestamps on order book responses (W and X). Not included on trade messages.</td></tr><tr><td>267</td><td>NoMDEntryTypes</td><td>N</td><td>Number of MDEntryTypes requested. If empty the default is to subscribe to the order book.</td></tr><tr><td>-> 269</td><td>MDEntryType</td><td>N</td><td><code>0</code>: Bid<br><code>1</code>: Offer<br><code>2</code>: Trade<br><br>Note: <code>0</code> and/or <code>1</code> will give both sides of the order book.</td></tr><tr><td>146</td><td>NoRelatedSym</td><td>Y</td><td>Number of symbols in this request</td></tr><tr><td>-> 55</td><td>Symbol</td><td>Y</td><td>Pair to subscribe to, <code>basequote</code> format.</td></tr></tbody></table>

**Example (Delta Feed):**\
`35=V|262=1|263=1|264=0|20030=delta|146=1|55=btcusd`

In this example, `|` represents the ASCII SOH delimiter (`0x01`). Actual FIX messages use SOH. Standard engine-managed fields are omitted.

Optional: append `|20050=1` to receive last-published timestamps on order book responses.\
To unsubscribe, send the same `MDReqID` with `SubscriptionRequestType` (263) = 2.

{% hint style="warning" %}
**Notice:** We recommend the `delta` order book feed for new integrations. Net Price and Smart remain supported. They may be deprecated in a future release.
{% endhint %}

### Message flow

1. After a successful subscribe, you receive a Market Data Snapshot/Full Refresh (W). For delta, this contains the depth configured by the `ob-delta` service.
2. Subsequent book changes arrive as Market Data Incremental Refresh (X) messages.
3. A new W snapshot may be sent at any time. This includes gaps or resyncs. Always replace local state with the snapshot.
4. Requested trades arrive as W messages with `MDEntryType` = 2. They do not use incremental refreshes. The feed identifier is `trades.sfox.{pair}`, not `orderbook.delta.*`.

After reconnecting, resubscribe and rebuild local state from the new W snapshot.

### Market Data Snapshot/Full Refresh - W

<table><thead><tr><th width="143">Tag</th><th width="174">Name</th><th>Description</th></tr></thead><tbody><tr><td>262</td><td>MDReqID</td><td>Original MDReqID that generated this refresh</td></tr><tr><td>55</td><td>Symbol</td><td>Symbol/currency pair of the market data entry</td></tr><tr><td>106</td><td>Issuer</td><td>The full feed recipient, for example <code>orderbook.net.btcusd</code></td></tr><tr><td>268</td><td>NoMDEntries</td><td>Number of market data entries in this message</td></tr><tr><td>-> 269</td><td>MDEntryType</td><td><code>0</code>: Bid<br><code>1</code>: Offer<br><code>2</code>: Trade</td></tr><tr><td>-> 270</td><td>MDEntryPx</td><td>Price of the market data entry</td></tr><tr><td>-> 271</td><td>MDEntrySize</td><td>Size/Quantity of the market data entry</td></tr><tr><td>-> 273</td><td>MDEntryTime</td><td>Only for trades</td></tr><tr><td>-> 37</td><td>OrderID</td><td>Only for trades</td></tr><tr><td>-> 275</td><td>MDMkt</td><td>Market or liquidity source of the entry</td></tr><tr><td>-> 2446</td><td>AggressorSide</td><td><code>1</code>: Buy<br><code>2</code>: Sell</td></tr><tr><td>20050</td><td>LastPublished</td><td>UNIX timestamp (milliseconds) this order book was last published. Only present if requested with <code>20050=1</code> on the Market Data Request.</td></tr></tbody></table>

### Market Data Incremental Refresh – X

Apply each entry to the local order book. Do not replace the full book unless a new snapshot (W) is received.

| Tag   | Name           | Description                                                                                                                          |
| ----- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| 262   | MDReqID        | Original MDReqID that generated this refresh                                                                                         |
| 268   | NoMDEntries    | Number of market data entries in this message                                                                                        |
| → 55  | Symbol         | Symbol/currency pair of the market data entry                                                                                        |
| → 269 | MDEntryType    | <p>0: Bid<br>1: Offer</p>                                                                                                            |
| → 279 | MDUpdateAction | <p>1: Change - insert or replace the level<br>2: Delete - remove the level</p>                                                       |
| → 270 | MDEntryPx      | Price of the market data entry                                                                                                       |
| → 271 | MDEntrySize    | Size/Quantity of the market data entry. Omitted when MDUpdateAction is Delete.                                                       |
| → 275 | MDMkt          | Market / liquidity source of the entry                                                                                               |
| 20050 | LastPublished  | UNIX timestamp (milliseconds) this order book was last published. Only present if requested with 20050=1 on the Market Data Request. |

**Applying updates**

Order book levels are identified by price, market, and side (`MDEntryPx` + `MDMkt` + `MDEntryType`).

For each entry in an incremental refresh:

1. **Change (279=1):** insert or replace the level at that price, market, and side with the given size.
2. **Delete (279=2):** remove the level at that price, market, and side.

On any Snapshot/Full Refresh (W), discard local book state for that symbol and load the snapshot entries in full.

### Trades – W

When `MDEntryType` = 2 is requested, trades arrive as snapshot messages (W) on the `trades.sfox.{pair}` feed.

| Tag    | Name          | Description                                  |
| ------ | ------------- | -------------------------------------------- |
| 262    | MDReqID       | Original MDReqID that generated this refresh |
| 55     | Symbol        | Symbol/currency pair                         |
| 106    | Issuer        | Feed identifier, e.g. trades.sfox.btcusd     |
| 268    | NoMDEntries   | Number of trade entries (typically 1)        |
| → 269  | MDEntryType   | 2: Trade                                     |
| → 270  | MDEntryPx     | Trade price                                  |
| → 271  | MDEntrySize   | Trade quantity                               |
| → 275  | MDMkt         | Market / exchange of the trade               |
| → 273  | MDEntryTime   | Trade timestamp                              |
| → 37   | OrderID       | Trade ID                                     |
| → 2446 | AggressorSide | <p>1: Buy<br>2: Sell</p>                     |

### Security List Request - x

Returns a [Security List - y](#security-list-y) response containing supported symbols

<table><thead><tr><th width="113">Tag</th><th width="222">Name</th><th width="131">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><code>4</code>: All Securities</td></tr></tbody></table>

### Security List - y

The response containing the list of symbols from a [Security List Request - x](#security-list-request-x) request

<table><thead><tr><th width="115">Tag</th><th width="225">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><code>0</code>: Valid Request</td></tr><tr><td>146</td><td>NoRelatedSym</td><td>Specifies the number of returned symbols</td></tr><tr><td>-> 55</td><td>Symbol</td><td>Currency pair in lowercase <code>basequote</code> format, for example <code>btcusd</code></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.sfox.com/fix-api/fix-market-data.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
