how do i get CF_LAST and CF_CLOSE with lseg.data?

Im trying like this, but it is not working:
ticker_list = list(tickerStrings) # Your ticker list
max_items = 100
results = []
for i in range(0, len(ticker_list), max_items):
try:
chunk = ticker_list[i:i + max_items]
df_chunk = ld.content.pricing.Definition(
chunk,
fields=['CF_LAST', 'CF_CLOSE']
).get_data().data.df
results.append(df_chunk)
except Exception as e:
print(f"Error processing chunk {i//max_items + 1}: {e}")
output:
No user scope for key=/data/pricing/snapshots/v1/, method=GET.
Error processing chunk 1: Insufficient scope for key=/data/pricing/snapshots/v1/, method=GET.Required scopes: {'trapi.data.pricing.read'}Available scopes: {'trapi.streaming.prcperf.read', 'trapi.alerts.history.crud', 'trapi.data.historical-pricing.summaries.read', 'trapi.data.symbology.advanced.read', 'trapi.data.symbology.read', 'trapi.platform.iam.groups', 'trapi.platform.iam.guiss', 'trapi.user-framework.mobile.crud', 'trapi.userdata.lists.read', 'trapi.data.portfolios.write', 'trapi.metadata.read', 'trapi.alerts.publication.crud', 'trapi.metadata.nsa.read', 'trapi.research-analytics.fx-impact-intelligence', 'trapi.data.wealth-clients.wfdca', 'trapi.searchcore.read', 'trapi.graphql.subscriber.access', 'trapi.data.quantitative-analytics.read', 'trapi.synthetic.crud', 'trapi.cfs.claimcheck.read', 'trapi.platform.iam.acl_service', 'trapi.searchcore.metadata.read', 'trapi.searchcore.lookup.read', 'trapi.userdata.lists.write', 'trapi.streaming.synthetic.read', 'trapi.user-framework.workspace.crud', 'trapi.search.explore.read', 'trapi.data.benchmark.bmk_read', 'trapi.data.historical-pricing.events.read', 'trapi.frtb.sentimarization', 'trapi.sdbold', 'trapi.auth.cloud-credentials', 'trapi.data.portfolios.read', 'trapi.commodities.yesenergy.read', 'trapi.alerts.preferences.crud', 'trapi.data.api.msr_read', 'trapi.data.get.data.read', 'trapi.streaming.pricing.read', 'trapi.search.lookup.read', 'trapi.data.average-volume-analytics.ava_read', 'trapi.data.wealth-clients.advisor_dashboard', 'trapi.userdata.portfolio-management.read', 'trapi.alerts.subscription.crud', 'trapi.tradefeedr.basic.read', 'trapi.user-framework.application-metadata.raplib', 'trapi.messenger', 'trapi.search.read', 'trapi.user-framework.workspace.marval', 'trapi.search.metadata.read', 'trapi.user-framework.recently-used.crud'}Missing scopes: {'trapi.data.pricing.read'}Error processing chunk 2: Insufficient scope for key=/data/pricing/snapshots/v1/, method=GET.
Answers
-
ps: im not using config file to connect. im connecting calling this function:
def ld_connect(APP_KEY = os.environ['REFINITIV_EDP_API'], USER = os.environ['REFINITIV_USER'], PASS = os.environ['REFINITIV_PASSWORD']): session = ld.session.platform.Definition( app_key = APP_KEY, grant = ld.session.platform.GrantPassword( username = USER, password = PASS ), signon_control = True ).get_session() session.open() ld.session.set_default(session) print("LSEG connected") return session
ld_connect()
0 -
im trying this way also:
ticker_list = list(tickerStrings) # Your ticker list max_items = 100 results = []
for i in range(0, len(ticker_list), max_items): try: chunk = ticker_list[i:i + max_items] df_chunk = ld.content.pricing.Definition( chunk, fields=['CF_LAST', 'CF_CLOSE'] ).get_stream().open(with_updates=False).get_snapshot() results.append(df_chunk) except Exception as e: print(f"Error processing chunk {i//max_items + 1}: {e}")
output:Error processing chunk 1: 'OpenState' object has no attribute 'get_snapshot'Error processing chunk 2: 'OpenState' object has no attribute 'get_snapshot'
0 -
if i remove the .get_snapshot(), then no df is returned
0 -
Hello @augusto_krappa
Your ID does not have the permission to get the real time data. You can reach out to the LSEG account manager to get these additional entitlements.
I would recommend that, once the permissions are fixed, that you start with the provided Pricing samples for the LD Library.
0
Categories
- All Categories
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 684 Datastream
- 1.4K DSS
- 613 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 248 ETA
- 552 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 629 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 191 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 84 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