Delayed prices using LSEG Workspace API

Hello,
I'm trying to collect bids for LCOc1 as soon as the bid change in realtime.
My main issue is that I have a 10 min delay.
_________________________________
import time
import pandas as pd
import eikon as ek
import os
# Set Eikon API Key for access to financial data
ek.set_app_key('API_KEY_HERE')
# Define the instrument symbols
instruments = ["LCOc1"]
# Define the directory and file path for storing the CSV file
csv_directory = r"C:\Users\YOUR_PATH\" # Use raw string to handle Windows paths
csv_file = os.path.join(csv_directory, "eikon_LCOc1_data.csv")
# Ensure the directory exists
os.makedirs(csv_directory, exist_ok=True)
# Define the DataFrame columns
columns = ["Timestamp", "LCOc1_BID", "LCOc1_Time"]
# Track the last recorded bid values to avoid duplicate logging
last_bids = {"LCOc1": None}
try:
# Infinite loop to continuously fetch data
while True:
# Fetch BID data for LCOc1 using Eikon API
df = ek.get_data(instruments, ["CF_BID", "CF_TIME"])[0] # Get the first item of the returned tuple
# Check if data was retrieved
if df is None or df.empty:
print("Error: No data retrieved. Retrying...")
time.sleep(1) # Wait before retrying
continue
# Extract the bid price and time for LCOc1
try:
lco_data = df.loc[df['Instrument'] == 'LCOc1', ['CF_BID', 'CF_TIME']].iloc[0]
lco_bid = lco_data['CF_BID']
lco_time = lco_data['CF_TIME']
except IndexError:
print("Error: Missing bid data for LCOc1.")
time.sleep(1)
continue
# Log only if there is a change in bid prices
if lco_bid != last_bids["LCOc1"]:
timestamp = pd.Timestamp.now().strftime("%Y-%m-%d %H:%M:%S.%f")
new_row = pd.DataFrame([[timestamp, lco_bid, lco_time]], columns=columns)
# Append data to the CSV file (create if it doesn't exist)
new_row.to_csv(csv_file, mode="a", index=False, header=not os.path.exists(csv_file))
# Log the update
print(f"New Data at {timestamp}: LCOc1 BID = {lco_bid}, Time = {lco_time}")
# Update last recorded bid values
last_bids["LCOc1"] = lco_bid
# Small delay to avoid excessive API calls
time.sleep(0.05) # Adjust as needed
except KeyboardInterrupt:
print("\nProcess interrupted. Data saved in:", csv_file)
_________________________________
The result looks like this :
Timestamp | LCOc1_BID | LCOc1_Time |
---|---|---|
2025-03-12 09:52:07.812040 | 69.96 | 08:42:04 |
2025-03-12 09:52:12.707826 | 69.95 | 08:42:08 |
2025-03-12 09:52:15.209595 | 69.94 | 08:42:12 |
So I have a 1 hour delay due to GMT (no problem) + 10 minutes that I don't know where it comes from.
On my Workspace, I have Realtime data going through Private network.
Thanks for your help in advance
G
Answers
-
Hello @Gianni_D
You are trying to use the API in a manner that is likely to breach the data limits guidelines and hence subject to throttling!
If the application needs streaming data, please look into using the LD Library for Python and using the pricing streaming example. This library works with Eikon/Workspace using a Desktop Session. The realtime streaming data may/may not be available, depending on your data license. You can check with your LSEG account manager to get these data permissions.
0 -
You may access the delayed data. You can use the Quote app to verify the data.
I also get the 10 min delayed data for LCOc1 when using the Quote App.
The 10 min delay could be the default delayed time for LCOc1
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 685 Datastream
- 1.4K DSS
- 615 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
- 252 ETA
- 556 WebSocket API
- 38 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
- 650 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
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 228 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