How Do i only get the monthly quotes (excl Q & Cal)

HI

How do I get only the monthly quotes in the query? It currently pulls the Q and Cal quotes.

Reuters_Ticker = '0#DUBSGEFS:

dfDubaiEFS, err = ek.get_data(Reuters_Ticker,'Euro_Close')

Thanks


Joe


Best Answer

  • raksina.samasiri
    Answer ✓

    Hi @joe.wright ,

    I'm not sure if we can filter that in the get_data call. However, you may use the code below to filter only monthly data from the output dataframe

    import numpy as np
    dfDubaiEFS, err = ek.get_data('0#DUBSGEFS:',['DSPLY_NAME','EURO_CLOSE'])

    # get only monthly data
    months = ['JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC']
    dfDubaiEFS['Monthly'] = np.where(dfDubaiEFS['DSPLY_NAME'].str[10:13].isin(months), True, False)

    dfDubaiEFS_monthly = dfDubaiEFS[dfDubaiEFS['Monthly']==True]
    display(dfDubaiEFS_monthly)

    1635489764452.png

    Note: the monthly data was filtered using DSPLY_NAME column, to get only name that contain months, so the quarterly (e.g. Dubai EFS 3Q25) and annually (e.g. Dubai EFS 2025) are filtered out

    1635489789739.png