Jump to content
  • 0

Java Streaming API Demo Not Returning Prices


lalittanna

Question

I'm trying to get price feed on demo account through the streaming API but its returning this server error: lightstreamer.session|pool-2-thread-1|Disconnected. Cause: 65 - Unsupported protocol version: 2.5.0

Maven dependency used:

<dependency>
  <groupId>com.lightstreamer</groupId>
  <artifactId>ls-javase-client</artifactId>
  <version>5.1.0</version>
</dependency>

Code: 
 

LightstreamerClient client = new LightstreamerClient("https://demo-apd.marketdatasystems.com", "DEMO");
ConsoleLoggerProvider mylog = new ConsoleLoggerProvider(ConsoleLogLevel.INFO);
LightstreamerClient.setLoggerProvider(mylog);
client.connectionDetails.setUser("<userId>");
client.connectionDetails.setPassword("CST-" + "389b6319947f6799bdcfbdf3fd2b5098f90dcdd8dd4ae655b4829b6047b035CC01116" + "|XST-" + "671c982d9852360a9af293fe9043fe7c86493e1eafa92b286e1dab7bd1029aCD01116");
client.connectionDetails.setAdapterSet("DEFAULT");
client.addListener(new ClientListener() {
    @Override
    public void onListenEnd() {
        System.out.println("Listening ended");
    }

    @Override
    public void onListenStart() {
        System.out.println("Listening started");
    }

    @Override
    public void onServerError(int i, @NotNull String s) {
        System.out.println("Server error: " + s);
    }

    @Override
    public void onStatusChange(@NotNull String s) {
        System.out.println("Status change: " + s);
    }

    @Override
    public void onPropertyChange(@NotNull String s) {
        System.out.println("Property change: " + s);
    }
});
String[] items = { "CS.D.EURGBP.CFD.IP" };
String[] fields = { "BID","OFFER" };
Subscription sub = new Subscription("MERGE",items,fields);
sub.setDataAdapter("QUOTE_ADAPTER");
sub.setRequestedSnapshot("yes");
sub.addListener(new SubscriptionListener() {
    @Override
    public void onClearSnapshot(String itemName, int itemPos) {
        System.out.println("Server has cleared the current status of the chat");
    }

    @Override
    public void onCommandSecondLevelItemLostUpdates(int lostUpdates, String key) {
        //not on this subscription
    }

    @Override
    public void onCommandSecondLevelSubscriptionError(int code, String message, String key) {
        //not on this subscription
    }

    @Override
    public void onEndOfSnapshot(String arg0, int arg1) {
        System.out.println("Snapshot is now fully received, from now on only real-time messages will be received");
    }

    @Override
    public void onItemLostUpdates(String itemName, int itemPos, int lostUpdates) {
        System.out.println(lostUpdates + " messages were lost");
    }

    @Override
    public void onItemUpdate(ItemUpdate update) {

        System.out.println("====UPDATE====> " + update.getItemName());
        System.out.println(update.getValue("BID"));
        System.out.println(update.getValue("OFFER"));

        System.out.println("<====UPDATE====");
    }

    @Override
    public void onListenEnd() {
        System.out.println("Stop listeneing to subscription events");
    }

    @Override
    public void onListenStart() {
        System.out.println("Start listeneing to subscription events");
    }

    @Override
    public void onSubscription() {
        System.out.println("Now subscribed to the chat item, messages will now start coming in");
    }

    @Override
    public void onSubscriptionError(int code, String message) {
        System.out.println("Cannot subscribe because of error " + code + ": " + message);
    }

    @Override
    public void onUnsubscription() {
        System.out.println("Now unsubscribed from chat item, no more messages will be received");
    }

    @Override
    public void onRealMaxFrequency(String frequency) {
        System.out.println("Frequency is " + frequency);
    }

});
client.subscribe(sub);
client.connect();
Link to comment

3 answers to this question

Recommended Posts

  • 0
11 hours ago, lalittanna said:

I'm trying to get price feed on demo account through the streaming API but its returning this server error: lightstreamer.session|pool-2-thread-1|Disconnected. Cause: 65 - Unsupported protocol version: 2.5.0

Maven dependency used:

<dependency>
  <groupId>com.lightstreamer</groupId>
  <artifactId>ls-javase-client</artifactId>
  <version>5.1.0</version>
</dependency>

Code: 
 

