MCPcopy Create free account
hub / github.com/Rblp/Rblpapi / processMessage

Function processMessage

src/getTicks.cpp:94–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92};
93
94void processMessage(bbg::Message &msg, Ticks &ticks, const bool verbose) {
95 bbg::Element data = msg.getElement(TICK_DATA).getElement(TICK_DATA);
96 int numItems = data.numValues();
97 if (verbose) {
98 Rcpp::Rcout <<"Response contains " << numItems << " items" << std::endl;
99 Rcpp::Rcout <<"Time\t\tType\t\tValue\t\tSize\t\tCondition Code" << std::endl;
100 }
101 for (int i = 0; i < numItems; ++i) {
102 bbg::Element item = data.getValueAsElement(i);
103 bbg::Datetime time = item.getElementAsDatetime(TIME);
104 std::string type = item.getElementAsString(TYPE);
105 double value = item.getElementAsFloat64(VALUE);
106 int size = item.getElementAsInt32(TICK_SIZE);
107 std::string conditionCode;
108 conditionCode = (item.hasElement(COND_CODE)) ? item.getElementAsString(COND_CODE) : "";
109 if (verbose) {
110 Rcpp::Rcout.setf(std::ios::fixed, std::ios::floatfield);
111 Rcpp::Rcout << time.month() << '/' << time.day() << '/' << time.year()
112 << " " << time.hours() << ":" << time.minutes()
113 << "\t\t" << std::showpoint
114 << type << "\t\t"
115 << value << "\t\t"
116 << size << "\t\t"
117 << conditionCode
118 << std::endl;
119 }
120 ticks.time.push_back(bbgDatetimeToUTC(time));
121 ticks.type.push_back(type);
122 ticks.value.push_back(value);
123 ticks.size.push_back(size);
124 ticks.conditionCode.push_back(conditionCode);
125 }
126}
127
128void processResponseEvent(bbg::Event &event, Ticks &ticks, const bool verbose) {
129 bbg::MessageIterator msgIter(event);

Callers 1

processResponseEventFunction · 0.70

Calls 1

bbgDatetimeToUTCFunction · 0.85

Tested by

no test coverage detected