This fundamental provider downloads free historical earnings data for U.S. stocks available from
Zacks website.
Part of MS123 Extra Fundamental/News Providers.
Sample chart annotations |
Zacks provides earnings data going several years back: Date, Period Ending, Reported EPS, EPS estimate, EPS surprise, Surprise %, Release Time (
of day). Each item comes with these extra details attached:
periodEnding, estimate, surprise, surprisePct, time.
They are available in two forms:
- In a popup when mousing over an [z] Zacks Adjusted Earnings item on a stock chart
- In WealthScript Strategoes via the GetDetail or FormatValue methods:
Make sure you've collected the fundamental data before running this Strategy (Data Manager > "Update Data" tab > check
"Zacks Adjusted Earnings" > go to "DataSets" tab > click "Update DataSet").
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
protected override void Execute()
{
const char tab = '\u0009';
string item = "z Zacks Adjusted Earnings";
IList fList = FundamentalDataItems(item);
ClearDebug();
PrintDebug(Bars.Symbol + tab + "Item Count: " + fList.Count);
PrintDebug("FY" + tab + "FQ" + tab + "Bar" + tab + "Date " + tab + "Value" + tab + "FormatValue");
foreach (FundamentalItem fi in fList)
{
PrintDebug(fi.GetDetail("fiscal year") + tab
+ fi.GetDetail("current quarter") + tab
+ fi.Bar.ToString() + tab
+ fi.Date.ToShortDateString() + tab
+ fi.Value.ToString("$#,0.00")
+ tab + fi.FormatValue().Replace("\n", " ") );
}
ChartPane p = CreatePane(30,true,true);
PlotFundamentalItems(p,item,Color.FromArgb(255,255,0,0),LineStyle.Solid,1);
}
}
}
This example shows how to get the earnings release time field (before/after market):
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
protected override void Execute()
{
const char tab = '\u0009';
string item = "z Zacks Adjusted Earnings";
IList fList = FundamentalDataItems(item);
ClearDebug();
PrintDebug(Bars.Symbol + tab + "Item Count: " + fList.Count);
PrintDebug("Date " + tab + "Value" + tab + "Release Time");
foreach (FundamentalItem fi in fList)
{
PrintDebug(fi.Date.ToShortDateString() + tab + fi.Value.ToString("$#,0.00") + tab + fi.GetDetail("time"));
}
ChartPane p = CreatePane(30, true, true);
PlotFundamentalItems(p, item, Color.FromArgb(255, 255, 0, 0), LineStyle.Solid, 1);
}
}
}