Hello,
I would like your advice about performance issue while request instruments of a chain component.
For example, the chain 0#SRD.PA contains 144 instruments.
My algorythm opens one chain for SRD.PA (to retrieve its elements), and request each intruments to retrieve its quote informations :
protected RefinitivItem callChain(String ricId) { FlatChain fChain = new FlatChain.Builder() .withOmmConsumer(consumer.getConsumer()) .withChainName(ricId) .withSynchronousMode() .withUpdates(false) .build(); fChain.open(); RefinitivItem item = new RefinitivItem(ricId, fChain); for (Entry<Long, String> element : fChain.getElements().entrySet()) { if (!element.getValue().isEmpty()) { addFields(item, element); } } fChain.close(); return item; } private void addFields(RefinitivItem item, Entry<Long, String> element) { String elementRic = element.getValue(); RefinitivFields fields = callByRic(elementRic); if (fields != null) { item.addFields(element.getValue(), fields); } } protected RefinitivFields callByRic(String ricId) { RefinitivFields fields = null; MarketPrice.Builder b = new MarketPrice.Builder().withOmmConsumer(consumer.getConsumer()) .withName(ricId) .withUpdates(false) .withSynchronousMode(); b.withField("REF_COUNT"); b.withField("RDNDISPLAY"); b.withField("RECORDTYPE"); b.withField("PREF_DISP"); b.withField("LOW_1"); b.withField("HIGH_1"); MarketPrice marketPrice = b.build(); marketPrice.open(); if (OmmState.DataState.OK == marketPrice.getState().dataState() || OmmState.DataState.NO_CHANGE == marketPrice.getState().dataState()) { fields = new RefinitivFields(ricId, new ArrayList<>(marketPrice.getFields())); } marketPrice.close(); return fields; }
Since openinig the request for one instrument lasts approximately 200 milliseconds, the call for the whole chain instruments lasts more than 30 seconds.
So my question is: am I doing it right ?