Article

Eikon Data API - Cheat Sheet

Chavalit Jintamalit
Developer Advocate Developer Advocate

This is a cheat sheet for Eikon Data API calls on different asset types.

1. Symbology

Example 1 - get_data()

    	
            RICS=['IBM','WMT','MSFT','AAPL','TWTR']
RICS_list=[RIC+"@ticker" for RIC in RICS]

ticker,err = ek.get_data(RICS_list,'TR.RIC')
ticker

Example 2 - get_symbology()

    	
            codes = ['IBM','WMT','MSFT','AAPL','TWTR']

ticker = ek.get_symbology(codes, bestMatch=False)
ticker

Example 3 - get RIC from bond

    	
            PreferredRIC,err = ek.get_data('US9128283J70',fields=['TR.PreferredRIC'])
PreferredRIC

Example 4 - get CUSIP and international CUSIP

    	
            RICS = ['IBM.N','VOD.L','GOOG.O','0005.HK']
fields = ['TR.CUSIP','TR.CUSIPExtended','TR.PriceClose']

CUSIP,err = ek.get_data(RICS, fields)
CUSIP

Example 5 - Screener, please see also this guide and TRBC code.

    	
            SCREENER_REQUEST = """SCREEN(U(IN(  Equity(active,public,primary) )),
                    IN(TR.TRBCEconSectorCode,"51"),
                    TR.CompanyMarketCap>=10000000000,CURN=USD)"""

Screener_Data,err = ek.get_data([SCREENER_REQUEST],fields=['TR.RIC','TR.CompanyName'])
Screener_Data

2. Deals

    	
            permid,err = ek.get_data('300828.SZ','TR.OrganizationID')

screen ="""SCREEN(U(IN(DEALS)/*UNV:DEALSEQ*/),TR.NIisECM=True,
        IN(TR.NIParticipant(NIDealPartRole=IS),""" + str(permid.iloc[0,1]) + "))"

data,err = ek.get_data(screen,['TR.NIHasLockup','TR.NILockupDays','TR.,→NILockupShares'])
data

3. Company Guidance

    	
            

fields = ['TR.GuidanceMeasure(Period=FY1)',
          'TR.GuidancePeriodYear(Period=FY1)',
          'TR.GuidancePeriodMonth(Period=FY1)',
          'TR.GuidanceDate(Period=FY1)',
          'TR.GuidanceText(Period=FY1)',
          'TR.GuidanceSpeaker(Period=FY1)',
          'TR.GuidanceDocType(Period=FY1)']

guidance,err = ek.get_data('TSLA.O', fields)
guidance

 

4. Earnings

    	
            RICS = ['TSLA.O','AAPL.O','IBM','AMZN.O','JPM','GS']
fields = ['TR.EpsSmartEst','TR.EPSMean','TR.EpsPreSurprisePct','TR.EpsPreSurprise',
          'TR.EpsPreSurpriseFlag','TR.EPSMedian','TR.EPSLow','TR.EPSHigh']

eps,err = ek.get_data(RICS, fields)
eps

5. Analyst Recommendations

    	
            fields = ['TR.AnalystName','TR.RecLabelEstBrokerName','TR.RecEstValue',
          'TR.BrkRecLabel','TR.TPEstValue','TR.EPSLTGEstValue',
          'TR.SingleStockRatingRecommendation1to5T24M',
          'TR.SingleStockRatingRecommendation1to100T24M',
          'TR.RecMean','TR.PriceTargetMean','TR.LTGMean']

analysts,err = ek.get_data(['TSLA.O'], fields)
analysts.head(5)

6. Timeseries

Example 1 - get_data() with field level parameter

    	
            RICs = ['AAPL.O','IBM','MSFT.O','TWTR.K']
start_date = '2019-12-12'
end_date = '2019-12-15'

ts,e = ek.get_data(RICs,
                   ['TR.PriceClose(SDate=2019-12-12,EDate=2019-12-15,Frq=D).date',
                    'TR.PriceClose(SDate=2019-12-12,EDate=2019-12-15,Frq=D)',
                    'TR.TotalReturn1Mo(SDate=2019-12-12,EDate=2019-12-15,Frq=D)'])
ts

Example 2 - get_data() with request level parameter

    	
            RICs = ['AAPL.O','IBM','MSFT.O','TWTR.K']

ts,e = ek.get_data(RICs,
                   ['TR.PriceClose.date','TR.PriceClose','TR.TotalReturn1Mo'],
                   {'SDate':'2019-12-12','EDate':'2019-12-15','Frq':'D'})
ts

Example 3 - get_timeseries()

    	
            RICs = ['AAPL.O','IBM']

ts = ek.get_timeseries(RICs, start_date='2019-12-12', end_date='2019-12-15')
ts

7. Industry Analysis / The Refinitiv Business Classifications (TRBC)

    	
            RICS = ['AIRP.PA','BASFn.DE','1COV.DE','AKZO.AS','DSMN.AS','LXSG.DE','SOLB.BR','CLN.S']
