API Documentation

Language: C++ Java Python
Basic: Intro/Trade Quote Category Status Symbol Options
Detailed: Trade Quote

Introduction to Symbols

This guide assumes you have already read the "Getting Started With Trades" guide. All symbols will receive either a NxMSG_SYMBOLSPIN message or an add NxMSG_SYMBOLCHANGE message. Near the start of the tape, a symbol spin mesage is sent for all existing symbols. If a new symbol is added afterwards, then it receives a Symbol Change message instead. By looking at both of these message types it is possible to get a complete list of symbols.

Code

import NxCore

def OnNxCoreCallback(NxCoreSys, NxCoreMsg):
    if NxCoreMsg.MessageType == NxCore.NxMSG_SYMBOLSPIN:

        header = NxCoreMsg.coreHeader
        symbol = header.pnxStringSymbol.String
        exchange = NxCore.GetDefinedString(NxCore.NxST_EXCHANGE, header.ListedExg)

        print("symbol {} listed on {}".format(symbol, exchange))
    if NxCoreMsg.MessageType == NxCore.NxMSG_SYMBOLCHANGE and NxCoreMsg.coreData.SymbolChange.Status == NxCore.NxSS_ADD:

        header = NxCoreMsg.coreHeader
        symbol = header.pnxStringSymbol.String
        exchange = NxCore.GetDefinedString(NxCore.NxST_EXCHANGE, header.ListedExg)

        print("new symbol {} listed on {}".format(symbol, exchange))

    return NxCore.NxCALLBACKRETURN_CONTINUE

if NxCore.LoadNxCore("NxCoreAPI64.dll"):
    returnValue = NxCore.ProcessTape("demo.XU.nx2", 0, 0, 0, OnNxCoreCallback)
    NxCore.ProcessReturnValue(returnValue)
else:
    print("loading library failed")

Symbol Spin

Near the start of each tape a Symbol Spin message is sent for every symbol present at that time. coreHeader will be populated with the symbol information. Usually it will not be necessary to process the SymbolSpin object in coreData.

if NxCoreMsg.MessageType == NxCore.NxMSG_SYMBOLSPIN:
    header = NxCoreMsg.coreHeader
    symbol = header.pnxStringSymbol.String
    exchange = NxCore.GetDefinedString(
        NxCore.NxST_EXCHANGE, header.ListedExg)
		
	

Symbol Change

Symbol Change messages can either be sent for newly added symbols or symbols that the source feed reports as deleted. The Status field indicates whether it is an added or deleted symbol.

if NxCoreMsg.MessageType == NxCore.NxMSG_SYMBOLCHANGE and
    NxCoreMsg.coreData.SymbolChange.Status == NxCore.NxSS_ADD:

    header = NxCoreMsg.coreHeader
    symbol = header.pnxStringSymbol.String
    exchange = NxCore.GetDefinedString(
        NxCore.NxST_EXCHANGE, header.ListedExg)

Next:
Options