#include "../misc_framework/CsvFileDataNodes.h" #include "NormalVolumeBreakBars.h" NormalVolumeBreakBars::NormalVolumeBreakBars(DataNodeArgument const &args) { std::string const &symbol = args.getStringValue(); // We only look this up once. The previous version would update when the // csv file was changed. This was only used in debugging, not in live // processing. const DataNode::Integer volumeBreak = strtollDefault (FileOwnerDataNode::getStringValue("OvernightData.csv", "Volume Break", symbol), 0); // This type of statistical analysis only makes sense if we have enough // data. We are requiring 1000 shares per block. When we analyzied futures, // we used a minimum size of 20 for them. This is impresice at best, but // prevents some silly cases. Note that AlertMainControl contians a similar // test, and will not try to create any alerts that use this data unless // there is sufficient data. static const DataNode::Integer MIN_BLOCK_SIZE = 1000; if (volumeBreak < MIN_BLOCK_SIZE) _data = NULL; else addAutoLink(VolumeWeightedDataNode::find(this, 0, _data, symbol, volumeBreak)); } VolumeBlocks const &NormalVolumeBreakBars::getBlocks() const { static const VolumeBlocks emptyList; if (_data) return _data->getBlocks(); else return emptyList; } VolumeBlocks::size_type NormalVolumeBreakBars::getBlockCount() const { if (_data) return _data->getBlockCount(); else return 0; } DataNode::Integer NormalVolumeBreakBars::getGroupBy() const { if (_data) return _data->getGroupBy(); else return 0; } DataNodeLink *NormalVolumeBreakBars::find(DataNodeListener *listener, int msgId, NormalVolumeBreakBars *&node, std::string const &symbol) { return findHelper(listener, msgId, node, symbol); }