API Documentation

NxCoreSymbolChange

The struct NxCoreSymbolChange is defined in NxCoreAPI.h as:


struct NxCoreSymbolChange {
    unsigned char  Status;
    char           StatusChar;
    unsigned short alignment;
    NxString*      pnxsSymbolOld;
    NxOptionHdr*   pnxOptionHdrOld;
    unsigned short ListedExgOld;
    unsigned char  alignment2[2];
};

Status

Indicates, using an integer, whether the symbol change is an ADD, MODIFY or DELETE

#define Value Meaning
NxSS_ADD 0 Symbol formally added effective immediately
NxSS_DEL 1 Symbol is set for deletion at end of tape.
NxSS_MOD 2 Symbol string and or listed exchange has changed effective immediately. pnxsSymbolOld, pnxOptionHdrOld, and ListedExgOld are also set.

StatusChar

Indicates, using a character, whether the symbol change is an 'A'DD, 'M'ODIFY or 'D'ELETE

Value Meaning
'A' Symbol formally added effective immediately
'D' Symbol is set for deletion at end of tape.
'M' Symbol string and or listed exchange has changed effective immediately. pnxsSymbolOld, pnxOptionHdrOld, and ListedExgOld are also set.

pnxsSymbolOld

Only used on a MODIFY message. Contains the original Symbol structure of the symbol before the change.

pnxOptionHdrOld

Only set (non-zero) for MODIFY type messages for option contracts. It contains a pointer to the OptionHeader information that was transmitted with the option contract that is changing.

ListedExgOld

Only used on a MODIFY message. Contains the original Listed Exchange structure of the symbol before the change.

Symbols and exchanges

If Status New Symbol New Exchange Original Symbol Original Exchange
NxSS_ADD pNxCoreMessage->coreHeader.ListedExg pNxCoreMessage->coreHeader.pnxStringSymbol

NxSS_DEL pNxCoreMessage->coreHeader.ListedExg pNxCoreMessage->coreHeader.pnxStringSymbol

NxSS_MOD pNxCoreMessage->coreHeader.ListedExg pNxCoreMessage->coreHeader.pnxStringSymbol pnxsSymbolOld ListedExgOld

Example Code

The following lines of code from a NxCoreAPI callback function shows a simple transfer of UserData1 and UserData2 values for NxCoreSymbolChange Modify messages:


switch (pNxCoreMessage->coreData.SymbolChange.Status)
{
    case NxSS_MOD:
    {
        NxString* pnxsOld;
        NxString* pnxsNew;
    
        // modify. Simply move values in old symbols UserData1 and UserData2 fields to
        // the new symbol's UserData1 and UserData2 fields.
        pnxsOld = pNxCoreMessage->coreData.SymbolChange.pnxsSymbolOld;
        if (pnxsOld)
        {
            pnxsNew = pNxCoreMessage->coreHeader.pnxStringSymbol;
            pnxsNew->UserData1 = pnxOld->UserData1;
            pnxsNew->UserData2 = pnxOld->UserData2;
            
            // it might be a good idea to zero out the old symbol's UserData fields if duplication is a problem
            pnxOld->UserData1 = 0;
            pnxOld->UserData2 = 0;
        }
        break;
    }

    case NxSS_ADD:
        // you could just process this like any other symbol the first time it appears.
        break;

    case NxSS_DEL:
        // be careful not to actually delete your structures here
        // better to mark them deleted or do nothing at all
        break;
}

Notes

The pointer to the NxString structure used for each symbol will remain valid for the duration of the tape, so the "old" symbol will not be deleted internally by NxCoreAPI and in some cases may be sent again later in the tape. It is a simple matter of setting the UserData fields for the old symbol if you want to ignore any further messages.

There is one NxMSG_SYMBOLCHANGE update for each option contract being Added, Deleted, or Modified. Usually all option contracts will change to a new Option Root Symbol at the same time (corporate event), but there are some cases where only certain expiration months change Option Root Symbols (e.g. during the leap conversion process in May, June, and July), and some cases where only certain strikes change to a new Option Root Symbol (when strike codes are exhausted and there is consolidation for example).

You may decide to ignore one or more of these types of messages -- the NxCoreAPI system does not require you to take action.