fields = ['TR.CommonName','TR.TRBCEconomicSector','TR.TRBCBusinessSector',
          'TR.TRBCIndustryGroup','TR.TRBCIndustry','TR.TRBCActivity',
          'TR.TRBCEconSectorCode','TR.TRBCBusinessSectorCode','TR.TRBCIndustryGroupCode',
          'TR.TRBCIndustryCode','TR.TRBCActivityCode']

trbc,err = ek.get_data(RICS, fields)
trbc

8. Ownership Data

Example 1

    	
            fields = ['TR.InsiderFullName','TR.InsiderFullName.date',
          'TR.AdjSharesTraded','TR.TransactionDate','TR.AdjSharesHeld']

own,err = ek.get_data('TWTR.K', fields ,{'SDate':'2018-04-16','EDate':'2020-04-15','Frq':'Q'})
own

Example 2

    	
            fields = ['TR.FundPortfolioName','TR.FundInvestorType','TR.FdAdjPctOfShrsOutHeld',
          'TR.FundAdjShrsHeld','TR.FdAdjSharesHeldValue','TR.FundHoldingsDate']

own,err = ek.get_data('AAPL.O', fields,{'SDate':-25,'EDate':-24,'Frq':'D'})
own = own[own["Fund Shares Held (Adjusted)"]!=0].reset_index(drop=True)
own

9. Corporate Actions Data

    	
            fields = ['TR.EventType','TR.EventTitle','TR.EventStartDate','TR.EventLastUpdate']
parameters = {'SDate':'2015-08-01','EventType':'ALL','EDate':'2017-11-20'}

corax,err = ek.get_data('AAPL.O', fields, parameters)
corax

10. Volatility

Example 1 - Volatility

    	
            vols_profile=['TR.Volatility2D','TR.Volatility5D','TR.Volatility10D',
              'TR.Volatility15D','TR.Volatility20D','TR.Volatility25D',
              'TR.Volatility30D','TR.Volatility40D','TR.Volatility50D',
              'TR.Volatility60D','TR.Volatility90D','TR.Volatility100D',
              'TR.Volatility120D','TR.Volatility150D','TR.Volatility160D',
              'TR.Volatility180D','TR.Volatility240D','TR.Volatility250D',
              'TR.Volatility260D']

vols,err = ek.get_data(['AAPL.O','IBM.N','AOT.BK'], vols_profile)
vols.transpose()

Example 2 - Equity Implied Volatility

    	
            #EQUITY IMPLIED VOLS  = Ticker + "ATMIV.U" (Reference the IMPLIEDVOL speed_guide within Eikon)
RIC = 'WMT' + 'ATMIV.U'

fields = ['TR.30DAYATTHEMONEYIMPLIEDVOLATILITYINDEXFORCALLOPTIONS',
          'TR.30DAYATTHEMONEYIMPLIEDVOLATILITYINDEXFORPUTOPTIONS',
          'TR.60DAYATTHEMONEYIMPLIEDVOLATILITYINDEXFORCALLOPTIONS',
          'TR.60DAYATTHEMONEYIMPLIEDVOLATILITYINDEXFORPUTOPTIONS',
          'TR.90DAYATTHEMONEYIMPLIEDVOLATILITYINDEXFORCALLOPTIONS',
          'TR.90DAYATTHEMONEYIMPLIEDVOLATILITYINDEXFORCALLOPTIONS']



implied_vol, err=ek.get_data(RIC, fields,{'SDate':0,'EDate':-10,'Frq':'D'})
implied_vol

Example 3 - Futures Implied Volatility

    	
            # Futures Implied Vols = Ticker + 'ATMIV' (refernce FUT/IMPLIEDVOL1 Speed Guide in Eikon)
# Examples,  Corn (1CATMIV), Wheat (1WATMIV), Crude Oil (CLATMIV), 10Y UST(2TYATMIV)...

RICS = ['1CATMIV','1WATMIV','CLATMIV','2TYATMIV',]
fields = ['TR.30DAYATTHEMONEYIMPLIEDVOLATILITYINDEXFORCALLOPTIONS',
          'TR.30DAYATTHEMONEYIMPLIEDVOLATILITYINDEXFORPUTOPTIONS',
          'TR.60DAYATTHEMONEYIMPLIEDVOLATILITYINDEXFORCALLOPTIONS',
          'TR.60DAYATTHEMONEYIMPLIEDVOLATILITYINDEXFORPUTOPTIONS',
          'TR.90DAYATTHEMONEYIMPLIEDVOLATILITYINDEXFORCALLOPTIONS',
          'TR.90DAYATTHEMONEYIMPLIEDVOLATILITYINDEXFORCALLOPTIONS']

fut_implied_vol, err=ek.get_data(RICS, fields)
fut_implied_vol

11. Portfolios and Lists

