Package com.activequant.domainmodel

Examples of com.activequant.domainmodel.TimeStamp


                // 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];
                        // TODO: have to reduce the granularity.
                        if (!timeStamps.contains(timeStamp))
                            timeStamps.add(timeStamp);
                        fieldMap.put(timeStamp, value);
View Full Code Here


            for (int j = 0; j < fieldNames.length; j++) {
                String field = fieldNames[j];
                // get the field specific map
                Map<TimeStamp, Double> fieldMap = instrumentMap.get(field);
                for (int k = 0; k < timeStamps.size(); k++) {
                    TimeStamp date8time6 = timeStamps.get(k);
                    if (fieldMap.containsKey(date8time6))
                        ret.values()[i][k][j] = fieldMap.get(date8time6);
                    else
                        ret.values()[i][k][j] = Double.NaN;
                }
View Full Code Here

            cmr.read(new IEventListener<Map<String, String>>() {

                @Override
                public void eventFired(Map<String, String> event) {
                    final String time = event.get("TIMESTAMP");
                    TimeStamp ts;

                    final Iterator<Entry<String, String>> it = event.entrySet()
                            .iterator();
                    try {
                        ts = new TimeStamp(sdf.parse(time));

                        while (it.hasNext()) {
                            Entry<String, String> entry = it.next();
                            String key = entry.getKey().toUpperCase();
                            if (key.equals("TIMESTAMP"))
View Full Code Here

  @Override
  public MarketDataEvent next() {
    currentTime = currentTime + step;

    BBOEvent bbo = new BBOEvent(mdId, tradId, new TimeStamp(currentTime),
        Math.random(), Math.random(), Math.random(), Math.random());
    //
    return bbo;
  }
View Full Code Here

  @Override
  public TimeStreamEvent next() {
    currentTime = currentTime + step;
   
    TimeStreamEvent event = new TimeStreamEvent(new TimeStamp(currentTime));
    //
    return event;
  }
View Full Code Here

          String time = event.get("TIME");
          if(time==null)time = "00:00:00.000";
          final String dateTime = date + " " + time;
          final Iterator<Entry<String, String>> it = event.entrySet()
              .iterator();
          TimeStamp ts;
          try {
            if(dateTime.indexOf("-")!=-1)
              ts = new TimeStamp(sdf2.parse(dateTime));
            else
              ts = new TimeStamp(sdf.parse(dateTime));
           
           
           
            while (it.hasNext()) {
              Entry<String, String> entry = it.next();
View Full Code Here

                    final String type = event.get("TYPE");
                    final String price = event.get("PRICE");
                    final String quantity = event.get("QUANTITY");
                   
                    try {
                        TimeStamp ts = new TimeStamp(sdf.parse(dateTime));
                        iaw.write(mdi.getId(), ts, type, Double.parseDouble(price));
                        iaw.write(mdi.getId(), ts, type+"QUANTITY", Double.parseDouble(quantity));
                    } catch (ParseException e1) {
                        e1.printStackTrace();
                    }
View Full Code Here

        Date d1 = sdf.parse(startDate);
        Date d2 = sdf.parse(stopDate);
        System.out.println(d1.getTime());
        System.out.println(d2.getTime());
        //
        TimeStamp startTS = new TimeStamp(sdf.parse(startDate));
        TimeStamp stopTS = new TimeStamp(sdf.parse(stopDate));

        IArchiveReader iar = archiveFactory.getReader(inTimeFrame);

        for (String value : fields) {
            TSContainer container = iar.getTimeSeries(mdiId, value, startTS, stopTS);
View Full Code Here

       
      HBaseArchiveFactory fac = new HBaseArchiveFactory(args[0]);
        IArchiveReader iar = fac.getReader(TimeFrame.EOD);
        IArchiveWriter iwr = fac.getWriter(TimeFrame.EOD);
       
        TimeStamp now = new TimeStamp(new Date());
        double value = Math.random();
        iwr.write("TEST",now,"PX_SETTLE", value);
        iwr.commit();
       
        TSContainer container = iar.getTimeSeries("TEST", "PX_SETTLE", now);
View Full Code Here

       
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        Date midnightThisMorning = sdf.parse(sdf.format(new Date()));
       
        // dump instruments and MDIs that were generated today.
        String[] mdiids = mdiDao.findIDsWhereCreationDateBetween(new TimeStamp(midnightThisMorning), new TimeStamp());
        StringBuffer mailBody = new StringBuffer("<h1>General information</h1>"+sendMail.generateHtmlTable(new String[]{"Property", "Value"}, data));
       
        mailBody.append("<h1>New MDIs</h1>");
        for(String id : mdiids)
        {
            mailBody.append(id + "<br/>");
        }
       
        String[] instruments = idao.findIDsWhereCreationDateBetween(new TimeStamp(midnightThisMorning), new TimeStamp());
        mailBody.append("<h1>New Instruments</h1>");
        for(String id : instruments)
        {
            mailBody.append(id + "<br/>");
        }
View Full Code Here

TOP

Related Classes of com.activequant.domainmodel.TimeStamp

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.