NxCore3Ext
Only applies to .nx3 format tapes. The structure NxCore3Ext is defined in NxCoreAPI.h as:
struct NxCore3Ext {
// NxCore3 extended microsecond data
unsigned __int64 MicrosOfDaySRC;
unsigned __int64 MicrosOfDayPTP1;
unsigned __int64 MicrosOfDayPTP2;
unsigned __int64 FractionalSize;
unsigned __int64 FractionalTotalVolume;
unsigned __int64 alignment[3];
};
Microsecond timestamp from data source, such as CME or SIP.
Microsecond timestamp from the participant (exchange).
Microsecond timestamp taken from reports.
Size of Trade with 6 implied decimal place. This member will be 0 for feeds that do not report fractional shares and non-trade messages.
FractionalTotalVolume is the total volume with 6 implied decimal place. FractionalTotalVolume is the cumulative sum of the FractionalSize member of all trade updates with the VolumeType NxTVT_INCRVOL. FractionalTotalVolume is the value of the FractionalSize member for the most recent trade update with a VolumeType NxTVT_TOTALVOL or NxTVT_TOTALVOLX100. This member will be 0 for feeds that do not report fractional shares and non-trade messages.
Here's an example of how to extract microsecond timestamps and fractional shares when present.
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include "NxCoreAPI.h" #include "NxCoreAPI_Wrapper_C++.h" NxCoreClass NxCore; int __stdcall nxCoreCallback(const NxCoreSystem* pNxCoreSys, const NxCoreMessage* pNxCoreMessage) { switch (pNxCoreMessage->MessageType) { case NxMSG_TRADE: const NxCoreTrade& nt = pNxCoreMessage->coreData.Trade; const NxCoreHeader& ch = pNxCoreMessage->coreHeader; const NxTime& t = ch.nxExgTimestamp; double dTotalVolume, dSize; int microsecond; NxCore3Ext* pnxCore3Ext = pNxCoreMessage->pnxCore3Ext; if(pnxCore3Ext && pnxCore3Ext->MicrosOfDaySRC) microsecond = pnxCore3Ext->MicrosOfDaySRC % 1000000;//Get microsecond portion of microseconds of day. else microsecond = t.Millisecond * 1000; //Get trade size as a floating point number if(pnxCore3Ext && pnxCore3Ext->FractionalSize) dSize = 0.000001 * pnxCore3Ext->FractionalSize;//shift FractionalSize 6 decimal places else dSize = nt.Size; if(pnxCore3Ext && pnxCore3Ext->FractionalTotalVolume) dTotalVolume = 0.000001 * pnxCore3Ext->FractionalTotalVolume;//shift FractionalTotalVolume 6 decimal places else dTotalVolume = nt.TotalVolume; printf("%02d:%02d:%02d.%06d %s Price(%.6f@%.2f) O(%.2f) H(%.2f) L(%.2f) C(%.2f) V(%.6f) Net(%.2f)\n", (int) t.Hour, (int) t.Minute, (int) t.Second, (int) microsecond, ch.pnxStringSymbol->String, dSize, NxCore.PriceToDouble(nt.Price, nt.PriceType), NxCore.PriceToDouble(nt.Open, nt.PriceType), NxCore.PriceToDouble(nt.High, nt.PriceType), NxCore.PriceToDouble(nt.Low, nt.PriceType), NxCore.PriceToDouble(nt.Last, nt.PriceType), dTotalVolume, NxCore.PriceToDouble(nt.NetChange, nt.PriceType)); break; } return NxCALLBACKRETURN_CONTINUE; } int main(int argc, char** argv) { if (!NxCore.LoadNxCore("NxCoreAPI64.dll") && !NxCore.LoadNxCore("NxCoreAPI.dll")) { printf("loading library failed\n"); return -1; } NxCore.ProcessTape(argv[1], 0, NxCF_EXCLUDE_CRC_CHECK, 0, nxCoreCallback); return 0; } |
import net.nanex.NxCoreClass; class NxCore3ExtSample extends NxCoreClass{ @Override public int OnNxCoreCallback(NxCoreSystem nxCoreSys, NxCoreMessage nxCoreMsg) { switch (nxCoreMsg.MessageType) { case defines.NxMSG_TRADE: NxCoreTrade nt = nxCoreMsg.coreData.Trade; NxCoreHeader ch = nxCoreMsg.coreHeader; NxTime t = ch.nxExgTimestamp; double dTotalVolume, dSize; int microsecond; NxCore3Ext pnxCore3Ext = nxCoreMsg.pnxCore3Ext; if(pnxCore3Ext != null && pnxCore3Ext.MicrosOfDaySRC != 0) microsecond = (int)(pnxCore3Ext.MicrosOfDaySRC % 1000000);//Get microsecond portion of microseconds of day. else microsecond = t.Millisecond * 1000; //Get trade size as a floating point number if(pnxCore3Ext != null && pnxCore3Ext.FractionalSize != 0) dSize = 0.000001 * pnxCore3Ext.FractionalSize;//shift FractionalSize 6 decimal places else dSize = nt.Size; if(pnxCore3Ext != null && pnxCore3Ext.FractionalTotalVolume != 0) dTotalVolume = 0.000001 * pnxCore3Ext.FractionalTotalVolume;//shift FractionalTotalVolume 6 decimal places else dTotalVolume = nt.TotalVolume; System.out.println(String.format("%02d:%02d:%02d.%06d %s Price(%.6f@%.2f) O(%.2f) H(%.2f) L(%.2f) C(%.2f) V(%.6f) Net(%.2f)", t.Hour, t.Minute, t.Second, microsecond, ch.pnxStringSymbol.String, dSize, PriceToDouble(nt.Price, nt.PriceType), PriceToDouble(nt.Open, nt.PriceType), PriceToDouble(nt.High, nt.PriceType), PriceToDouble(nt.Low, nt.PriceType), PriceToDouble(nt.Last, nt.PriceType), dTotalVolume, PriceToDouble(nt.NetChange, nt.PriceType))); break; } return defines.NxCALLBACKRETURN_CONTINUE; } public static void main(String args[]) { NxCore3ExtSample nxCore = new NxCore3ExtSample(); if (nxCore.LoadNxCore("NxCoreAPI64.dll") != 0 ){ nxCore.ProcessTape(args[0], 0, defines.NxCF_EXCLUDE_CRC_CHECK, 0); } else System.out.println("loading library failed"); } } |
import NxCore tapePath = "" def OnNxCoreCallback(NxCoreSys, NxCoreMsg): if NxCoreMsg.MessageType == NxCore.NxMSG_TRADE: nt = NxCoreMsg.coreData.Trade ch = NxCoreMsg.coreHeader t = ch.nxExgTimestamp pnxCore3Ext = NxCoreMsg.pnxCore3Ext; if pnxCore3Ext and pnxCore3Ext.MicrosOfDaySRC: microsecond = pnxCore3Ext.MicrosOfDaySRC % 1000000;#Get microsecond portion of microseconds of day. else: microsecond = t.Millisecond * 1000; #Get trade size as a floating point number if pnxCore3Ext and pnxCore3Ext.FractionalSize: dSize = 0.000001 * pnxCore3Ext.FractionalSize;#shift FractionalSize 6 decimal places else: dSize = nt.Size; if pnxCore3Ext and pnxCore3Ext.FractionalTotalVolume: dTotalVolume = 0.000001 * pnxCore3Ext.FractionalTotalVolume;#shift FractionalTotalVolume 6 decimal places else: dTotalVolume = nt.TotalVolume; print("{:02d}:{:02d}:{:02d}.{:06d} {} Price({:.6f}@{:.2f}) O({:.2f}) H({:.2f}) L({:.2f}) C({:.2f}) V({:.6f}) Net({:.2f})".format( t.Hour, t.Minute, t.Second, microsecond, ch.pnxStringSymbol.String, dSize, NxCore.PriceToDouble(nt.Price, nt.PriceType), NxCore.PriceToDouble(nt.Open, nt.PriceType), NxCore.PriceToDouble(nt.High, nt.PriceType), NxCore.PriceToDouble(nt.Low, nt.PriceType), NxCore.PriceToDouble(nt.Last, nt.PriceType), dTotalVolume, NxCore.PriceToDouble(nt.NetChange, nt.PriceType))) return NxCore.NxCALLBACKRETURN_CONTINUE if NxCore.LoadNxCore("NxCoreAPI64.dll"): returnValue = NxCore.ProcessTape(tapePath, 0, NxCore.NxCF_EXCLUDE_CRC_CHECK, 0, OnNxCoreCallback) else: print("loading library failed") |
using System; using NxCoreAPI; class NxCore3ExtSample { static unsafe int OnNxCoreCallback(NxCoreSystem* pNxCoreSys, NxCoreMessage* pNxCoreMsg) { if (pNxCoreMsg->MessageType == NxCore.NxMSG_TRADE) { NxCoreTrade* pTrade = &pNxCoreMsg->coreData.Trade; NxCoreHeader* pHeader = &pNxCoreMsg->coreHeader; NxTime* pTimestamp = &pHeader->nxExgTimestamp; double dTotalVolume, dSize; int microsecond; NxCore3Ext* pnxCore3Ext = pNxCoreMsg->pnxCore3Ext; if(pnxCore3Ext != null && pnxCore3Ext->MicrosOfDaySRC != 0) microsecond = (int)(pnxCore3Ext->MicrosOfDaySRC % 1000000);//Get microsecond portion of microseconds of day. else microsecond = pTimestamp->Millisecond * 1000; //Get trade size as a floating point number if(pnxCore3Ext != null && pnxCore3Ext->FractionalSize != 0) dSize = 0.000001 * pnxCore3Ext->FractionalSize;//shift FractionalSize 6 decimal places else dSize = pTrade->Size; if(pnxCore3Ext != null && pnxCore3Ext->FractionalTotalVolume != 0) dTotalVolume = 0.000001 * pnxCore3Ext->FractionalTotalVolume;//shift FractionalTotalVolume 6 decimal places else dTotalVolume = pTrade->TotalVolume; Console.WriteLine("{0:d2}:{1:d2}:{2:d2}.{3:d6} {4:s} Price({5:f6}@{6:f2}) O({7:f2}) H({8:f2}) L({9:f2}) C({10:f2}) V({11:f6}) Net({12:f2})", pTimestamp->Hour, pTimestamp->Minute, pTimestamp->Second, microsecond, new String(&pHeader->pnxStringSymbol->String), dSize, NxCore.PriceToDouble(pTrade->Price, pTrade->PriceType), NxCore.PriceToDouble(pTrade->Open, pTrade->PriceType), NxCore.PriceToDouble(pTrade->High, pTrade->PriceType), NxCore.PriceToDouble(pTrade->Low, pTrade->PriceType), NxCore.PriceToDouble(pTrade->Last, pTrade->PriceType), dTotalVolume, NxCore.PriceToDouble(pTrade->NetChange, pTrade->PriceType)); } return NxCore.NxCALLBACKRETURN_CONTINUE; } static unsafe void Main(string[] args) { if (args.Length < 1) return; int returnValue = NxCore.ProcessTape(args[0], null, 0, 0, SampleApp1.OnNxCoreCallback); NxCore.processReturnValue(returnValue); } } |
#include "stdio.h" #include "NxCoreAPI_Wrapper_C.h" int OnNxCoreCallback(const NxCoreSystem* pNxCoreSys, const NxCoreMessage* pNxCoreMsg) { if(pNxCoreMsg->MessageType == NxMSG_TRADE) { const NxCoreTrade* pTrade = &pNxCoreMsg->coreData.Trade; const NxCoreHeader* pHeader = &pNxCoreMsg->coreHeader; const NxTime* pTimestamp = &pHeader->nxExgTimestamp; double dTotalVolume, dSize; int microsecond; NxCore3Ext* pnxCore3Ext = pNxCoreMsg->pnxCore3Ext; if(pnxCore3Ext && pnxCore3Ext->MicrosOfDaySRC) microsecond = pnxCore3Ext->MicrosOfDaySRC % 1000000;//Get microsecond portion of microseconds of day. else microsecond = pTimestamp->Millisecond * 1000; //Get trade size as a floating point number if(pnxCore3Ext && pnxCore3Ext->FractionalSize) dSize = 0.000001 * pnxCore3Ext->FractionalSize;//shift FractionalSize 6 decimal places else dSize = pTrade->Size; if(pnxCore3Ext && pnxCore3Ext->FractionalTotalVolume) dTotalVolume = 0.000001 * pnxCore3Ext->FractionalTotalVolume;//shift FractionalTotalVolume 6 decimal places else dTotalVolume = pTrade->TotalVolume; printf("%02d:%02d:%02d.%06d %s Price(%.6f@%.2f) O(%.2f) H(%.2f) L(%.2f) C(%.2f) V(%.6f) Net(%.2f)\n", (int) pTimestamp->Hour, (int) pTimestamp->Minute, (int) pTimestamp->Second, (int) microsecond, pHeader->pnxStringSymbol->String, dSize, pfNxCorePriceToDouble(pTrade->Price, pTrade->PriceType), pfNxCorePriceToDouble(pTrade->Open, pTrade->PriceType), pfNxCorePriceToDouble(pTrade->High, pTrade->PriceType), pfNxCorePriceToDouble(pTrade->Low, pTrade->PriceType), pfNxCorePriceToDouble(pTrade->Last, pTrade->PriceType), dTotalVolume, pfNxCorePriceToDouble(pTrade->NetChange, pTrade->PriceType)); } return NxCALLBACKRETURN_CONTINUE; } int main(int argc, char* argv[]) { if (argc < 3) return 1; if (LoadNxCore(argv[1])){ int returnValue = pfNxCoreProcessTape(argv[2], 0, 0, 0, OnNxCoreCallback); processReturnValue(returnValue); } else printf("loading library failed\n"); return 0; } |