Type 'PAL' on Eikon search bar and press enter to launch Portfolio & List Manager app (for example 1 and 2)

Type 'MON' on Eikon search bar and press enter to launch Monitor app (for example 3)

Example 1 - Portfolio

    	
            fields = ['TR.PortfolioStatementDate','TR.PortfolioModifiedDate','TR.PortfolioConstituentName',
          'TR.PortfolioShares','TR.PortfolioWeight','TR.PortfolioDate',
          'TR.PriceClose(SDate=2020-12-14)','TR.CompanyMarketCap(Scale=6,SDate=2020-12-14)']


PortData,err=ek.get_data(["Portfolio('TEST-PORTFOLIO','20201214')"], fields)
PortData

Example 2 - List

    	
            ListData,err = ek.get_data("List('test-list1')",['TR.RIC','CF_LAST'])
ListData

Example 3 - Monitor

    	
            MonitorData,err = ek.get_data("Monitor('TEST-MONITOR')",['TR.RIC','CF_LAST'])
MonitorData

Example 4 - Index/Exchange Constituents as of certain date

    	
            IndexData,err = ek.get_data('0#.IXIC(20190102)',['TR.RIC'])
IndexData

Example 5 - Index Leavers/Joiners

    	
            fields = ['TR.IndexJLConstituentRIC','TR.IndexJLConstituentName','TR.IndexJLConstituentChangeDate.change']

LeaversJoiners,err = ek.get_data('.SPX', fields,{'SDAte':'20190101','EDate':'20191201','IC':'B'})
LeaversJoiners

12. Fixed Income Data

Example 1 - Bond Status

    	
            RICS = ['841338AA4=','717081EP4=','US10YT=RR','FR201534887=','931142BF9=','909279AG6=']
fields = ['TR.FiIssuerName','TR.FiNetCoupon','TR.FiMaturityDate','TR.FIAssetStatus','TR.FiAssetStatusDescription']

bond_status,err = ek.get_data(RICS, fields)
bond_status

Example 2 - Fixed Income Securities Core Reference Data

    	
            RICS = ['717081EP4=','US10YT=RR','FR201534887=','931142BF9=','DE182350257=']
fields = ['TR.FiIssuerName','TR.FiParentTicker','TR.ISIN','TR.CUSIP','TR.FiCurrency',
          'TR.FiNetCoupon','TR.FiMaturityDate','TR.FiIndustrySubSectorDescription',
          'TR.FiSPRating','TR.FiMoodysRating','TR.FiFitchsRating','TR.FiFaceOutstanding']

fi_sec_master,err = ek.get_data(RICS, fields)
fi_sec_master

Example 3 - Bond Pricing

    	
            bond_rics=['US931142CB75=TE','931142CB7=RRPS','931142CB7=','931142CB7=2M','931142CB7=1M']
fields = ['CF_SOURCE','TR.BIDPRICE','TR.ASKPRICE','TR.MIDPRICE','TR.BIDYIELD','TR.MIDYIELD','TR.ASKYIELD']

bond_prices,err = ek.get_data(bond_rics, fields)
bond_prices.sort_values(['Mid Price'])

Example 4 - Bond Analytics

    	
            RICS = ['717081EP4=','US10YT=RR','FR201534887=','931142BF9=','DE182350257=']
fields = ['TR.YieldToMaturityAnalytics','TR.YieldToWorstAnalytics','TR.DurationAnalytics',
          'TR.ModifiedDurationAnalytics','TR.ConvexityAnalytics','TR.GovernmentSpreadAnalytics',
          'TR.SwapSpreadAnalytics','TR.AssetSwapSpreadAnalytics','TR.ZSpreadAnalytics','TR.OASAnalytics']

fi_analytics,err = ek.get_data(RICS, fields)
fi_analytics

Example 5 - Historical Bond Pricing

    	
            point_in_time,err = ek.get_data(['717081EP4='],
                                ['TR.YieldToMaturityAnalytics'],
                                {'SDate':'2019-01-17','EDate':'2019-01-17','Frq':'D'})
point_in_time

Example 6 - Historical Analytics

    	
            ytm,err = ek.get_data(['717081EP4='],
                     ['TR.YieldToMaturityAnalytics(ValuationDate=2020-02-10)',
                      'TR.ModifiedDurationAnalytics(ValuationDate=2020-02-10)',
                      'TR.ConvexityAnalytics(ValuationDate=2019-02-10)'])
ytm

Example 7 - Credit Default Swaps

    	
            cdx,err = ek.get_data(['0#CDXIG5YC=R'],['CF_NAME'])
cdslist = cdx['Instrument'].tolist()
fields = ['TR.CDSOrgShortName','TR.CDSTenor','TR.PARMIDSPREAD','TR.SPREADOVERRATING',
          'TR.SPREADOVERSECTOR','TR.SPREADOVERSUBSECTOR','TR.DEFAULTPROBABILITY']

cds,err = ek.get_data(cdslist, fields)
cds.dropna()