001 package org.findata.blpwrapper; 002 003 import com.bloomberglp.blpapi.*; 004 005 import java.util.logging.Logger; 006 007 public class IntradayTickDataResult extends DataResult { 008 private String[] requested_fields; 009 private static final String[] returned_fields = {"time", "type", "value", "size"}; 010 private String[] securities; 011 private static final String[] data_types = {"DATETIME", "STRING", "FLOAT64", "INT32"}; 012 private String[][] result_data; 013 014 public IntradayTickDataResult(String[] argSecurities, String[] argFields) { 015 securities = argSecurities; 016 requested_fields = argFields; 017 } 018 019 public String[][] getData() { 020 return(result_data); 021 } 022 023 public String[] getDataTypes() { 024 return(data_types); 025 } 026 027 public String[] getColumnNames() { 028 return(returned_fields); 029 } 030 031 public void processResponse(Element response, Logger logger, boolean throwInvalidTickerError) throws WrapperException { 032 Element tickDataArray = response.getElement("tickData").getElement("tickData"); 033 034 int initial_offset; 035 036 if (result_data == null) { 037 logger.fine("Initializing result_data for IntradayTickDataResult"); 038 039 initial_offset = 0; 040 result_data = new String[tickDataArray.numValues()][returned_fields.length]; 041 } else { 042 logger.fine("Extending existing result_data for IntradayTickDataResult"); 043 044 initial_offset = result_data.length; 045 int combined_length = tickDataArray.numValues() + initial_offset; 046 String[][] combined_result_data = new String[combined_length][returned_fields.length]; 047 System.arraycopy(result_data, 0, combined_result_data, 0, initial_offset); 048 result_data = combined_result_data; 049 } 050 051 052 for (int i = 0; i < tickDataArray.numValues(); i++) { 053 Element tickData = tickDataArray.getValueAsElement(i); 054 055 for (int j = 0; j < returned_fields.length; j++) { 056 result_data[initial_offset+i][j] = tickData.getElementAsString(returned_fields[j]); 057 } 058 } 059 } 060 }