public boolean hasRefData() { try { Object count = kdb.context().k("count refdata"); return 0 < (Long) count; } catch (c.KException e) { l.error("Failed to query 'count refdata'", e); } catch (IOException e) { l.error("Failed to query 'count refdata'", e); } return false; }
public List<IInstrument> queryInstruments(String query) { l.debug("Executing KDB expiry: " + query); try { Object result = kdb.context().k(query); if (result instanceof c.Flip) { return readInstruments(convertFlip((c.Flip) result)); } else { c.Dict dict = (c.Dict) result; Map<String, Object> table = convertFlip((c.Flip) dict.x); table.putAll(convertFlip((c.Flip) dict.y)); return readInstruments(table); } } catch (c.KException e) { l.error("Failed to query instruments: " + query, e); } catch (IOException e) { l.error("Failed to query instruments: " + query, e); } return null; }