Lightstreamer queries

22 posts / 0 new
Last post
moggie
Lightstreamer queries

Hi Chris
I'm successfully using the API to access account details etc., but had some issues with Lightstreamer using direct connections. It seems that LS_user is not validated and LS_adapter_set should not be provided though LS documentation says the contrary; if I set LS_adapter_set to 'InVisionProvider' (which I guessed at from the Javascript example and some other code on the web) this gives an error 2, "Requested Adapter Set not available". Could you clarify?

Chris
Lightstreamer queries

Hi moggie, welcome to the Community.

This was actually an error with the documentation. You should not have to set the adapter set, so either leave it blank or set it to 'DEFAULT'. We've corrected the documentation to reflect this - sorry for the confusion. Out of interest, where else did you see InVisionProvider?

moggie
Hi Chris

Hi Chris

Thanks for clarifying. I got things working in PHP over the weekend.
Something else that wasn't clear. There's a cap of 40 subscriptions, but is that 40 tables (in Lightstreamer terminology), or would 20 table subscriptions each with 2 symbols count as 40?

Nick

Edited by Chris 28/07/14 11:44

Chris
Lightstreamer queries

Thanks Nick.

The subscription limit of 40 elements in fact applies to Lightstreamer "items", specifically for market items.

This means you can use as many tables as you wish, so long as your overall number of market items does not exceed the limit of 40.

Hope this helps!

colombao
Ciao Chris,

Ciao Chris,
i receive the same error of Moggie but i cannot fix it with setting it as "" or "DEFAULT" or " " .

============== below you can find my code ===================

def CREATE_STREAM_CONNECTION (login_data, prod_demo='DEMO'):

LOGIN_URL = prod_demo_url(prod_demo) + '/create_session.txt'

LOGIN_ID = login_data[prod_demo]["USERNAME"]

LOGIN_PWD = login_data[prod_demo]["PASSWORD"]

LOGIN_API_KEY = login_data[prod_demo]["API_KEY"]

LOGIN_DATA = {
"LS_user" : LOGIN_ID,
"LS_password" : LOGIN_PWD,
"LS_adapter_set" : 'DEFAULT' }

r = requests.post(LOGIN_URL, data=LOGIN_DATA )

RESPONSE_STATUS_CODE = r.status_code

print(RESPONSE_STATUS_CODE)
print(r.text)

================= the output of prints ======================

200
ERROR
2
Requested Adapter Set not available

=============================================================

it seams that in every case i receive "Requested Adapter Set not available", I tried "" or "DEFAULT" or " " , both Production and Test environments. I'm doing something wrong ?

Thanks and br,
Dario

colombao
UPDATE

Hi, an update from my tests: it seems that if I set it with 'DEFAULTS' it returns "wrong user/pwd error", otherwise, if I use blank or any other value, it returns "Requested Adapter Set not available".

So it seems to be an issue of my account, right ?

In the meanwhile I wrote to assistance...

Thanks and br,
Dario

Chris
Re: UPDATE

Hi Dario, has this been sorted for you? If not, let me know.

Chris

colombao
Ciao Chris, i partially

Ciao Chris, i partially solved my problem:

- the adapter has to be set as =DEFAULT
- the complete link (DEMO) currently is https://demo-apd.marketdatasystems.com/lightstreamer/create_session.txt

but actually I cannot use lightreamer with Python. I already checked:

- https://github.com/dw/py-lightstreamer : it's a beta of 2 yrs ago and it doesn't work. No documentation is available.
- http://cometdaily.com/2008/07/29/hello-world-for-sockets-with-lightstrea... : the python part here is not clear and not explained.
- https://labs.ig.com/node/98 : here "femto" tried to use lightreamer.py (i indicated), but without success

Since I already easily developed, as "femto", the REST part (obtain tokens, downloading price history, etc), I would like to ask if anyone could provide a minimalist Python code to connect to lighstreamer and subscribe to a market price.

Any help will be appreciated.

Thanks and br,
Dario

