The connection is to RTC. I see in a post need: \*rtc\*defaultJsonServiceId, I believe in RTC rtc.cnf.
Is this correct ? How to use chain.py example to connect to local rtc ?
@mark.sinner
To connect to RTC, you need to use the platform.deployed session with the following configurations.
"deployed": { "app-key": "YOUR APP KEY GOES HERE!", "realtime-distribution-system": { "url" : "YOUR DEPLOYED HOST:PORT GOES HERE!", "dacs" : { "username" : "YOUR DACS ID GOES HERE!", "application-id" : 256, "position" : "" } } }
For example:
"deployed": { "app-key": "", "realtime-distribution-system": { "url" : "127.0.0.1:15000", "dacs" : { "username" : "api", "application-id" : 256, "position" : "" } } }
Then, you can use the EX-2.02.06-Pricing-StreamingChain.ipynb example. For example:
chain = pricing.chain.Definition(name="0#USTSY=TWEB", service="ELEKTRON_DD").get_stream() chain.open(with_updates=False) chain.close() print(chain.constituents)
Thank you for reaching out to us.
If item requests don't have the service name property, it will use the service from the *rtc*defaultJsonServiceId configuration. Please refer to the Testing Real-time Streaming applications with Docker & Refinitiv Real-Time Connector (part 2) article.
Where did you get the chain.py example?
Hello @mark.sinner
You can specify the service name in the item request message as follows:
Example: service name is ELEKTRON_DD
{ "ID":2, "Key":{ "Name":"VOD.L", "Service": "ELEKTRON_DD" } }
The example is from LSEG Data Python:
Example.DataLibrary.Python/Examples/1-Access/EX-1.01.07-Chains.ipynb at lseg-data-examples · LSEG-API-Samples/Example.DataLibrary.Python
I don't see a way to specify the Service other than the rtc config. Trying below gets error with service= or Service=: chn = ld.discovery.Chain(name="0#USTSY=TWEB",Service="IDN_RDF")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Chain.init() got an unexpected keyword argument 'Service'
Code:
import os import lseg.data as ld from lseg.data.discovery import Chain import datetime from IPython.display import display, clear_output import logging.config
def display_data(data, instrument, stream): clear_output(wait=True) current_time = datetime.datetime.now().time() print(current_time, "- Data received for", instrument) display(data) ld.open_session(config_name='./lseg-data.config.json') chn = ld.discovery.Chain(name="0#USTSY=TWEB",Service="IDN_RDF") print(chn.constituents) print(chn.summary_links) ld.get_data(chn, ['BID', 'ASK'])
ld.close_session()
All seems to work with the last example except getting "…". Why ? Should be 407 rows.
BID ASK
912797QW0=TWEB 99.4595 99.463014 BID ASK 912797QW0=TWEB 99.459500 99.463014 91282CKR1=TWEB 101.328125 101.355469 BID ASK 912797QW0=TWEB 99.459500 99.463014 91282CKR1=TWEB 101.328125 101.355469 91282CKE0=TWEB 100.785156 100.820312 BID ASK 912797QW0=TWEB 99.459819 99.463014 91282CKR1=TWEB 101.328125 101.355469 91282CKE0=TWEB 100.785156 100.820312 BID ASK 912797QW0=TWEB 99.459819 99.463014 91282CKR1=TWEB 101.328125 101.355469 91282CKE0=TWEB 100.785156 100.820312 912797QF7=TWEB 99.287000 99.296472 BID ASK MATUR_DATE ASK_C_DISC BID_C_DISC 91282CFE6=TWEB 99.964844 100.027344 2025-08-15 NaN NaN 912828K74=TWEB 99.957031 100.027344 2025-08-15 NaN NaN 912810EV6=TWEB 99.640625 100.390625 2025-08-15 NaN NaN 912797QK6=TWEB 99.953639 99.954194 2025-08-19 4.14 4.165 912797PP6=TWEB 99.930667 99.931333 2025-08-21 4.07 4.11 ... ... ... ... ... ... ←—————— Here 912810UC0=TWEB 89.9375 90 2054-08-15 NaN NaN 912810UE6=TWEB 95.125 95.171875 2054-11-15 NaN NaN 912810UG1=TWEB 97.125 97.1875 2055-02-15 NaN NaN 912810UK2=TWEB 99.140625 99.1875 2055-05-15 NaN NaN 912810UM8=TWEB 99.1875 99.21875 2055-08-15 NaN NaN
[407 rows x 5 columns]
It may relate to the display.max_rows setting in the pandas.
pd.set_option('display.max_rows', None)