import refinitiv.data as rd
from datetime import datetime, timedelta
1. Start your session
rd.open_session()
2. Define parameters
ric = "JETFCNWECKMc1"
end_date = datetime.now()
start_date = end_date - timedelta(days=10*365)
3. Fetch historical dataAdded 'CLOSE' as a fallback/standard historical field name
df = rd.get_history(
universe=[ric],
start=start_date.strftime('%Y-%m-%d'),
end=end_date.strftime('%Y-%m-%d'),
fields=['CF_CLOSE']
)
4. Handle Results
if df is not None and not df.empty:
print(f"Successfully retrieved {len(df)} rows.")
print(df.tail()) # Viewing the most recent 5 days
Save to CSV for analysis
df.to_csv(f"{ric}_10Y_History.csv")
print(f"\nData exported to {ric}_10Y_History.csv")
else:
print("No data found. Checking if fields are named differently...")
Fallback: Fetch without specific fields to see what the API provides
df_check = rd.get_history(universe=[ric], interval="daily", count=5)
if df_check is not None:
print("Available fields for this RIC are:", df_check.columns.tolist())
rd.close_session()
THIS CODE i am not getting data it is sayting the universe does not support CF_CLOSE
BUT IN REUTERS I SEE THE DATA FOR THIS FIELD IF U WANT,
I CAN SHARE A PHOTO FOR THIS