NxCoreStateExgQuote
One of a number of regional exchange quotes in NxCoreStateExgQuotes.StateExgQuotes
The structure NxCoreStateExgQuote is defined in NxCoreAPI.h as:
struct NxCoreStateExgQuote { int AskPrice; int BidPrice; int AskSize; int BidSize; unsigned short ReportingExg; unsigned char QuoteCondition; unsigned char alignment[1]; };
Represents the value of the current ask from the exchange identified as ReportingExg.
Use PriceType to convert to double: nxCoreClass.PriceToDouble(AskPrice, PriceType)
Represents the value of the current bid from the exchange identified as ReportingExg.
Use PriceType to convert to double: nxCoreClass.PriceToDouble(BidPrice, PriceType)
Represents the size of the current Ask from the exchange ReportingExg. For most equities, the AskSize represents the number of round lots (a round lot is 100 shares in this case). For options contracts, the AskSize represents the number of option contracts. The size fields are set to the values as sent by the exchanges.
Represents the size of the current Bid from the exchange ReportingExg. For most equities, the BidSize represents the number of round lots (a round lot is 100 shares in this case). For options contracts, the BidSize represents the number of option contracts. The size fields are set to the values as sent by the exchanges.
The reporting exchange for this quote. Can be compared against BestAskExg or BestBidExg to determine NBBO
Described here
Here's an example of getting the Exg quote information for every symbol that trades
#define _CRT_SECURE_NO_WARNINGS #include <windows.h> #include <stdio.h> #include "NxCoreAPI.h" #include "NxCoreAPI_class.h" NxCoreClass nxCoreClass; NxString *getSymbol(const NxCoreMessage* pNxCoreMsg,char *Symbol) { // Is this a valid option? if ((pNxCoreMsg->coreHeader.pnxStringSymbol->String[0]=='o')&&(pNxCoreMsg->coreHeader.pnxOptionHdr)) { // If pnxsDateAndStrike->String[1] == ' ', then this symbol is in new OSI format. if (pNxCoreMsg->coreHeader.pnxOptionHdr->pnxsDateAndStrike->String[1]==' ') { sprintf(Symbol,"%s%02d%02d%02d%c%08d", pNxCoreMsg->coreHeader.pnxStringSymbol->String, pNxCoreMsg->coreHeader.pnxOptionHdr->nxExpirationDate.Year-2000, pNxCoreMsg->coreHeader.pnxOptionHdr->nxExpirationDate.Month, pNxCoreMsg->coreHeader.pnxOptionHdr->nxExpirationDate.Day, (pNxCoreMsg->coreHeader.pnxOptionHdr->PutCall == 0) ? 'C' : 'P', pNxCoreMsg->coreHeader.pnxOptionHdr->strikePrice); } // Otherwise the symbol is in old OPRA format. else { sprintf(Symbol,"%s%c%c", pNxCoreMsg->coreHeader.pnxStringSymbol->String, pNxCoreMsg->coreHeader.pnxOptionHdr->pnxsDateAndStrike->String[0], pNxCoreMsg->coreHeader.pnxOptionHdr->pnxsDateAndStrike->String[1]); } // Return nx date-strike string ptr return pNxCoreMsg->coreHeader.pnxOptionHdr->pnxsDateAndStrike; } // Not an option, just copy the symbol and return nx string ptr strcpy(Symbol,pNxCoreMsg->coreHeader.pnxStringSymbol->String); return pNxCoreMsg->coreHeader.pnxStringSymbol; } int __stdcall nxCoreCallback(const NxCoreSystem* pNxCoreSys, const NxCoreMessage* pNxCoreMessage) { switch (pNxCoreMessage->MessageType) { case NxMSG_TRADE: { const NxCoreHeader& ch = pNxCoreMessage->coreHeader; const NxTime& t = pNxCoreSys->nxTime; // Get the symbol and the correct string pointer char symbol[23]; NxString* nx =getSymbol(pNxCoreMessage,symbol); // get the state data for current Exchange Quotes NxCoreStateExgQuotes q; int rc = nxCoreClass.StateGetExgQuotes(&q, nx); if (rc != 0) { break; } // print the data char buf[1024]; char* p = buf; for (int i = 0; i < q.StateQuoteCount; i++) { const NxCoreStateExgQuote& eq = q.StateExgQuotes[i]; if (eq.BidPrice > 0 && eq.BidSize > 0) { p += sprintf(p, "%s_bid(%ld @ %.2lf)[%ld] ", q.BestBidExg == eq.ReportingExg ? "BBO" : "RGN", eq.BidSize, nxCoreClass.PriceToDouble(eq.BidPrice, q.PriceType), eq.ReportingExg); } if (eq.AskPrice > 0 && eq.AskSize > 0) { p += sprintf(p, "%s_ask(%ld @ %.2lf)[%ld] ", q.BestAskExg == eq.ReportingExg ? "BBO" : "RGN", eq.AskSize, nxCoreClass.PriceToDouble(eq.AskPrice, q.PriceType), eq.ReportingExg); } } if (p > buf) { printf("%.2d:%.2d:%.2d.%.3d %s %s\n", (int) t.Hour, (int) t.Minute, (int) t.Second, (int) t.Millisecond, symbol, buf); } break; } } return NxCALLBACKRETURN_CONTINUE; } int main(int argc, char** argv) { if (!nxCoreClass.LoadNxCore("NxCoreAPI.dll") && !nxCoreClass.LoadNxCore("C:\\Program Files\\Nanex\\NxCoreAPI\\NxCoreAPI.dll")) { fprintf(stderr, "Can't find NxCoreAPI.dll\n"); return -1; } nxCoreClass.ProcessTape(argv[1], 0, NxCF_EXCLUDE_CRC_CHECK, 0, nxCoreCallback); return 0; }