Table of Contents


NxDate Usage

The struct NxDate is a member of 3 structures in NxCoreAPI:

  1. NxCoreSystem, where the member nxDate defines the date of the current tape.
  2. NxCoreHeader, where the member nxSessionDate defines the current trading session. The member nxSessionDate is usually the same date as the current tape. It will often be set to the previous session for the early morning update of last known session information. For the few symbols that start the next days trading in the afternoon, nxSessionDate will equal the next day.
  3. NxCategoryField, where the member nxDate is used whenever a date quantity is being defined. NxDate is used more fequently than NxTime in NxCategory messages.

NxDate

NxDate is defined in NxCoreAPI.h as:


struct NxDate {
    unsigned long  NDays;
    unsigned short Year;
    unsigned char  Month;
    unsigned char  Day;
    unsigned char  DSTIndicator;
    unsigned char  DayOfWeek;
    unsigned short DayOfYear;
};

NxDate members

Member Type Min Max Description
NDays unsigned long 0 93503 NDays represents the number of calendar days since Jan 1, 1883. Although defined as an unsigned long, the maximum value for NDays is currently set to 93,503 which spans to Dec 31, 2138 (255 years). When it becomes necessary to address dates beyond 2138, the function will simply be updated.
Year unsigned short 1883 2138 Year represents the current year on the Gregorian calendar, for example: 2003, 2004, etc.
Month unsigned char 1 12 Current month of the Calendar year, with January equal to 1, February equal to 2, .. December equal to 12.
Day unsigned char 1 31 Current day of the Calendar month ranging from 1 to 31.
DSTIndicator unsigned char 0 5 Daylight Savings Indicator.

#define Value Comments
NxDATE_DST_UNKNOWN 0 Not set or computed. Currently not used.
NxDATE_DST_ON 1 DST is on. Clock is ahead 1 hour from Standard Time. EDT is -4 GMT.
NxDATE_DST_OFF 2 DST is on. Clock is at Standard Time. EST is -5 GMT.
NxDATE_DST_ONTODAY 3 Daylight Savings Time begins at 2:00AM this day.
NxDATE_DST_OFFTODAY 4 Daylight Savings Time ends at 2:00AM this day.
DayOfWeek unsigned char 0 6 Day of Week
#define Value Comments
NxDOW_SUNDAY 0 Sunday
NxDOW_MONDAY 1 Monday
NxDOW_TUESDAY 2 Tuesday
NxDOW_WEDNESDAY 3 Wednesday
NxDOW_THURSDAY 4 Thursday
NxDOW_FRIDAY 5 Friday
NxDOW_SATURDAY 6 Saturday
DayOfYear unsigned short 1 365 Count of days since January 1st. Useful in determining end of quarter.

Example

For example of date manipulation see here and here