Market Data API
Start receiving market data callbacks in these 4 steps:
- Initialize a callback
listenerobject registerApplicationwith the listenersubscribeto desired instrumentsstartnanoconda threads
Tip
Please refer to the Sample Application for demonstration. The sample application is the best starting point for your own algo.
Callbacks
Callback Listener
As market data arrives from the exchange it gets normalized and appropriate callback is raised. All our nanoconda market data objects are simple structs and you can directly access any field.
In order to receive callback updates user must implement a listener class and inherit nanoconda::listener
struct myListener : nanoconda::listener
{
void onsecurity(const nanoconda::security* s) { };
void onbook(const nanoconda::book* b) { };
void ontrade(const nanoconda::trade* t) { };
void onbookorder(const bookorder* o) { };
void onslowconsumer(const nanoconda::slowconsumer* s) { };
/*
...
*/
}
Security Information
onsecurity() callback is called one time on any subscription and then for any update from the exchange to the security, such as a trading status change.
struct security
{
char symbol[24];
char reservedC1[8];
unsigned long long symbolId;
unsigned long long exchangeSecurityId;
unsigned long long tickSize;
unsigned long long multiplier;
unsigned long long underlyingId;
long long lowLimitBand;
long long highLimitBand;
securityStatus status;
char entCode[6];
char highPrecisionPrice;
unsigned char segmentId;
securityType type;
unsigned char legs;
char reserved[4];
long long settlementPrice;
int openInterest;
int clearedVolume;
long long reservedL2;
static inline unsigned short size()
{
return 128;
}
};
Book Snapshot
Book updates are provided on any book update from the exchange. Snapshot of the top 10 levels is provided. Price level 0 is the top level for both sells and buys
struct pricelevel
{
long long price;
unsigned int qty;
unsigned int orders;
static inline unsigned short size()
{
return 16;
}
};
struct book
{
unsigned long long symbolId;
unsigned long long exchangetime;
unsigned long long receivetime;
unsigned long long symbolseqno;
unsigned long long writetime;
unsigned long long writeseqno;
unsigned long long transactiontime;
unsigned char lastEvent;
char reserved[7];
pricelevel buys[10];
pricelevel sells[10];
pricelevel buysImplied[2];
pricelevel sellsImplied[2];
static inline unsigned short size()
{
return 400;
}
};
Book Order Update
When enabled, individual order updates are provided through the onbookorder() callback. This feature enables Level 3 (L3) processing by the algorithm, such as constructing the full order book or identifying order-level changes between two onbook() callbacks.
enum orderupdatetype : unsigned char
{
OU_UNKNOWN=0,
OU_ADD=1,
OU_DEL=2,
OU_UPD=3,
OU_FILL=4,
OU_ADD_SNAPSHOT=5
};
struct bookorder
{
unsigned long long symbolId;
unsigned long long orderId;
unsigned long long transactiontime;
unsigned long long exchangetime;
long long price;
unsigned int quantity;
orderupdatetype updatetype;
char side;
unsigned char lastEvent;
unsigned char aggressing;
unsigned long long receivetime;
unsigned long long writetime;
bookorder()
{
reset();
}
void reset();
static inline unsigned short size()
{
return 64;
}
};
Trade Event
struct trade
{
unsigned long long symbolId;
unsigned long long exchangetime;
unsigned long long receivetime;
unsigned long long symbolseqno;
unsigned long long writetime;
unsigned long long transactiontime;
char aggressor;
unsigned char lastEvent;
char reserved[2];
unsigned int numOrders;
long long low;
long long high;
pricelevel bestbid;
pricelevel bestask;
long long lastPrice;
long long vwap;
unsigned int lastSize;
unsigned int totalVol;
long long open;
static inline unsigned short size()
{
return 136;
}
};
API functions
Additionally, several API calls are available to the user.
Note
API Calls return nanoconda::reasoncode to notify the user if the call was successful or if there was an error. It is the user's responsibility to handle any errors returned. Please refer to Reason Codes for explanation of each code and to Sample Application for an example on how to handle the codes.
List Available Symbols
If a list of available symbols is required, you can call listSymbols(), which will trigger an onsecurity() callback for each available security.
Subscribe To A Symbol
Call subscribe() to subscribe to market data updates for a specific symbol
reasoncode subscribe(const char* symbol, const char* entitlement, short cpu = -1);
//Example: nanoconda::subscribe("ESM5", "XCME", 3);
Subscribe To An Underlying
Call subscribeUnderlying() to subscribe to market data updates for all available symbols for an underlying.
reasoncode subscribeUnderlying(const char* symbol, const char* entitlement, short cpu = -1);
//Example: nanoconda::subscribeUnderlying("NQ", "XCME", 3);
Request MBO Snapshot At Start
To receive the complete order book of maintained instruments at start(), call requestMBOSnapshot(true) before start(). See Request MBO Snapshot.
Helper Functions
Get Epoch Nanoseconds Timestamp
Convert price to double
Get Symbol ID from a Symbol Name
Get Symbol Name As String
Get Security Object
Get Spread Security Legs
To identify the individual legs of a complex instrument, use the getSecurityLegs API and provide the spread's symbolId.
struct leginfo
{
unsigned long long symbolId;
unsigned char ratio;
char side;
unsigned short reservedUS;
unsigned int multiplier;
};
struct securitylegs
{
enum : unsigned short { MAX_SPREAD_LEGS = 48 };
unsigned int legCount;
unsigned int reserved;
leginfo legs[MAX_SPREAD_LEGS];
};
nanoconda::securitylegs legs;
nanoconda::reasoncode rcode = nanoconda::getSecurityLegs(symbolId, &legs);
if(rcode == SUCCESS)
{
for (int i=0; i< legs.legCount;i++)
{
printf("Leg %d: symbolId %llu symbol %s ratio %d side %c multiplier %d\n",i, legs.legs[i].symbolId, nanoconda::getSymbolName(legs.legs[i].symbolId), legs.legs[i].ratio, legs.legs[i].side, legs.legs[i].multiplier);
}
}
else
{
printf("getSecurityLegs for %llu returned code %u %s\n", symbolId, rcode, reasonToStr(rcode));
}
Sample Application
Here is a basic program to subscribe to common Index Futures on CME (can also be found in src/marketdata.cpp).
Tip
Code is annotated, you can click on (1) icon to view additional information.
- You found a sample annotation. Now look for the same markers in the code below!
/* Nanoconda 2025 | marketdata.cpp | g++ marketdata.cpp -lnanoconda */
#include "nanoconda.h"
#include <iostream>
using namespace nanoconda;
struct myListener : nanoconda::listener
{
void onsecurity(const nanoconda::security* s) { // (6) callback with security information
printf("myListener::onsecurity %s| symbolId: %llu ExchangeId: %llu TickSize: %f ContractMultiplier: %llu Trading Status: %u\n", s->symbol, s->symbolId, s->exchangeSecurityId, nacoPx(s->tickSize), s->multiplier, s->status);
if(s->type == nanoconda::TP_SPREAD)
{
nanoconda::securitylegs legs;
nanoconda::reasoncode rcode = nanoconda::getSecurityLegs(s->symbolId, &legs);
if(rcode == SUCCESS)
{
for (int i=0; i< legs.legCount;i++)
{
printf("Leg %d: symbolId %llu symbol %s ratio %d side %c multiplier %d\n",i, legs.legs[i].symbolId, nanoconda::getSymbolName(legs.legs[i].symbolId), legs.legs[i].ratio, legs.legs[i].side, legs.legs[i].multiplier);
}
}
else
{
printf("getSecurityLegs for %llu returned code %u %s\n", s->symbolId, rcode, reasonToStr(rcode));
}
}
};
void onbook(const nanoconda::book* b) {// (7) callback for a book update
printf("myListener::onbook %s| [%u,%.4f | %.4f,%u] time: %llu\n", nanoconda::getSymbolName(b->symbolId), b->buys[0].qty, nacoPx(b->buys[0].price), nacoPx(b->sells[0].price), b->sells[0].qty, b->exchangetime);
};
void ontrade(const nanoconda::trade* t) {// (8) callback for a new trade
printf("myListener::ontrade %s, %.4f|%d\n",nanoconda::getSymbolName(t->symbolId), nacoPx(t->lastPrice), t->lastSize);
};
void onorderack(const nanoconda::order* order) { };
void onorderreject(const nanoconda::order* order) { };
void oncancelack(const nanoconda::order* order) { };
void oncancelreject(const nanoconda::order* order) { };
void onmodifyack(const nanoconda::order* order) { };
void onmodifyreject(const nanoconda::order* order) { };
void onfill(const nanoconda::order* order) { };
void onout(const nanoconda::order* order) { };
void onorderstatus(const nanoconda::order* order) { };
};
int main(int argc, char *argv[])
{
myListener* mdApp = new myListener();
nanoconda::logger* mylogger = new nanoconda::logger("myLoggerFile.log");
nanoconda::reasoncode rcode;
rcode = nanoconda::registerApplication("username1","password", mdApp); //(1) register your identity and Callback Listener
if(rcode != nanoconda::SUCCESS) return rcode; // Exit program with the error code
rcode = nanoconda::subscribe("ESM5", "XCME", 3); //(2) subscribe to ESM5 Futures on cpu #3
if(rcode != nanoconda::SUCCESS) return rcode; // Exit program with the error code
rcode = nanoconda::subscribeUnderlying("NQ", "XCME", 3); //(3) subscribe to all NQ Futures on cpu #3
if(rcode != nanoconda::SUCCESS) return rcode; // Exit program with the error code
nanoconda::start(); //(4) start callback threads to start receiving updates
bool running = true;
while(running) //(5) keep your main application thread alive until running becomes false or you kill the process
{
}
nanoconda::stop(); //cleanup resources
return 0;
}
- Register your application with your listener and credentials, which are needed to identify your application. They will be provided by support@nanoconda.com.
- Add subscription to
ESM5Futures withXCMEentitlement code, your credentials must be provisioned for this entitlement.
Method Signature:
reasoncode subscribe(const char* symbol, const char* entitlement, short cpu = -1);
Refer to threading for more information on how to control nanoconda threads. - Add subscription to
NQunderlying chain. This call will subscribe to all NQ Futures, regardless of expiration. - Once
start()is called your application will start receiving callbacks for the subscribed instruments. -
Keep your main thread running to prevent the application from terminating. You can add your own logic to terminate the loop; for example, use SIGINT to set
running = false. -
This is an example of printing information about a product.
onsecurity()will be called upon subscription and then if there is a change in security status from the exchange.From nanoconda.henum securityStatus : unsigned short { HALT = 0, CLOSE = 200, POST_CLOSE = 220, PRE_OPEN = 120, OPEN = 100 }; //... struct security { char symbol[32]; unsigned long long symbolId; unsigned long long exchangeSecurityId; unsigned long long tickSize; unsigned long long multiplier; unsigned long long underlyingId; long long lowLimitBand; long long highLimitBand; securityStatus status; char entCode[6]; char highPrecisionPrice; unsigned char segmentId; char reserved[6]; long long settlementPrice; int openInterest; int clearedVolume; long long reservedL2; static inline unsigned short size() { return 128; } }; - This is an example of printing the top level of a
onbook()update. You have access to top 10 levels. This callback will be raised on any book update.From nanoconda.hstruct pricelevel { long long price; unsigned int qty; unsigned int orders; static inline unsigned short size() { return 16; } }; //... struct book { unsigned long long symbolId; unsigned long long exchangetime; unsigned long long receivetime; unsigned long long symbolseqno; unsigned long long writetime; unsigned long long writeseqno; unsigned long long transactiontime; unsigned char lastEvent; char reserved[7]; pricelevel buys[10]; pricelevel sells[10]; pricelevel buysImplied[2]; pricelevel sellsImplied[2]; static inline unsigned short size() { return 400; } }; - This is an example of printing information for the last
tradeupdate.ontrade()callback will be raised for every trade.From nanoconda.hstruct pricelevel { long long price; unsigned int qty; unsigned int orders; static inline unsigned short size() { return 16; } }; //... struct trade { unsigned long long symbolId; unsigned long long exchangetime; unsigned long long receivetime; unsigned long long symbolseqno; unsigned long long writetime; unsigned long long transactiontime; char aggressor; unsigned char lastEvent; char reserved[6]; long long low; long long high; pricelevel bestbid; pricelevel bestask; long long lastPrice; long long vwap; unsigned int lastSize; unsigned int totalVol; long long open; static inline unsigned short size() { return 136; } };
Compile your application
Administrative Callbacks
The feed handler provides several administrative callbacks that notify the application about the technical state of market data processing and book integrity. Applications must use these callbacks to correctly manage local order book state and recovery behavior.
Gap Notification
If the feed handler encounters an unrecoverable sequence gap while processing network data, the ongap() callback is triggered.
A gap indicates that one or more market data messages could not be recovered via retransmission and therefore the integrity of the locally maintained order book can no longer be guaranteed.
Upon receiving ongap(), the application must immediately discard or clear all locally maintained book state for the affected instruments.
Continuing to use the existing book after a gap may result in incorrect trading decisions.
After a gap is detected, the feed handler will automatically initiate a snapshot recovery sequence.
ongap() is also delivered by the library itself, without a following snapshot from the feed handler, when:
- the application lost market data because it did not keep up (see Slow Consumer Notification)
- an instrument requested with
requestMBOSnapshot()could not be recovered (see MBO Snapshot Recovery)
Snapshot Notification
Whenever the feed handler starts, or after a gap recovery is required, it retrieves full snapshot data from the exchange in order to rebuild the complete order book.
The beginning of a snapshot recovery sequence is indicated by the onsnapshotstart() callback.
The completion of the snapshot recovery sequence is indicated by the onsnapshotend() callback.
Note
Individual book order updates received during the snapshot phase will be delivered with updateType = OU_ADD_SNAPSHOT.
If the application maintains its own internal order book, these updates must be applied as standard order insertions.
The same callbacks deliver the order book at start() when the application uses MBO Snapshot Recovery.
Live Notification
While snapshot data is being processed, the feed handler may internally cache incremental market data messages received from the exchange.
After the snapshot sequence completes, the feed handler will replay all cached incremental updates to bring the book state fully up to date.
Once all cached messages have been processed and the feed handler is ready to resume normal real-time market data processing, the onlive() callback is triggered.
Receipt of onlive() indicates that:
- The order book is fully synchronized with the exchange
- All recovery processing has completed
- Normal trading logic and decision making may safely resume
onlive() is also delivered at the end of an MBO Snapshot Recovery.
Slow Consumer Notification
onslowconsumer() reports an application that does not keep up with the market data of a highway. Market data waits for the application in a buffer per highway; the feed handler never waits for the application.
struct slowconsumer
{
unsigned long long time; // Epoch nanoseconds when detected
char entitlement[8]; // For example "XCME"
unsigned int lagNs; // How far behind the application is, in nanoseconds
unsigned char backlogPercent; // How full the application's buffer is
unsigned char highway; // Highway number
unsigned char dataLost; // 1 if market data was lost
unsigned char reserved;
};
void onslowconsumer(const slowconsumer* s) { };
dataLost |
Meaning | Followed by | What to do |
|---|---|---|---|
0 |
The application is falling behind: the buffer is 80% full. Raised once, and again only after the buffer has dropped below a third of that. | - | Reduce work in callbacks |
1 |
Market data was overwritten before the application read it | ongap() for every subscribed instrument on that highway; delivery continues with the newest data |
Rebuild the book as after any ongap() |
Data loss is always reported, also when a single callback blocks for a long time or the application thread does not run for a while. After data loss the application continues with the newest data; the books of the affected instruments are complete again after the feed handler's next snapshot, or at once with MBO Snapshot Recovery when the application restarts.
onslowconsumer() is called on the market data thread that reads the highway. The same information is logged with NACO| SLOW |.
.wasm plugins (C++ and Rust) receive onslowconsumer() when built with the SDK of release 2026-11-19 or later. Plugins built earlier keep running without it.
Warning
Keep callbacks short. Do not write files, wait on locks or make network calls inside market data callbacks.
MBO Snapshot Recovery
Applications that build their own Market By Order (MBO) book need every resting order of an instrument. Without recovery, an application that starts or restarts while the market is open only sees new orders and changes from that moment on, and its book stays incomplete until the feed handler receives a snapshot from the exchange again.
With MBO snapshot recovery, the feed handler keeps the complete list of live orders of selected instruments, and the application receives the complete current book at start(), followed by live updates, without waiting for the exchange.
Tip
Recovery works while the market is open and while it is closed, and for native (.so) and WebAssembly (.wasm) plugins started with pluginloader -m.
How It Works
| Step | Where | What happens |
|---|---|---|
| 1 | Feed handler | For every instrument listed in <MaintainOrders>, the feed handler keeps the list of live orders in shared memory. It is built from the exchange snapshot and kept up to date from the same market data that is published to applications. |
| 2 | Application | requestMBOSnapshot(true) and subscribe() prepare the recovery before start(). |
| 3 | Application, at start() |
The library reads the order list, adds the updates published while it was reading, and delivers the result as a snapshot in queue order. |
| 4 | Application | The updates published during the recovery follow, then onlive(). From here on the application receives live market data as usual. |
The feed handler never waits for applications, and recovery adds no work to its publishing path. No update is missed: everything published after the snapshot point follows the snapshot.
Feed Handler Setup
List the instruments in a <MaintainOrders> node. Each symbol must be an exact instrument name that is also subscribed in <Instruments>.
<Feed logger="feed.log" entitlement="XCME" process-orders="true" mbo-snapshot="true" snapshot-during-close="true">
...
<Instruments>
<Instrument symbol="ESM6" />
<Instrument symbol="NQM6" />
</Instruments>
<MaintainOrders>
<Instrument symbol="ESM6" />
<Instrument symbol="NQM6" />
</MaintainOrders>
...
</Feed>
| Option | Why |
|---|---|
process-orders="true" |
Individual orders must be processed (default) |
mbo-snapshot="true" |
The exchange snapshot carries individual orders, so the order list is complete from the start |
snapshot-during-close="true" |
Optional. Applications that do not use recovery can rebuild their book from the snapshot loops while the market is closed. Maintained order lists are not affected by these loops. |
See Maintained Live Orders for all feed handler details.
Request MBO Snapshot
Call requestMBOSnapshot(true) before start(). It can be called before or after subscribe().
void requestMBOSnapshot(bool need = true);
//Example:
nanoconda::registerApplication(username, password, &listener);
nanoconda::subscribe("ESM6", "XCME", 3);
nanoconda::requestMBOSnapshot(true);
nanoconda::start();
Tip
Call requestMBOSnapshot(true) and subscribe() well before start(). Memory for the recovery is prepared at that time, so start() does no memory allocation and recovers large books in milliseconds.
Note
Market data delivery starts at start(). Messages published between subscribe() and start() are not delivered.
Plugins request the snapshot with the -m (--mbo-snapshot) session argument, for .so and .wasm plugins:
nanoconda-cli -a pluginloader -i myplugin.wasm -- plugin -e CME -s ESM6 -u <user> -p <password> -a <account> -m
See session arguments.
Recovery Succeeded
Every instrument requested with requestMBOSnapshot() ends with either onlive() or ongap().
start()
onsnapshotstart()
onbookorder(OU_ADD_SNAPSHOT) ---> Complete current order book, in queue order
...
onsnapshotend()
onbookorder(OU_ADD / OU_DEL / OU_UPD / OU_FILL) ---> Updates published during the recovery
...
onlive()
onbookorder(...) ---> Live updates
Recovery Not Available
start()
ongap() ---> No snapshot for this instrument
onbookorder(...) ---> Live updates; the book is incomplete until the next feed handler snapshot
The application then receives the feed handler's next onsnapshotstart() ... onsnapshotend() ... onlive(), as without recovery.
| Reason | Notes |
|---|---|
Instrument not listed in <MaintainOrders> |
|
| The feed handler is still building the order list | For example in the first seconds after the feed handler started |
| The application did not keep up during the recovery | The library retries twice. Also reported with onslowconsumer(), dataLost = 1. |
Handling The Callbacks
struct myListener : nanoconda::listener
{
void onsnapshotstart(const nanoconda::security* s) override { clearBook(s->symbolId); setLive(s->symbolId, false); }
void onsnapshotend(const nanoconda::security* s) override { }
void onlive(const nanoconda::security* s) override { setLive(s->symbolId, true); }
void ongap(const nanoconda::security* s) override { clearBook(s->symbolId); setLive(s->symbolId, false); }
void onbookorder(const nanoconda::bookorder* o) override
{
switch (o->updatetype)
{
case nanoconda::OU_ADD_SNAPSHOT: insertIfAbsent(o); break;
case nanoconda::OU_ADD: insertOrReplace(o); break;
case nanoconda::OU_UPD: update(o); break;
case nanoconda::OU_DEL: erase(o); break;
default: break;
}
}
...
};
- Treat the book as complete only after
onlive(). - Insert
OU_ADD_SNAPSHOTorders only if the order ID is not already in the book (see Recovery During Market Close). - Clear the book on
onsnapshotstart()andongap().
Queue Order
Snapshot orders are delivered in queue priority:
- Orders from the exchange snapshot keep the exchange queue priority within each price level.
- Orders added later follow in the order they were received.
- A quantity decrease keeps an order's place; a price change or a quantity increase moves it to the back of its price level, as at the exchange.
Recovery During Market Close
While the market is closed, the feed handler can forward the exchange snapshot loops (snapshot-during-close="true"). An application that recovers while a loop is in progress can receive the rest of that loop after onlive(): OU_ADD_SNAPSHOT orders and onsnapshotend() without a preceding onsnapshotstart(). During the close these are the same orders the application already has.
- Ignore
OU_ADD_SNAPSHOTfor order IDs already in the book. - Ignore
onsnapshotend()without a precedingonsnapshotstart().
See Market Close Snapshot Cycling.
Data Loss During Recovery
If the application falls behind while the snapshot is delivered and market data of that highway is overwritten, the library restarts the recovery, up to twice. After that the instruments receive ongap(). Each loss is also reported with onslowconsumer(), see Slow Consumer Notification.
Feed Handler Behaviour
| Situation | Behaviour |
|---|---|
| Feed handler start | The order list is built from the exchange snapshot loop. Recovery is available once it is complete. |
| Repeated snapshot loops during the close | Ignored once the order list is complete |
| Unrecoverable gap | The instrument is not available for recovery until the feed handler has processed the next snapshot |
| Interrupted snapshot | The order list is rebuilt from the next complete snapshot |
| Capacity | About 12 MB of shared memory per highway, for up to 524,288 live orders per highway. An instrument that runs out of space is not available for recovery until the feed handler restarts. |
| Incremental-only feed (no snapshot lanes) | The order list holds only orders the feed handler has seen since it started. It is complete only if the feed handler started before the instrument's resting orders were entered. |
Monitoring
| Log prefix | Written by | Examples |
|---|---|---|
NACO\| LORD \| |
Feed handler | maintained in region of highway 0 entry 3, rebuilt from snapshot, orders 4247 ..., invalid until next snapshot: gap |
NACO\| MBOR \| |
Application | ESM6 MBO snapshot delivered from the live order table: 4247 orders, ESM6 MBO snapshot not recovered (...), ongap delivered |
NACO\| SLOW \| |
Application | XCME highway 0: client falling behind, 350 us behind, buffer 80% used |
Limits
- Recovery happens once, at
start(). Subscriptions are only possible beforestart(). - The snapshot contains the live orders at the time of the recovery. Order history, trades and implied orders are not part of it.
requestMBOSnapshot()has no effect in plugin backtests (cmebacktester,dbnbacktester) and in trace replay.
Feed Handler Lifecycle
The feed handler transitions through several operational phases around market close and pre-open.
Applications that manually build internal order books from individual orders must use these callbacks to maintain a correct and consistent book state.
Startup Phase
When the feed handler starts, the order book is rebuilt using the exchange snapshot loop. After snapshot completion, cached incremental updates are applied and the handler transitions into live processing.
Callback Sequence
onsnapshotstart()
onbookorder(OU_ADD_SNAPSHOT) ---> Orders received from CME snapshot loop
...
onsnapshotend()
onbookorder(OU_ADD / OU_DEL / OU_UPD) ---> Cached delta updates applied
...
onlive()
onbookorder(OU_ADD / OU_DEL / OU_UPD) ---> Live incremental updates
Client Responsibilities
- The order book must be treated as under reconstruction between
onsnapshotstart()andonsnapshotend(). - Cached delta updates must be applied immediately after snapshot completion.
- The order book should only be considered fully synchronized after
onlive()is received. - Trading logic that depends on full book integrity should only activate after
onlive().
Book Integrity Guidelines
- The order book is not guaranteed to be valid during snapshot reconstruction.
- The order book becomes incrementally consistent after cached deltas are applied.
- The order book becomes fully synchronized only after
onlive()is received.
Market Close Snapshot Cycling
When the market transitions into the CLOSE state, the feed handler can be configured to repeatedly provide the full list of active book orders via snapshot loops.
This feature allows client applications to restart prior to the next trading session and retrieve the complete set of individual resting orders required to rebuild their internal order book.
Since no new trading activity is permitted during the CLOSE state, synchronizing the internal book with the exchange becomes deterministic and straightforward.
Callback Sequence
onsecurity(CLOSE)
onsnapshotstart()
onbookorder(OU_ADD_SNAPSHOT)
onbookorder(OU_ADD_SNAPSHOT)
...
onsnapshotend()
onsnapshotstart()
onbookorder(OU_ADD_SNAPSHOT)
onbookorder(OU_ADD_SNAPSHOT)
...
onsnapshotend()
...
This snapshot cycling may continue throughout the closed session.
When the market transitions into PRE_OPEN, the handler resumes live incremental processing.
Client Responsibilities
- Snapshot cycling during the closed session can be enabled with
snapshot-during-close="true". See Feed Node configuration options. - The client should process only the first snapshot rebuild loop after receiving
onsecurity(CLOSE). -
After the first
onsnapshotstart()→onsnapshotend()cycle completes, the client should:- Treat the resulting order book as a frozen reference state.
- Ignore subsequent
OU_ADD_SNAPSHOTupdates while the instrument remains in theCLOSEstate.
-
The client must not assume book stability or trading readiness during repeated snapshot phases.
- Normal live incremental processing resumes once the instrument transitions into
PRE_OPEN.
Book Integrity During Market Close
- During the
CLOSEstate, snapshot loops provide reference state only and should not be treated as live market state. - During the
CLOSEstate, snapshot loops allow for clients who use full L3 / MBO data to restart their application and get the current book state.
Book Integrity Table
| Phase | Book Source | Book Integrity | Trading Readiness |
|---|---|---|---|
| Snapshot rebuild | Snapshot loop | Not current | No |
| Delta apply | Cached incremental updates | Improving | No |
| Live mode | Incremental updates | Current | Yes |
| Market closed snapshot cycling | Snapshot loop | Reference only | N/A |