Search Framework:
EventDataPoint
Namespace: WealthLab.Data
Parent: Object

The EventDataPoint class represents a single piece of event data, such as a fundamental data item (dividend, split, earlings), analyst rating, or chart pattern. WealthLab supports several Event Data Providers, both included out of the box and available via extensions. Each provider supplies its own set of historical event data.

You can access this event data by using the EventDataPoints property or the GetEventDataPoints method of the BarHistory class.

Constructors
EventDataPoint
public EventDataPoint()
public EventDataPoint(string name, DateTime dt, double value = 0)

EventDataPoint supports both a parameterless constructor, and one which assigns values to the Name, Date, and optionally Value properties.



Members
Data
public string Data

May contain some string data that is populated by the event data provider that generated this event data item. Each event data provider could use this property to represent different things, so consult with the documentation of the provider's extension for more details.


Date
public DateTime Date

Returns the date that the event data item was reported.

Example Code
using WealthLab.Backtest;
using WealthLab.Core;
using WealthLab.Data;
using System.Drawing;

namespace WealthLab
{
	public class MyStrategy1 : UserStrategyBase
	{
		//create indicators and other objects here, this is executed prior to the main trading loop
		public override void Initialize(BarHistory bars)
		{
			if (bars.EventDataPoints.Count > 0)
			{
				EventDataPoint fdp = bars.EventDataPoints[bars.EventDataPoints.Count - 1];
				DrawHeaderText("The most recent event item is a " + fdp.ItemName + " reported on " + fdp.Date.ToShortDateString(), WLColor.Black, 18);
			}
		}

		//execute the strategy rules here, this is executed once for each bar in the backtest history
		public override void Execute(BarHistory bars, int idx)
		{
		}
	}
}

Details
public Dictionary<string, string> Details

A Dictionary of string values keyed by string keys that can contain item-specific information.


HasDetailItems
public bool HasDetailItems

Returns true if there are any items in the instance's Details Dictionary.


InCurrentRange
public bool InCurrentRange(BarHistory bh)

Returns true if the event data item's Date falls within the historical data that is currently contained in the BarHistory specified in bh.


ItemName
public string ItemName

Returns the name of the event. The implementation is based on the Name value, but removes certain prefixes that occur in some Event Data Providers.

Example Code
using WealthLab.Backtest;
using WealthLab.Core;
using WealthLab.Data;
using System.Drawing;

namespace WealthLab
{
	public class MyStrategy1 : UserStrategyBase
	{
		//create indicators and other objects here, this is executed prior to the main trading loop
		public override void Initialize(BarHistory bars)
		{
			if (bars.EventDataPoints.Count > 0)
			{
				EventDataPoint fdp = bars.EventDataPoints[bars.EventDataPoints.Count - 1];
				DrawHeaderText("The most recent event item is a " + fdp.ItemName + " reported on " + fdp.Date.ToShortDateString(), WLColor.Black, 18);
			}
		}

		//execute the strategy rules here, this is executed once for each bar in the backtest history
		public override void Execute(BarHistory bars, int idx)
		{
		}
	}
}

Name
public string Name

Describes the name of the event. For example, "Split", "Dividend", or "Analyst Rating".


ProviderName
public string ProviderName

Contains the name of the Event Data Provider that generated this event instance.


Text
public virtual string Text

Returns descriptive text for this event data point. Generally, this is a combination of the item's ItemName and Value, but different event items can return different strings to express themselves.

Example Code
using WealthLab.Backtest;
using WealthLab.Core;
using WealthLab.Data;
using System.Drawing;

namespace WealthLab
{
	public class MyStrategy1 : UserStrategyBase
	{
		//create indicators and other objects here, this is executed prior to the main trading loop
		public override void Initialize(BarHistory bars)
		{
			if (bars.EventDataPoints.Count > 0)
			{
				EventDataPoint fdp = bars.EventDataPoints[bars.EventDataPoints.Count - 1];
				DrawHeaderText("The most recent event item is a " + fdp.Text, WLColor.Black, 18);
			}
		}

		//execute the strategy rules here, this is executed once for each bar in the backtest history
		public override void Execute(BarHistory bars, int idx)
		{
		}
	}
}

TooltipText
public string TooltipText

Returns the text that appears in the tooltip when the user hovers over the event's glyph icon in the chart. The text is composed of the Text property, with the item's ProviderName displayed below.


Value
public double Value

Returns the numeric value associated with the event data point. For example, a 2:1 split would have a Value of 2, while a $1.50 per share dividend would have a Value of 1.5.

Example Code
using WealthLab.Backtest;
using WealthLab.Core;
using WealthLab.Data;
using System.Drawing;

namespace WealthLab
{
	public class MyStrategy1 : UserStrategyBase
	{
		//create indicators and other objects here, this is executed prior to the main trading loop
		public override void Initialize(BarHistory bars)
		{
			if (bars.EventDataPoints.Count > 0)
			{
				EventDataPoint fdp = bars.EventDataPoints[bars.EventDataPoints.Count - 1];
				DrawHeaderText("The most recent event item is a " + fdp.ItemName + " with a value of " + fdp.Value.ToString("N2"), WLColor.Black, 18);
			}
		}

		//execute the strategy rules here, this is executed once for each bar in the backtest history
		public override void Execute(BarHistory bars, int idx)
		{
		}
	}
}


Members for Derived Classes
GetBarGlyph
public virtual object GetBarGlyph()

In EventDataPoint derived classes, you can override this method to return an instance of a class derived from BarGlyphBase that should be used to render the event to the chart.


Glyph
public virtual Bitmap Glyph

In a derived class, you can override this property to return a System.Drawing.Bitmap that represents the event's glyph icon on the chart. The default value returns null, which causes the chart to proceduraly generate the glyph icon, using the GlyphText and GlyphColor properties.


GlyphColor
public virtual Color? GlyphColor

Returns the background color to use when rendering the event glyph icon to the chart. This property is invoked in EventDataPoint derived classes that do not override the GetBarGlyph method. The default return value is null, which causes the color to be procedurally determined based on the item's ItemName.


GlyphText
public virtual string GlyphText

Returns the text that should be rendered on the chart for this event. This property is invoked in EventDataPoint derived classes that do not override the GetBarGlyph method. The default implementation takes the first character of the instance's ItemName property.