#ifndef __CandlesToDatabase_h_ #define __CandlesToDatabase_h_ #include "../shared/ContainerThread.h" #include "OneMinuteCandles.h" #include "DataNodeThread.h" class CandlesToDatabase : private ForeverThreadUser { private: DataNodeThread &_dataNodeThread; time_t _nextWakeTime; time_t _lastEndTime; EpochCounter::Epoch _lastEpoch; std::map< std::string, OneMinuteCandles * > _dataProviders; virtual void beforeSleep(IBeforeSleepCallbacks &callbacks); virtual void awake(std::set< int > const &woken); const time_t NEVER = std::numeric_limits::max(); time_t _nextAutoReloadTime; bool _changeInProgress; std::vector< std::string > getSymbolList(); void add(std::vector< std::string > toAdd); public: CandlesToDatabase(DataNodeThread &dataNodeThread, IContainerThread *container = NULL); // Go to the database. See which stocks are reasonable to follow. This is // a pretty big list, probably everything that's real. Start following these // stocks. // // This is thread safe. // // Currently this means to do it once now and schedule another one for day // around midnight. Currently there is now way to turn off the scheduled // calls. void addFromDatabase(); }; #endif