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
1 1 1 4

How to get all Mergers and Acquisitions deal information on the Python API (code)?

I encountered two technical issues when retrieving Merger&Acquisition deal data from the screener using the Eikon Data API via python.

1. The first issue pertains to the time horizon. In order to retrieve deal data efficiently, I use the command below to claw the data from API from 2000 to 2022. However, python is not accounting for the full time horizon that I have specified in my input command and it reports the “TimeoutException” error. At current, the maximum duration I could output is one year. I am wondering if there is any alternative method I could use to output the deal information from 2000 to 2022.

deal = ek.get_data("SCREEN(U(IN(DEALS)),BETWEEN(TR.MnAAnnDate,20000101,20221231))",             ["TR.MnAAnnDate","TR.MnATarget","TR.MnATargetPermId","TR.MnAAcquiror","TR.MnAAcquirorPermId"])  


2. The second issue regards to the variable list inputted into the python script. The above code are copied from the Refinitiv Community and it works well for retrieving one-year data. But how can I transfer the screener expression and criteria into the Python script. When I use the “insert Screen”, the expression in the excel cell shows gibberish letters.


“=@TR("SCREEN(U(IN(DEALS)/*UNV:DEALSMNA*/), relativedate(TR.MnAAnnDate,YTD)/*dt:Date*/, CURN=USD)","TR.MnASDCDealNumber,TR.MnAAnnDate,TR.MnATarget,TR.MnATargetPermId,TR.MnATargetMacroInd,TR.MnATargetMidInd,TR.MnATargetNation,TR.MnAAcquiror,TR.MnAAcqui"&"rorPermId,TR.MnAAcquirorMacroInd,TR.MnAAcquirorMidInd,TR.MnAAcquirorNation,TR.MnATargetFinAdvisor(Concat='|'),TR.MnAAcquirorFinAdvisor(Concat='|')/*EncodedScreenStart[{""currency"":""USD"",""universeĊĀlistsĊ[]đallě""actĕĚ:trueđinīĭĖĊfĦęđownėshipĻĽ"&"Ĵ""primaryOnlĉİIJŊŌĕatįļlľŋubĝcĊıijđcoēıyŚŏőquoŝňŠe}đexclusionġ:ģđēĮĘeCƃŝxtĊ""DEALSMNAĐ""deĦPŐĭcņantRolįnuħĵdTůƬƮlź""filŝĘĢĀtƳƒDŜĚĵsEķŤedŧŘĿpėŜorƒYƟr to ǃŶdžOŁŃŅŇ:şšƹelnj:ƿǁċmetaƜiǫ""I_ƔƖ_ƙA_BASICǹƕƗǽTRANSACTIOƚNNOUNCEMENTDATEƜpŐaǰƼƅ""ƜıƦsfǓmƅƇ""Ŭtputƍſm"&"nƒvĦijƜǓƞǔċƔSC""ƷmĶǝį""202301ɕƜŏxɎƒɑɓ04ɗđąlŜĮɛ:1ɢǩɥĖɎƲǐĊ0ĥnŒrAħƒƖLƜrŬnƱǮ""ȋYɘɍDŽAsTodaŖǦŊəɎʈʊʌʎʼn}Ĥ""logicĦOǐrɥƃʉąeƅƭƯ""mʋɏscʧȽđɤğGōƱempɤŶǬ""ķǰƒCăąƧ SʱeĆ TʺʼDŽȫʁĂğomɊ}]EncodedScreenEnd*/","Curn=USD CH=Fd")”

screenshot-2023-04-01-at-101627-am.png

eikon-data-api#productpython api
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.

Hi @Academic09

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?


If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,


AHS

@Academic09

Hi,

Please be informed that a reply has been verified as correct in answering the question, and marked as such.

Thanks,

AHS

Upvotes
Accepted
78.9k 250 52 74

@Academic09

Thanks for reaching out to us.

I got the same error when running the code. It could be the server timeout. The server can cancel the request due to the timeout. The get_data method is not designed to request bulk data in one request.

You may need to limit the requested date to one year. I tested it and it works fine. Otherwise, you can contact your Refinitiv account team or Sales team for other products.

The text inside the (/*....*/) characters is a comment so you can ignore it in the Python code. Therefore, the code looks like this:

deal, err = ek.get_data("SCREEN(U(IN(DEALS)), relativedate(TR.MnAAnnDate,YTD), CURN=USD)",
                        ["TR.MnASDCDealNumber","TR.MnAAnnDate","TR.MnATarget","TR.MnATargetPermId",
                         "TR.MnATargetMacroInd","TR.MnATargetMidInd","TR.MnATargetNation",
                         "TR.MnAAcquiror","TR.MnAAcquirorPermId","TR.MnAAcquirorMacroInd",
                         "TR.MnAAcquirorMidInd","TR.MnAAcquirorNation",
                         "TR.MnATargetFinAdvisor(Concat='|')",
                         "TR.MnAAcquirorFinAdvisor(Concat='|')"],{"Curn":"USD"})
deal

The output is:

1680500352527.png

I hope that this information is of help.


1680500352527.png (56.3 KiB)
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.

Upvotes
5k 16 2 7

Hi @Academic09 ,


Thank you for your question. The Search capabilities of RD Library would be useful for ingesting M&A data. You can build up on the folowing code from this article:

MnA = rd.discovery.search(
    view = rd.discovery.Views.DEALS_MERGERS_AND_ACQUISITIONS,

    #specify filtering properties
    filter = "((AcquirerCompanyName ne 'Creditors' and AcquirerCompanyName ne 'Shareholder') and (TargetCountry eq 'US' or TargetCountry eq 'UK')"
    + "and TransactionValueIncludingNetDebtOfTarget ge 100 and TargetPublicStatus eq 'Public')"
    + "and (TransactionStatus eq 'Completed' or TransactionStatus eq 'Pending' or TransactionStatus eq 'Withdrawn')"
    + "and (FormOfTransactionName xeq 'Merger' or FormOfTransactionName xeq 'Acquisition') and (TransactionAnnouncementDate le 2022-04-14 and TransactionAnnouncementDate ge 2022-01-01)",
    
    #select only the required fields and order them based on announcement date
    #then specify number of items to be 10000, default value is 100
    select = 'TransactionAnnouncementDate, TargetCompanyName, TargetRIC',
    order_by = 'TransactionAnnouncementDate desc',
    top = 10000)

MnA.head()

screenshot-2023-04-03-at-095114.png


You may also find this and this articles useful on utilizing the search.


Hope this would be helpful, please let me know should you have any further questions.

Best regards,

Haykaz



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.