Java SDK subscribe for Chart Candles fails

5 posts / 0 new
Last post
mrmoor
Java SDK subscribe for Chart Candles fails

Hi,

I'm using Java SDK 2 and try to call the subscribeForChartCandles Method:
listeners.add(lightStreamerComponent.subscribeForChartCandles("CS.D.EURUSD.MINI.IP","SECOND",adapter ));

But I always get the error:
com.lightstreamer.ls_client.PushUserException: Mode MERGE is not supported for item CHARTS|IX.D.DAX.IFMM.IP|IX.D.DAX.IFMM.IP|DISTINCT|false|1

I found some suspicious things in this method, some fields appears twice like LTV, DAY_OPEN_MID or UTM and some fields are not specified in the docs like: CANDLE_START and CANDLE_TICK_COUNT.
But this seem not to be the problem.

I dont know why the error string says something about "DISTINCT" because it is "MERGE". The SDK and docs says it sould be "MERGE".

Has anyone a runnig application with this method? Or does anyone know whats the problem in this case? Thank you ;)

Chris
Re: Java SDK subscribe for Chart Candles fails

Hey mrmoor

It does appear that the Java sample is out of sync with Lightstreamer. CANDLE_START and CANDLE_TICK_COUNT look like they need to be replaced with CONS_END and CONS_TICK_COUNT respectively. There is also an extra field that can be subscribed to DAY_LOW.

We're going to set some time aside to fix the Java sample.

Thanks,
Chris

mrmoor
Thanky you so much! :)

Thanky you so much! :)

mrmoor
Update:

If anyone needs it, this is the fully functional and updated method:

public HandyTableListenerAdapter subscribeForChartCandles(String epic,String scale, HandyTableListenerAdapter adapter) throws Exception {

String subscriptionKey = CHART_CANDLE_PATTERN.replace("{epic}", epic);
subscriptionKey = subscriptionKey.replace("{scale}", scale);

ExtendedTableInfo extendedTableInfo = new ExtendedTableInfo(
new String[]{subscriptionKey}, "MERGE", new String[]{"LTV",
"TTV", "UTM", "DAY_OPEN_MID","DAY_NET_CHG_MID",
"DAY_PERC_CHG_MID", "DAY_HIGH", "DAY_LOW", "OFR_OPEN",
"OFR_HIGH", "OFR_LOW", "OFR_CLOSE", "BID_OPEN",
"BID_HIGH", "BID_LOW", "BID_CLOSE", "LTP_OPEN",
"LTP_HIGH", "LTP_LOW", "LTP_CLOSE", "CONS_END",
"CONS_TICK_COUNT"}, true);

final SubscribedTableKey subscribedTableKey = lsClient.subscribeTable(extendedTableInfo, adapter, false);
adapter.setSubscribedTableKey(subscribedTableKey);
return adapter;
}

Chris
Update:

Thanks for posting this mrmoor!

Chris

Log in or register to post comments