Jump to content
garethadamson

Streaming API : getting started

Recommended Posts

I'm in the early stages of developing my solution. The static API works well for me, and I can fetch historical data. But when it comes to streaming, using the new Java Universal client classes, I am not seeing any data at all, and I wonder whether someone out there can help me get started. Really appreciated if you can!

 

Perhaps the first thing to ask. Although I am sure I am sending the correct credentials to the static log on, including AppKey, the response I am receiving contains the field AllowedAccountOperator : false. Would that prevent streaming? I have waited a few days, but perhaps my AppKey still needs activating or something?

Share this post


Link to post

Hi Gareth,

 

Are you using a demo account that you obtained by signing up from our website? Or did you get a proper test account from your staff contact here?

 

A quick way to check that your account credentials are fully working and operational is to see if you can use them to login to your account using any of our front end trading platforms. It can be our desktop Web or any mobile App as you prefer. All our trading platforms use the API so if you can login then your account will work directly with the API.

 

The other thing is whether your account is a Live environment account or a Pre-Production environment account. Accounts are only usable on the environment for which they are applicable. The streaming part of the API has 2 different URLs - one for each environment. You'll need to use the correct URL for your account type.

 

Finally, the streaming part of our API is based upon a third party product called LightStreamer. Have you checked their documentation (http://www.lightstreamer.com/doc) to see what error message you are getting or why you would not be getting any streaming data?

 

I assume you have subscribed to a price stream for a market you are interested in using the correct MarketID?

 

Cordially,

PM!

Share this post


Link to post

Hi Physicsman

 

Many thanks for the quick response, and sorry, it was my silly mistake! I needed to make an explicit call to Client.connect(). <facepalm />

 

 

I now see (amongst a ton of other output)

 

ERROR
17
Requested default Data Adapter for STREAMINGALL not found
 

I should now be able to find my way around that, but if you can see immediately what mistake it suggests, it would be a mercy to let me know.

 

So it seems the AllowedAccountOperator logon response field doesn't mean anything, or at least nothing relevant to me?

 

Kindest regards and apologies

Gareth

Share this post


Link to post

Just to let you know, I got it working.

 

For anyone else having similar trouble afterwards...

 

In the Universal Lightstreamer Client API (e.g. Java Client v.3 and later), you need to

  • Set to Adapter Set to e.g. STREAMINGALL in LightstreamerClient constructor
  • Set Items to e.g. PRICE.400616114 in Subscription constructor (takes an array of strings for several items)
  • Set Data Adapter to e.g. PRICES in Subscription setDataAdapter method

 

et voila!

 

It feels slightly illogical to set the items before the adapter, but it works.

 

Many thanks again

Gareth

Share this post


Link to post

Hi Gareth,

 

Thank you for the tip - I'm sure other users will appreciate it greatly!  :)

 

I'm glad to hear you managed to get it working - the AllowedAccountOperator field is not relevant to your use of the API. 

 

Kind Regards,

PM!

Share this post


Link to post

Hi,

 

im new in this forum.

At the moment i use the Rest API and it works fine for me.

Now, i want to use the streaming api.

 

Is there an code example (Java) for the citiindex api?

Some code snippets?

 

Kind regrads

Share this post


Link to post

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
×