Fama French Factors using Eikon API or RDP

Is there a Refinitiv python library that can be used to compute the Fama-french factors for a market? Specifically looking to create the SMB, HML, RMW and CMA factors for Singapore Market.
Best Answer
-
@rajanraju So I would do this in 2 steps.
First we need to get all the book closing dates for FY0.
ff_universe = ['VOD.L','RR.L']
cols = ['TR.F.PeriodEndDate', 'TR.F.SourceDate']
params = {'SDate':'0', 'Frq':'FY'}
mkt_cap, _ = ek.get_data(list(ff_universe), cols, params)
mkt_cap['MarketCapBookClosing'] = np.nan
mkt_capThen we need to find the market cap on the period end date:
for i, row in mkt_cap.iterrows():
df2,err = ek.get_data(row[0],['TR.CompanyMarketCapitalization'],
parameters={'SDate':''+row[1]+''})
if len(df2):
mkt_cap['MarketCapBookClosing'][i] = df2['Company Market Capitalization']
mkt_capI hope this can help.
0
Answers
-
I'd like to know this too. You could always compute them manually with a complete data set of SP stocks. Just keep in mind F/F factors don't translate into real world returns due to transaction costs and liquidity constraints on mutual fund holdings (& much of the supposed FF advantage in the US was from questionable datasets, at least pre-1962).
0 -
Hello @rajanraju,
In my view, this is an excellent question.
This forum is intended for and can be most helpful to you with Eikon Data API Python usage questions.
The moderators of the forums are not experts in many types of content that is made available by Refintiiv, nor all of the content available via Eikon/Refinitiv Wworkspace.
However, whenever we can help- we try our best to do so.
And I can see how, your question, as it encompasses both content expertise and API usage expertise, it will not be trivial to obtain the clarification from Refinitiv content experts for this type of question, either, although the availability of the content is where, in my view, the answer takes it root.
To explain, Eikon Data API python in it's essence is the way for retrieve content that is available via Eikon/Refinitiv Workspace, using python.
In order to delve deeper into your question, let us consider:
- Are you able to view this content via Eikon? If yes, please share the details
- If yes, are you able to pinpoint the same content either via Eikon Data Item Browser or via Eikon Formula Builder? If yes, please share the information
- If not, however, I am afraid this content will not be available via Eikon Data API.
A subset of RDP services is available via RD library and it's predecessor, RDP library. You will find the available functionality and content exemplified in CodeBook _Examples_. In terms of where I would look for this, thinking under Quantitative Analysis, Advanced Use Cases->Modeling and Equity Research. From my review, I do not see this being offered "out of the box".
0 -
@zoya faberov Many thanks. I have been liaising with the content folks and find that the information is available. Specifically:
1. Market capitalisation as of September 30 annually. The Eikon Field is TR.CompanyMarketCapitalization. The complication: for a more accurate representation and avoid data snooping, need the number of shares outstanding (one of TR.F.ShrUsedToCalcBasicEPSTot or TR.F.ComShrOutsTot) as of the last reporting and multiply this by the closing price on September 30.
2. Book to Market (1/Price to Book):
1. If the firm’s financial year ended in March, the B/M ratio is computed using the data at the end of March of the same year (Book Value, TR.F.BookValuePerShr, from reported financials and closing price as of March 30.)
2. If the firm’s financial year ended in any other quarter, compute the B/M ratio using the book value reported in the firm’s financial yearend of year t − 1 and the closing price as of March 30 for year t.
I provide the universe of RICs each year to get the data. For instance, would loop the following code snippet for each year to get the market capitalisation (in this case, the year is 2020-09-30)
cols = ['TR.F.PeriodEndDate, TR.F.CompanyMarketCapitalization.date, TR.F.SourceDate, TR.CompanyMarketCapitalization']
params = {'SDate':'2020-09-30', 'Frq':'CY '}
mkt_cap, _ = ek.get_data(list(ff_universe), cols, params)
However, this gives me the MC as of September 30 using the shares outstanding and closing price on that day. Appreciate any help in formulating the most efficient ek.get_data() call.
0 -
@jason.ramchandani01 many thanks. Very useful. I tried to avoid the 2-step process, but your note shows that there is no other reasonable option forward.
Much appreciated @zoya faberov @jason.ramchandani01
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
- 684 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
- 249 ETA
- 554 WebSocket API
- 37 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
- 643 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
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 192 TREP Infrastructure
- 228 TRKD
- 915 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 中文论坛