It looks like you're new here. If you want to get involved, click one of these buttons!
public HistoricalData getHistoricalData(Date from, Date to, String token, String interval, boolean continuous) throws KiteException, IOException, JSONException {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Map<String, Object> params = new HashMap<>();
params.put("from", format.format(from));
params.put("to", format.format(to));
params.put("continuous", continuous ? 1 : 0);
...from
and to
into "yyyy-MM-dd HH:mm:ss". This however, is done without taking the time zone into consideration. This is wrong because date objects by definition are timezone aware. While the code at 596 overlooks their timezones. Date from = new Date(System.currentTimeMillis()-2*1000*60*60);
Date to = new Date(System.currentTimeMillis());
This goes wrong because Indian exchanges work on IST. The server's time -- without taking timezone into consideration -- is converted into "yyyy-MM-dd HH:mm:ss" is anachronous. Date from = new Date(System.currentTimeMillis()+330*1000*60-2*1000*60*60);
Date to = new Date(System.currentTimeMillis()+330*1000*60);
This can be fixed if the TimeZone of the date objects from
and to
is taken into consideration
format .setTimeZone(TimeZone.getTimeZone("GMT+0530"));
after
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
at 597You were not getting data because you didn't set the continuous flag to true.