LightstreamerClient client = new LightstreamerClient("https://demo-apd.marketdatasystems.com", "DEMO");
ConsoleLoggerProvider mylog = new ConsoleLoggerProvider(ConsoleLogLevel.INFO);
LightstreamerClient.setLoggerProvider(mylog);
client.connectionDetails.setUser("<userId>");
client.connectionDetails.setPassword("CST-" + "389b6319947f6799bdcfbdf3fd2b5098f90dcdd8dd4ae655b4829b6047b035CC01116" + "|XST-" + "671c982d9852360a9af293fe9043fe7c86493e1eafa92b286e1dab7bd1029aCD01116");
client.connectionDetails.setAdapterSet("DEFAULT");
client.addListener(new ClientListener() {
    @Override
    public void onListenEnd() {
        System.out.println("Listening ended");
    }

    @Override
    public void onListenStart() {
        System.out.println("Listening started");
    }

    @Override
    public void onServerError(int i, @NotNull String s) {
        System.out.println("Server error: " + s);
    }

    @Override
    public void onStatusChange(@NotNull String s) {
        System.out.println("Status change: " + s);
    }

    @Override
    public void onPropertyChange(@NotNull String s) {
        System.out.println("Property change: " + s);
    }
});
String[] items = { "CS.D.EURGBP.CFD.IP" };
String[] fields = { "BID","OFFER" };
Subscription sub = new Subscription("MERGE",items,fields);
sub.setDataAdapter("QUOTE_ADAPTER");
sub.setRequestedSnapshot("yes");
sub.addListener(new SubscriptionListener() {
    @Override
    public void onClearSnapshot(String itemName, int itemPos) {
        System.out.println("Server has cleared the current status of the chat");
    }

    @Override
    public void onCommandSecondLevelItemLostUpdates(int lostUpdates, String key) {
        //not on this subscription
    }

    @Override
    public void onCommandSecondLevelSubscriptionError(int code, String message, String key) {
        //not on this subscription
    }

    @Override
    public void onEndOfSnapshot(String arg0, int arg1) {
        System.out.println("Snapshot is now fully received, from now on only real-time messages will be received");
    }

    @Override
    public void onItemLostUpdates(String itemName, int itemPos, int lostUpdates) {
        System.out.println(lostUpdates + " messages were lost");
    }

    @Override
    public void onItemUpdate(ItemUpdate update) {

        System.out.println("====UPDATE====> " + update.getItemName());
        System.out.println(update.getValue("BID"));
        System.out.println(update.getValue("OFFER"));

        System.out.println("<====UPDATE====");
    }

    @Override
    public void onListenEnd() {
        System.out.println("Stop listeneing to subscription events");
    }

    @Override
    public void onListenStart() {
        System.out.println("Start listeneing to subscription events");
    }

    @Override
    public void onSubscription() {
        System.out.println("Now subscribed to the chat item, messages will now start coming in");
    }

    @Override
    public void onSubscriptionError(int code, String message) {
        System.out.println("Cannot subscribe because of error " + code + ": " + message);
    }

    @Override
    public void onUnsubscription() {
        System.out.println("Now unsubscribed from chat item, no more messages will be received");
    }

    @Override
    public void onRealMaxFrequency(String frequency) {
        System.out.println("Frequency is " + frequency);
    }

});
client.subscribe(sub);
client.connect();

Dear @lalittanna,

Thank you for reaching out! I apologize for any inconvenience, but we do not offer programming support. However, you can test the API using our API companion at this link: API Companion

Thanks,

KoketsoIG 

