Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 0 0 2

Seeking Time Interval Codes for 20-Minute and 30-Minute Data in Refinitiv DataPlatform

I am currently using the Refinitiv DataPlatform Python library for intraday data analysis. My focus is on equities, and I have successfully implemented a routine to retrieve 1-minute interval data using the following code:

import pandas as pd
import refinitiv.dataplatform as rdp

# Define the datetime range
start_date = '2023-08-18'
end_date = '2023-09-17'

all_data3 = pd.DataFrame()

# Get data
for RIC in rics_list:
    response = rdp.HistoricalPricing.get_summaries(
        universe=RIC,
        interval=rdp.Intervals.ONE_MINUTE,
        start=start_date,
        end=end_date,
        fields=['TRDPRC_1', 'ACVOL_UNS', 'HIGH_1', 'LOW_1', 'BID', 'ASK']
    )
    
    if response is not None and response.data.df is not None:
        df_bid_ask = response.data.df
        df_bid_ask.columns = pd.MultiIndex.from_product([[RIC], df_bid_ask.columns])
        
        df_bid_ask.index = pd.to_datetime(df_bid_ask.index)

        # Adjust the time filter for NYSE trading hours
        df_bid_ask = df_bid_ask.between_time('14:30', '21:00')

        df_bid_ask = df_bid_ask.loc[lambda x: x.index.dayofweek < 5]

        if all_data3.empty:
            all_data3 = df_bid_ask
        else:
            all_data3 = pd.concat([all_data3, df_bid_ask], axis=1)

# Display the concatenated data
print(all_data3.tail())

This code has been effective for gathering 1-minute interval data, but I've noticed significant gaps in the data due to the absence of tick data for periods without trades.

To address this, I'm looking to aggregate the data over longer intervals, specifically 20-minute and/or 30-minute periods. However, I am uncertain about the correct interval codes to use for these timeframes in the rdp.HistoricalPricing.get_summaries function.

Could anyone provide guidance on the appropriate interval codes for 20-minute and 30-minute data retrieval using the Refinitiv DataPlatform Python library? Any additional insights into handling intervals with sparse data would also be greatly appreciated.


Thank you in advance!

refinitiv-dataplatform-eikonrdp-apirefinitiv-data-platformpython apitime-seriesrdp
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
Accepted
78.6k 248 52 74

@s1810335

Thank you for reaching to us.

You can run the help(rdp.Intervals) command to check the available intervals.

 |  Data and other attributes defined here:
 |  
 |  DAILY = <Intervals.DAILY: 'P1D'>
 |  
 |  FIVE_MINUTES = <Intervals.FIVE_MINUTES: 'PT5M'>
 |  
 |  MONTHLY = <Intervals.MONTHLY: 'P1M'>
 |  
 |  ONE_HOUR = <Intervals.ONE_HOUR: 'PT1H'>
 |  
 |  ONE_MINUTE = <Intervals.ONE_MINUTE: 'PT1M'>
 |  
 |  QUARTERLY = <Intervals.QUARTERLY: 'P3M'>
 |  
 |  SEVEN_DAYS = <Intervals.SEVEN_DAYS: 'P7D'>
 |  
 |  SIXTY_MINUTES = <Intervals.SIXTY_MINUTES: 'PT60M'>
 |  
 |  TEN_MINUTES = <Intervals.TEN_MINUTES: 'PT10M'>
 |  
 |  THIRTY_MINUTES = <Intervals.THIRTY_MINUTES: 'PT30M'>
 |  
 |  TWELVE_MONTHS = <Intervals.TWELVE_MONTHS: 'P12M'>
 |  
 |  WEEKLY = <Intervals.WEEKLY: 'P1W'>
 |  
 |  YEARLY = <Intervals.YEARLY: 'P1Y'>
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.