EPS release date calendar from Fidelity site
Author: bobydesi123
Creation Date: 8/29/2013 8:56 PM
profile picture

bobydesi123

#1
Hi Cone/Eugene,
I need help on extracting EPS release date data from the fidelity site. e.g. for companies releasing Earning on 8/30/2013 the link is:
https://eresearch.fidelity.com/eresearch/conferenceCalls.jhtml?tab=earnings&begindate=8/30/2013
I tried using the HTML parser HtmlAgilityPack getting inspiration from the solution you had provided but couldn't get very far. There seems to be no documentation for HtmlAgilityPack. Apparently it assumes that one knows 'Xpath' very well , which i am not familiar with it much. I am requesting(shamelessly :( ) if you or any forum member can show an example code using the 'HtmlAgilityPack' to extract at least one line from the EPS calendar, i would be much obliged. e.g. for the date of 8/30/13 calender the 1st line is:

CA:ATD.B Q1 8/30/2013 Before Market Yes

I can take on from there.
Thank you.
profile picture

Eugene

#2
Here's your earnings calendar for a given date.

Okay, here go usual Prerequisites:

1. Installed Community Components 2012.12 or higher - just because it includes the required HtmlAgilityPack.dll v1.4.6
2. In Strategy Editor, click "References...", scroll down and check System.Xml
3. Until the Editor gets upgraded in WL 6.? to support C#4.0 out of the box, you need to add a reference to System.Core v4.0. Switch to "Other assemblies to reference...", click "Add a reference", find the file called System.Core.dll, highlight it and confirm. The file's placement depends on your OS and WLP "bitness". For 64-bit WLP, choose c:\windows\microsoft.net\framework64\v4.0.30319, for 32-bit WLP it's c:\windows\microsoft.net\framework\v4.0.30319

CODE:
Please log in to see this code.
profile picture

bobydesi123

#3
Thanks a lot for quick response.
I gave the above code a try, works great for the date 'Bars.Date[ Bars.Count-1 ]', if i substitute 'Bars.Date[ Bars.Count-1 ] ' with a future date e.g. '9/4/2013'. The strategy gives error:
...Values cannot be NULL
...it point the source of error to ......GetListOfEPSForDate(dateValue )

The Debug Output (when the strategy generates error) Looks as follows:

9/4/2013
Symbol Date Quarter

https://eresearch.fidelity.com/eresearch/conferenceCalls.jhtml?tab=earnings&begindate=9/04/2013


I think the problem seems to be is with the Fidelity site. If you are looking up calender for today's date, the 'fidelity EPS calender' looks different from the one that is displayed for the future date e.g. 9/4/2013.
This can be verified from the links (if you happen to look it up today,
https://eresearch.fidelity.com/eresearch/conferenceCalls.jhtml?tab=earnings&begindate=8/30/2013
https://eresearch.fidelity.com/eresearch/conferenceCalls.jhtml?tab=earnings&begindate=9/04/2013

What's more confusing is that when looked up https://eresearch.fidelity.com/eresearch/conferenceCalls.jhtml?tab=earnings&begindate=8/30/2013 at about 6:50 am today morning, i think the 'fidelity EPS calender' looked different from what it looks now @8:30am ( I am not 100% sure about it, hadn't had my coffee @ 6:50am....so may be i was in little alpha-wave state)

Anyways, if you don't have chance to look at this post today a have long weekend where i shall try fiddling with the code you have provided.

Once again thanks a gazillion. Have a nice long weekend.

P.S. Do have experience with "Visual Assist X - an add-in for Visual Studio by Whole Tomato Software"? Is it worth getting it for VS2010? As VS2010 has many intellisense features compared to vs2008 (for which i had tried Visual Assist X and was helpful).
profile picture

bobydesi123

#4
....continue from the last post

I think the today's ''fidelity EPS calender'' looks different for the future date (9/04/13) because as the EPS is announced the fidelity updates the ''fidelity EPS calender'' with actual EPS vs. Expected EPS etc.
profile picture

Eugene

#5
QUOTE:
If you are looking up calender for today's date, the 'fidelity EPS calender' looks different from the one that is displayed for the future date e.g. 9/4/2013.


You're right, they do change the HTML slightly for future dates. Surprise! Fortunately, the fix is a one-liner:

CODE:
Please log in to see this code.


Depending on given Date i.e. backtesting/trading, you can substitute appropriate XPath.

QUOTE:
P.S. Do have experience with "Visual Assist X

No, sorry. However, VS Intellisense is getting better with each version - you might want to try VS2012. VS2012 Express now even has Attach To Process debugging.
profile picture

bobydesi123

#6
Thanks as always. I have a paid copy of VS2010 ultimate. Can you get a free copy of VS2012 ultimate/professional? I don't feel like spending more $$ for an upgrade to vs2012 and free VS2012 is limited in functionality.
profile picture

Eugene

#7
Yes, VS2012 Pro is available for free to users or Microsoft's discontinued Websitespark program or students eligible for Dreamspark program.
profile picture

bobydesi123

#8
Eugene,

I replaced the xPath for the future date (9/4/13/) and I still run time get error:

"Index was outside the bounds of array".... the reference is to the GetListOfEPSForDate(DateTime dt)

Debug Window:

Symbol Date Quarter

https://eresearch.fidelity.com/eresearch/conferenceCalls.jhtml?tab=earnings&begindate=9/04/2010


The link https://eresearch.fidelity.com/eresearch/conferenceCalls.jhtml?tab=earnings&begindate=9/4/2013 displays the page correctly within a browser.

profile picture

Eugene

#9
Works for me. Can not reproduce.

You will get this error if attempting to run the 2nd XPath for past dates, and vice versa.
profile picture

bobydesi123

#10
Started a a new clean strategy with references etc. and worked! I must have made some error.
Thanks you for all your help. Have a nice long-weekend.
profile picture

Eugene

#11
Stumbled onto this thread and noticed that the code has stopped working. Something has changed on webpage layout. However, the code should work equally well for a future date w/o modification now.

Prerequisites:

1. HtmlAgilityPack.dll installed (part of Community Components and many data provider extensions)
2. check System.Xml in strategy's "References..." dialog

CODE:
Please log in to see this code.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).