Package com.activequant.utils

Examples of com.activequant.utils.Date8Time6Parser


    public TimeSeriesContainer fetchTSData(TimeFrame tf, String[] marketInstrumentIds, String[] fieldNames,
            double startDate8Time6, double endDate8Time6, Map<Parameter, Object> paramMap) throws Exception {
        //
        if (paramMap == null)
            paramMap = new HashMap<Parameter, Object>();
        Date8Time6Parser parser = new Date8Time6Parser();

        //
        Map<String, Map<String, Map<TimeStamp, Double>>> dataMap = new HashMap<String, Map<String, Map<TimeStamp, Double>>>();
        List<TimeStamp> timeStamps = new ArrayList<TimeStamp>();
        for (int i = 0; i < marketInstrumentIds.length; i++) {
            String instrument = marketInstrumentIds[i];
            // get the instrument specific map.
            Map<String, Map<TimeStamp, Double>> instrumentMap;
            if (!dataMap.containsKey(instrument))
                dataMap.put(instrument, new HashMap<String, Map<TimeStamp, Double>>());
            instrumentMap = dataMap.get(instrument);

            for (int j = 0; j < fieldNames.length; j++) {
                String field = fieldNames[j];
                // get the field specific map
                Map<TimeStamp, Double> fieldMap;
                if (!instrumentMap.containsKey(field))
                    instrumentMap.put(field, new HashMap<TimeStamp, Double>());
                fieldMap = instrumentMap.get(field);
                TimeStamp t1 = new TimeStamp(parser.getNanoseconds(startDate8Time6));
                TimeStamp t2 = new TimeStamp(parser.getNanoseconds(endDate8Time6));
                TSContainer ts = archiveFactory.getReader(tf).getTimeSeries(instrument, field, t1, t2);
                if (ts.timeStamps.length > 0) {
                    for (int k = 0; k < ts.timeStamps.length; k++) {
                        TimeStamp timeStamp = ts.timeStamps[k];
                        Double value = ts.values[k];
View Full Code Here


            Map<Parameter, Object> paramMap) throws InvalidDate8Time6Input, ParseException {
        timeStamps = new TimeStampProcessor().processTimeStampList(timeStamps, paramMap);

        //
        Collections.sort(timeStamps);
        Date8Time6Parser parser = new Date8Time6Parser();
        TimeSeriesContainer ret = new TimeSeriesContainer();
        // convert the timestamps to matlab timestamps
        double[] matlabTS = new double[timeStamps.size()];
        for (int i = 0; i < timeStamps.size(); i++) {
            double milliseconds = timeStamps.get(i).getNanoseconds() / 1000000.0;
View Full Code Here

TOP

Related Classes of com.activequant.utils.Date8Time6Parser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.