Please rate us on Trustpilot: IG Trustpilot 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • image.png

  • Posts

    • Yo crypto fam! I'm buzzing about this Hamster TGE coming up. It's been all over crypto Twitter and Discord, and I'm thinking it could be huge. So what's the deal? Hamster's not just another meme coin. They're trying to make DeFi fun and easy to use. Think yield farming and staking, but with a gamified twist. Pretty cool, right? Now, here's the juicy part - Bitget listing this gem. I've been using the exchange for a while now, and it's solid Super easy to use (even if you're new to crypto) Top-notch security (no sketchy stuff here) Tons of trading volume (so you can buy and sell quick) Staking options (passive income, anyone?) Great community vibes Word on the street is there might be some sweet bonuses for early birds. Plus, they're talking about keeping the token supply tight, which could mean Look, I'm no financial advisor, but I'm definitely eyeing this launch. If you're thinking about it too, make sure to DYOR. Who else is hyped for the Hamster TGE? Let's get that bag!
    • EURUSD Elliott Wave Analysis Trading Lounge Day Chart Euro/ U.S. Dollar (EURUSD) Day Chart EURUSD Elliott Wave Technical Analysis Function: Trend Mode: Impulsive Structure: Orange Wave 5 Position: Navy Blue Wave 3 Next Lower Degrees: Navy Blue Wave 4 Details: Orange Wave 4 appears completed, and now Orange Wave 5 is in progress. Cancel Invalid Level: 1.10009 The EURUSD Elliott Wave Analysis on the day chart indicates a trending market. The current mode of the market is impulsive, meaning the price is moving strongly in one direction. The key structure being observed is Orange Wave 5, which suggests a continuation of the current upward trend. At this point, the market is in Navy Blue Wave 3, and there is an expectation of a shift into Navy Blue Wave 4, a lower degree wave. Detailed Analysis The analysis shows that Orange Wave 4 seems to be completed, signaling the start of Orange Wave 5. This suggests that the price movement is likely to remain upward as the impulsive wave progresses. However, if the market falls below the invalidation level of 1.10009, this could indicate an error in the wave count, leading to a reanalysis of the structure. This analysis is based on Elliott Wave Theory, which forecasts future price movements by analyzing past patterns and cyclical wave structures. The completion of Wave 4 is leading to expectations of further upward momentum in Wave 5, signaling continued bullish momentum for the EURUSD pair in the near term.   Euro/ U.S. Dollar (EURUSD) 4 Hour Chart EURUSD Elliott Wave Technical Analysis Function: Trend Mode: Impulsive Structure: Orange Wave 5 Position: Navy Blue Wave 3 Next Lower Degrees: Navy Blue Wave 4 Details: Orange Wave 4 appears completed, and now Orange Wave 5 is in progress. Cancel Invalid Level: 1.10009 The EURUSD Elliott Wave Analysis for the 4-hour chart shows that the market is in an impulsive trend. The main focus is on Orange Wave 5, with the current position in Navy Blue Wave 3, indicating strong upward momentum characteristic of this phase. Detailed Analysis Orange Wave 4 has likely been completed, and the market has shifted into Orange Wave 5, marking the end of the corrective phase and continuing the upward push. As Wave 5 progresses, the expectation is for further bullish movement in the EURUSD pair. After the completion of Orange Wave 5, the market is expected to move into Navy Blue Wave 4, a corrective phase. This indicates that the upward movement could slow down once Wave 5 is fully realized. The wave cancellation level for this analysis is 1.10009. If the price falls below this level, it would invalidate the current wave count and require a reanalysis of the market structure. As long as the price stays above this level, the bullish trend driven by Wave 5 is expected to continue. Summary In conclusion, the 4-hour chart analysis for EURUSD shows that the market is in the final impulsive phase of Orange Wave 5, following the completion of Wave 4. The upward trend is expected to persist unless the price falls below the invalidation level of 1.10009. Technical Analyst : Malik Awais Source : Tradinglounge.com get trial here!  
    • Cardano ADA is currently trading at $0.356, showing signs of a recent surge in whale activity, with large transactions worth $6.08 billion over the past day. Despite this positive movement, market experts suggest caution, as ADA faces critical resistance and support levels that may determine its next direction. Key Market Trends Whale Activity Surge: Recent data reveals a massive increase in whale transactions, totaling $6.08 billion. This indicates that big players are re-entering the market, potentially pushing ADA’s price upward. Price Resistance: ADA is struggling to break through the $0.39 resistance level. A successful break would likely depend on bullish market sentiment and Bitcoin’s performance. Without this, ADA could face a pullback. Consolidation Below Key Support: According to TradingView data, ADA is currently consolidating below a key $0.35 support level. Market experts like Lingrid have identified additional pressure that could push ADA further downward if it fails to hold above $0.325. Technical Analysis and Market Sentiment Lingrid’s analysis shows that ADA is stuck between $0.32 and $0.36. A doji candle has formed on the daily chart, which indicates uncertainty in market direction. This uncertainty could lead to a retest of support levels near $0.345 or lower. If ADA fails to maintain above this support, a potential drop toward the $0.33 region seems likely. Lingrid has even issued a short signal for ADA, suggesting a bearish outlook unless key support holds. Long-Term Investor Sentiment Looking beyond technical factors, Cardano’s fundamentals have historically driven sentiment shifts. As an investor who has witnessed ADA’s growth since 2016, it’s clear that Cardano’s strong research foundation and decentralized structure give it long-term potential. During the 2019 cycle, ADA was down to the 13th spot on CoinMarketCap, but once the fundamentals and research were recognized, its price rebounded dramatically. Cardano is at a critical juncture. While whale activity and strong fundamentals provide optimism, the ability to break key resistance levels will likely depend on broader market conditions. Investors should remain cautious and informed, especially as ADA’s price remains closely tied to Bitcoin’s movements. September's volatility could lead to short-term holders selling, creating potential downward pressure.  
×
×
  • Create New...
us