Threading and Memory model
Nanoconda API allows for a very flexible threading model. You are free to create your own threads for internal processing or controlling orders as well as creating threads inside nanoconda API.
Nanoconda threads
Whenever you subscribe to a topic, such as market data for an instrument or exchange updates for your trading session, you have a choice of placing the callbacks of the new topic to an existing thread or to create a new thread for the topic.
This is controlled by the last argument to subscribe() / subscribeUnderlying or to dmasession::init()
static dmasession* init(const char* accountName, reasoncode& reason, short cpu = -1);
reasoncode subscribe(const char* symbol, const char* entitlement, short cpu = -1);
reasoncode subscribeUnderlying(const char* symbol, const char* entitlement, short cpu = -1);
nanoconda::subscribe("ESM4", "XCME", 3); // subscribe to ESM4 Futures on a new thread pinned to cpu #3
nanoconda::subscribeUnderlying("NQ", "XCME", 3); // subscribe to ESM4 Futures on same thread on cpu #3
nanoconda::reasoncode rcode;
nanoconda::dmasession::init("accountID100", rcode, 1); //subscribe to account updates on a new thread on cpu #1
Tip
a) Whenever a new cpu argument is provided the library creates a new thread pinned to the cpu ID.
b) If cpu number was provided in a previous subscription method then the new subscription will be placed onto the same thread.
c) If cpu argument is ommited then the new subscription will be placed onto a default thread and it will not be pinned.
d) If cpu is invalid then reasoncode::CPU_OUT_OF_BOUNDS will be returned.
User threads
If it is necessary to create additional threads for your internal work, you are free to do so - you have access to full c++ threads and pthreads.
Additionally you do not need to worry about threading when submitting orders to nanoconda::dmasession as order management calls are thread safe!
Memory Architecture
Your container will have access to a shared memory region.
All communications between your application and the exchange are handled via the API and are going through the memory region.
Nanoconda Managed Services are in charge of running the market data normalization processes and keeping trading sessions in operational state.
You can start and stop your application at any time.
Server Diagram
