NxCoreStateMMQuote

One of a number of market maker quotes in NxCoreStateMMQuotes.StateMMQuotes

The struct NxCoreStateMMQuote is defined in NxCoreAPI.h as:

struct NxCoreStateMMQuote {
    int                 AskPrice;
    int                 BidPrice;
    int                 AskSize;
    int                 BidSize;
    NxString*           pnxStringMarketMaker;
    unsigned char       MarketMakerType;
    unsigned char       QuoteType;
    unsigned char       alignment[2];
};

AskPrice

Represents the value of the current ask from the market maker identified as pnxStringMarketMaker.

Use PriceType to convert to double: nxCoreClass.PriceToDouble(AskPrice, PriceType)

BidPrice

Represents the value of the current bid from the market maker identified as pnxStringMarketMaker.

Use PriceType to convert to double: nxCoreClass.PriceToDouble(BidPrice, PriceType)

AskSize

Represents the size of the current Ask from the market maker identified as pnxStringMarketMaker. 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.

BidSize

Represents the size of the current Bid from the market maker identified as pnxStringMarketMaker. 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.

pnxStringMarketMaker

Described here

MarketMakerType

Described here

QuoteType

Described here

Example

Here's an example of getting the MM 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;    
  
int __stdcall nxCoreCallback(const NxCoreSystem* pNxCoreSys, const NxCoreMessage* pNxCoreMessage)
{
    switch (pNxCoreMessage->MessageType)
    {
        case NxMSG_TRADE:
        {
            // If this is an option exit out....options don't have market maker data which is what we
            // want to retrive below.
            if (pNxCoreMessage->coreHeader.pnxStringSymbol->String[0]=='o') return NxCALLBACKRETURN_CONTINUE;    
  
            const NxCoreHeader& ch = pNxCoreMessage->coreHeader;
            const NxTime&       t  = pNxCoreSys->nxTime;    
  
            // First get exchange quotes so we have a list of possible exchanges to query for MM states
            NxCoreStateExgQuotes q;
            int rc = nxCoreClass.StateGetExgQuotes(&q, pNxCoreMessage->coreHeader.pnxStringSymbol);
            if (rc != 0)
            {
                break;
            }    
  
            char buf[16 * 1024];    
  
            // Cycle through the exchanges returned in exg state quotes
            for (int eqi = 0; eqi < q.StateQuoteCount; eqi++)
            {    
  
                // Now get the Market Maker state quotes for symbol and for the specific exchange
                NxCoreStateMMQuotes mmq;
                rc = nxCoreClass.StateGetMMQuotes(q.StateExgQuotes[eqi].ReportingExg, &mmq, pNxCoreMessage->coreHeader.pnxStringSymbol);
                if (rc != 0)
                {
                    continue;
                }    
  
                char* p = buf;
                bool printThis = false;    
  
                p += sprintf(p, "\n  Exg[%d] ", q.StateExgQuotes[eqi].ReportingExg);    
  
                // Now cycle through the state quotes and print data
                for (int i = 0; i < mmq.StateQuoteCount; i++)
                {
                    const NxCoreStateMMQuote& mm = mmq.StateMMQuotes[i];    
  
                    p += sprintf(p, "\n     ");    
  
                    if (mm.BidPrice > 0 && mm.BidSize > 0)
                    {
                        printThis = true;
                        p += sprintf(p, "%s_bid(%ld @ %.2lf) ",
                            mm.pnxStringMarketMaker->String,
                            mm.BidSize, nxCoreClass.PriceToDouble(mm.BidPrice, mmq.PriceType));
                    }
                    if (mm.AskPrice > 0 && mm.AskSize > 0)
                    {
                        printThis = true;
                        p += sprintf(p, "%s_ask(%ld @ %.2lf) ",
                            mm.pnxStringMarketMaker->String,
                            mm.AskSize, nxCoreClass.PriceToDouble(mm.AskPrice, mmq.PriceType));
                    }
                }
                if (printThis)
                {
                    printf("%.2d:%.2d:%.2d.%.3d %s %s\n",
                        (int) t.Hour, (int) t.Minute, (int) t.Second, (int) t.Millisecond,
                        pNxCoreMessage->coreHeader.pnxStringSymbol->String, 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;
}