#include "GlobalConfigFile.h" #include "MiscSupport.h" #include "MarketHours.h" #define DEFAULT_MARKET_HOURS_OPEN (6 * MARKET_HOURS_HOUR + 30 * MARKET_HOURS_MINUTE) #define DEFAULT_MARKET_HOURS_CLOSE (13 * MARKET_HOURS_HOUR) #define DEFAULT_MINUTES_OF_TRADING ((DEFAULT_MARKET_HOURS_CLOSE - DEFAULT_MARKET_HOURS_OPEN) / MARKET_HOURS_MINUTE) int MarketHours::_open = DEFAULT_MARKET_HOURS_OPEN; int MarketHours::_close = DEFAULT_MARKET_HOURS_CLOSE; int MarketHours::_minutesOfTrading = DEFAULT_MINUTES_OF_TRADING; void MarketHours::init() { // getConfigItem: The values of MARKET_HOURS_OPEN and MARKET_HOURS_CLOSE in // getConfigItem: the config file correspond directly with the constants // getConfigItem: of the same name in MarketHours.h. These say the number // getConfigItem: of seconds after midnight when the market opens and when // getConfigItem: it closes on a typical trading day. These default to // getConfigItem: the times of the NASDAQ and NYSE as seen in the Pacific // getConfigItem: time zone. _open = strtolDefault(getConfigItem("MARKET_HOURS_OPEN"), DEFAULT_MARKET_HOURS_OPEN); _close = strtolDefault(getConfigItem("MARKET_HOURS_CLOSE"), DEFAULT_MARKET_HOURS_CLOSE); _minutesOfTrading = (_close - _open) / MARKET_HOURS_MINUTE; }