question

Upvotes
1 0 0 1

Eikon to LSEG Workspace API

Hi Team


We are receiving issue while fetching data from LSEG Worspace API while the similar code is working fine in Eikon. Please check provide the solution as soon as possible

CODE:-

import refinitiv.data as rd

from refinitiv.data.discovery import Screener

from refinitiv.data.content import search

from datetime import datetime, timedelta

import pandas as pd

from refinitiv.data.discovery import (

convert_symbols,

SymbolTypes

)


#deals_fields = ['TR.NIDealID','TR.NISdcPackageNumber','TR.NIMasterDealType.code',"TR.NIAllManagersRole(Concat='|').code","TR.NIManagersRole(Concat='|').code",'TR.NIIssueDate()','TR.NIIssuer','TR.NIIssuerPermId',"R.NIIssueType(Concat='|')",'TR.NITransactionStatus','TR.NIIssuerNation','TR.NICurrentFilingDate','TR.NIOfferPrice',"TR.NIProceedsAmtInclOverallotSoldAllMkts(Scale=6)","TR.NIIssuerExchTicker(Concat='|')",'TR.NISecurityTypeAllMkt',"TR.NIOfferingTechnique(Concat='|')","TR.NIGrossSpreadAsPctOfPrincipalAmtThisMktPrint","TR.NIIssuerDomicileSubRegion",'TR.NIIssuerDomicileRegion','TR.NIIssuerTRBCBusinessSector','TR.NIIssuerTRBCEcoSec',"TR.NILeadLeftBookrunner(Concat='|')","TR.NIBookOrCoManager(Concat='|')","TR.NIParentBookOrCoManager(IncludeNull=True,Concat='|')","TR.NIAllManagers(IncludeNull=True,Concat='|')","TR.NILeadManagers(IncludeNull=True,Concat='|')","TR.NIParentLeadManagers(IncludeNull=True,Concat='|')","TR.NIISINAtOffer(Concat='|')","TR.NIIssuerCusip9(Concat='|')","TR.NIIssuerSEDOL","TR.NIPrimaryTickerSymbol(IncludeNull=True,Concat='|')"]

deals_fields = ['TR.NIDealID','TR.NISdcPackageNumber','TR.NIMasterDealType.code',"TR.NIAllManagersRole(Concat='|').code","TR.NIManagersRole(Concat='|').code",'TR.NIIssueDate()','TR.NIIssuer','TR.NIIssuerPermId',"R.NIIssueType(Concat='|')",'TR.NITransactionStatus','TR.NIIssuerNation','TR.NICurrentFilingDate','TR.NIOfferPrice',"TR.NIProceedsAmtInclOverallotSoldAllMkts(Scale=6)","TR.NIIssuerExchTicker(Concat='|')",'TR.NISecurityTypeAllMkt',"TR.NIOfferingTechnique(Concat='|')","TR.NIGrossSpreadAsPctOfPrincipalAmtThisMktPrint","TR.NIIssuerDomicileSubRegion",'TR.NIIssuerDomicileRegion','TR.NIIssuerTRBCBusinessSector','TR.NIIssuerTRBCEcoSec',"TR.NILeadLeftBookrunner(Concat='|')","TR.NIBookOrCoManager(Concat='|')","TR.NIParentBookOrCoManager(IncludeNull=True,Concat='|')","TR.NIAllManagers(IncludeNull=True,Concat='|')","TR.NILeadManagers(IncludeNull=True,Concat='|')","TR.NIParentLeadManagers(IncludeNull=True,Concat='|')","TR.NIISINAtOffer(Concat='|')","TR.NIIssuerCusip9(Concat='|')","TR.NIIssuerSEDOL","TR.NIIssuerPrimayTickerSymbol"]

rd.open_session()

current_date = datetime.strftime(today_date , '%Y%m%d')

end_date = today_date - timedelta(days=8)

end_date = datetime.strftime(end_date, '%Y%m%d')

deals_screen = "SCREEN(U(IN(DEALS)/*UNV:DEALSBOND*/),TR.NIisECM=False, BETWEEN(TR.NIIssueDate(IncludeNull=True),{0},{1})/*dt:Date*/, CURN=USD)"

deals_screen = deals_screen.format(current_date, end_date)

today_date = datetime.strptime(current_date , '%Y%m%d') - timedelta(days=1)


Error:-



SCREEN(U(IN(DEALS)/*UNV:DEALSBOND*/),TR.NIisECM=False, BETWEEN(TR.NIIssueDate(IncludeNull=True),20241017,20241009)/*dt:Date*/, CURN=USD)

[2024-10-18T15:25:32.464722+05:30] - [ERROR] - [sessions.desktop.workspace.2] - [12152] | MainThread

Session is not opened. Can't send any request

Traceback (most recent call last):



lt = rd.get_data(deals_screen,deals_fields)


File C:\python3.10\latest\lib\site-packages\refinitiv\data\_fin_coder_layer\get_data_func.py:50 in get_data

raise_if_closed(session)


File C\python3.10\latest\lib\site-packages\refinitiv\data\_core\session\tools.py:38 in raise_if_closed

raise ValueError(error_message)


ValueError: Session is not opened. Can't send any request

#technologypython apideals
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvote
1.4k 3 2 4

Hi @archit.mittal ,

The user has to clarify the "Session is not opened. Can't send any request" error's root cause.

The Eikon Data API and Refinitiv Data Library - Troubleshooting should help him.

First action would be to enable debug logs with following lines to add before rd.open_session():

config = rd.get_config()
config.set_param("logs.transports.console.enabled", True)
config.set_param("logs.level", "debug")

rd.open_session()

This should produce outputs that'll highlight what's going wrong.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.