femto
Hello,

Hello,

I'm also still looking for help about streaming API and Python.

About REST API I think that's ok.
see https://github.com/femtotrader/ig-markets-rest-api-python-library/
now it returns Pandas DataFrame which is very convenient.

but I'm sick with this streaming API.

I asked support directly to IG but I didn't get any help.

Femto.

gianluca.finocchiaro
Hi All,

Hi All,

just released on GitHub a simple Python script that shows a minimal client-side implementation of the Lightstreamer Server Text mode Protocol.

https://github.com/Weswit/Lightstreamer-example-StockList-client-python

Regards,
Gianluca

femto
it will be nice if IG also

it will be nice if IG also could support space in block code in this forum...
that could be useful for Python users.

ixta
Sample Python Code

Here is a link to some sample Python code that will stream GBP/USD.

It's a slightly modified version of the py-lightsreamer code. Provided with no guarantees! It works for me under ActivePython 2.7.8.10 with requests added

http://www.yourfilelink.com/get.php?fid=1008665

Chris - Perhaps you could attach the code to this forum somewhere?

colombao
Ciao Ixta, I tried your code

Ciao Ixta, I tried your code but I receive following error

Warning (from warnings module):
File "C:\Python27\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 734
InsecureRequestWarning)
InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
New state: connecting Lightstreamer session
New state: disconnected from Lightstreamer

(no new update after this line)
I have Python 2.7.2.

Any idea?

Thanks and br

femto
Same problem here

Same problem here

I will have a look at gianluca.finocchiaro code

https://github.com/Weswit/Lightstreamer-example-StockList-client-python

femto
As it's easier to collaborate

As it's easier to collaborate using GitHub I have done a project for this available at https://github.com/femtotrader/ig-markets-stream-api-python-library

ixta
Make sure you are running the

Make sure you are running the latest Python 2.7.8

Something similar was happening for me around the time that IG disabled SSLv3 support (due to the vulnerabilities that came out in SSLv3 recently). The SSL library needs to be able to support TLS instead

bllamb
If you haven't sorted this

If you haven't sorted this yet, you can do so by setting "verify=true" in the requests.post(...) statements. If you have the certifi package installed urllib3 will pick up the root certificates from that.

colombao
Hi All,

Hi All,
my side this last code provided works, but I would like to ask you the meaning of a part of code:

priceTable = igls.Table(client,
mode=igls.MODE_MERGE,
item_ids='L1:CS.D.GBPUSD.CFD.IP', <-------------------- what means here "L1:" ?
schema='UPDATE_TIME BID OFFER CHANGE MARKET_STATE',
item_factory=lambda row: tuple(float(v) for v in row)
)

my understanding is that there should be inserted a combination of labels as indicated in Chart subscriptions section of https://labs.ig.com/streaming-api-reference ; for this reason I tried to use instead "CHART:CS.D.EURJPY.CFD.IP:TICK" (and only 'OFR' as schema) but it didn't work. Moreover i cannot find "L1" in streaming-api-reference, what it means?

I'm doing something wrong?

Best regards!

ixta
Hi Colombao,

Hi Colombao,

Glad to hear the code is working for you.

The L1 should really be changed to MARKET, although either seems to work (I suspect L1 just refers to Level 1 Market Depth). Also note that the EPIC that I provided in the sample code seems to no longer be valid and will need to be replaced with a valid EPIC

Your CHART subscription looks correct, although I have never tried to subscribe to a CHART stream before so I can't really comment any further i'm afraid

NEY
Hi all,

Hi all,

Thanks femto for your library !! it works for me

falex
L1 was a V1 and MARKET a V2 ?

L1 was a V1 and MARKET a V2 ???

Or there is a L2 for the one who are doing forex direct or shares ???

femto
New version of my Python

New version of my Python client for IG Stream API
https://github.com/ig-python/ig-markets-stream-api-python-library/tree/p...

not yet merged with master
not yet publish on PyPi

Log in or register to post comments