NxCoreClass
The class NxCoreClass is a helper class defined in NxCoreAPI_class.h to wrap the NxCoreAPI.dll and provide easy access to its functions. In many ways it is easier to use than the "C"-based approached shown in basics
#include "NxCoreAPI.h"
#include "NxCoreAPI_class.h"
NxCoreClass nxCoreClass;
int __stdcall nxCoreCallback(const NxCoreSystem* pNxCoreSys, const NxCoreMessage* pNxCoreMsg)
{
printf("in nxCoreCallback\n");
return NxCALLBACKRETURN_RETURN;
}
void startProcessing(const char* tape)
{
if (!nxCoreClass.LoadNxCore("NxCoreAPI.dll") &&
!nxCoreClass.LoadNxCore("C:\\Program Files\\Nanex\\NxCoreAPI\\NxCoreAPI.dll"))
{
fprintf(stderr, "Can't find NxCoreAPI.dll\n");
exit(-1);
}
nxCoreClass.ProcessTape(tape, 0, NxCF_EXCLUDE_CRC_CHECK, 0, nxCoreCallback);
}
The class NxCoreClass is shown here in abbreviated format:
Get the API version
#define cszNxCoreAPIVersion "sNxCoreAPIVersion"
unsigned int APIVersion(
);
Starting point for Processing an NxCore Tape.
#define cszNxCoreProcessTape "sNxCoreProcessTape"
int ProcessTape(
const char* pszFilename,
const char* pMemoryAddr,
unsigned int controlFlags,
int UserData,
NxCoreCallback callbackFunction
);
Lists all available tapes on this computer
#define cszNxCoreListTapes "sNxCoreListTapes"
int ListTapes(
unsigned int controlFlags,
NxCoreCallbackTapeList stdcallbacklist,
void* pYourParam
);
Lists all available NxCoreAPI.dll files on this computer
#define cszNxCoreListAPIDLLs "sNxCoreListAPIDLLs"
int ListAPIDLLs(
unsigned int controlFlags,
NxCoreCallbackAPIList stdcallbacklist,
void* pYourParam
);
Starts a SymbolSpin which iteration each symbol for one or all List Exchanges.
#define cszNxCoreSpinSymbols "sNxCoreSpinSymbols"
int SpinSymbols(
unsigned short ListedExg,
unsigned int controlFlags,
unsigned int spinID,
NxCoreCallback tempCallback=0,
int tempUserData=0
);
Creates a NxCore Tape "Bookmark" that NxCoreAPI can use as a starting point.
#define cszNxCoreSaveState "sNxCoreSaveState"
int SaveState(
const char* szStateFilename,
unsigned int controlFlags
);
#define cszNxCoreGetStateData "sNxCoreGetStateData"
int GetStateData(
char* pBuffer,
int bufferSize,
int stateType,
int param1,
int param2,
NxString* pnxsSymOrCtc
);
Returns the current Memory State of a Symbol's Exchange Quotes.
#define cszNxCoreStateGetExgQuotes "sNxCoreStateGetExgQuotes"
int StateGetExgQuotes(
NxCoreStateExgQuotes* pStateExgQuotes,
NxString* pnxsSymOrDateStrike=0
);
Returns the current Memory State of a Symbol's MM Quotes.
#define cszNxCoreStateGetMMQuotes "sNxCoreStateGetMMQuotes"
int StateGetMMQuotes(
unsigned short ReportingExg,
NxCoreStateMMQuotes* pStateMMQuotes,
NxString* pnxsSymOrDateStrike=0
);
Returns the current Memory State of a Symbol's Open, High, Low, Last, Volume Data.
#define cszNxCoreStateGetLastTrade "sNxCoreStateGetLastTrade"
int StateGetLastTrade(
NxCoreStateTrade* pStateTrade,
NxString* pnxsSymOrDateStrike=0
);
Converts an integer price from one price type to another.
#define cszNxCorePriceConvert "sNxCorePriceConvert"
int PriceConvert(
int lPrice,
unsigned char PriceType,
unsigned char PriceTypeNew
);
Converts an integer price and price type into an Ascii string (like sprintf)
#define cszNxCorePriceFormat "sNxCorePriceFormat"
int PriceFormat(
char* szBuff,
int lPrice,
unsigned char PriceType,
int expandWidth=0,
bool bCommas=false
);
Converts an integer price and PriceType to a double floating value.
#define cszNxCorePriceToDouble "sNxCorePriceToDouble"
double PriceToDouble(
int lPrice,
unsigned char PriceType
);
Computes the NxDate members from the NDays member.
#define cszNxCoreDateFromNDays "sNxCoreDateFromNDays"
void DateFromNDays(
NxDate* pnxDate
);
Computes the NxDate members from the Year, Month, Day members.
#define cszNxCoreDateFromYMD "sNxCoreDateFromYMD"
void DateFromYMD(
NxDate* pnxDate
);
Converts a string index into an pre-defined null-terminated ASCII string.
#define cszNxCoreGetDefinedString "sNxCoreGetDefinedString"
const char* GetDefinedString(
int ixTable,
int ixString
);
Returns the full path filename of the NxCore Tape being processed.
#define cszNxCoreGetTapeName "sNxCoreGetTapeName"
int GetTapeName(
char* szBuffTapename,
int nBufferBytes
);
#define cszNxCoreSignalWaitEvent "sNxCoreSignalWaitEvent"
int SignalWaitEvent(
const NxCoreSystem* pNxCoreSystem,
bool bAlwaysSignal
);
Callback Functions
typedef int (__stdcall *NxCoreCallback) (const NxCoreSystem* pNxCoreSys, const NxCoreMessage* pNxCoreMsg);
typedef int (__stdcall *NxCoreCallbackTapeList) (void* pYourParam, const NxCoreTapeFile* pNcTF);
typedef int (__stdcall *NxCoreCallbackAPIList) (void* pYourParam, const NxCoreAPIDLLFile* pNcTF);