Syntax
#define cszNxCorePriceToDouble "sNxCorePriceToDouble"
typedef double (__stdcall *NxCorePriceToDouble) (int lPrice, unsigned char PriceType);
double PriceToDouble(int Price,
unsigned char PriceType);
Parameters
Integer representing the Price to format.
The Price Type that Price is using.
Return Value
Returns a double that represents the Price and PriceType combination.
Here's an example of converting a price/priceType to a double
#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:
{
const NxCoreTrade& nt = pNxCoreMessage->coreData.Trade;
double lastTradePrice = nxCoreClass.PriceToDouble(nt.Price, nt.PriceType);
printf("Last Trade = %0.2f\n",lastTradePrice);
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;
}