Parent: Object
The EventDataPoint class represents a single piece of event data, such as a fundamental data item (dividend, split, earnings), 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 event data using the EventDataPoints property or the GetEventDataPoints method of the BarHistory class.
EventDataPoint supports both a parameterless constructor and a constructor that assigns the Name, Date, and optionally Value properties. The second constructor also initializes Data to an empty string.
Contains optional string data populated by the Event Data Provider that generated the event. Each provider can use this property differently, so consult the provider's documentation for details.
The date/time associated with the event.
Returns a string used to identify duplicate event data points. The default implementation combines the event's Date, Text, and ProviderName, separated by semicolons. Derived EventDataPoint classes can override this property to provide their own deduplication logic.
Returns a string used for daily deduplication of events such as dividends during backtesting. The value combines the date portion of Date and the Name of the event, separated by a semicolon.
Contains item-specific information associated with the event, represented as string values keyed by string names. The Dictionary is created on first access if it has not already been assigned.
using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Data; namespace WealthScript1 { public class MyStrategy1 : UserStrategyBase { public override void Initialize(BarHistory bars) { foreach (EventDataPoint edp in bars.EventDataPoints) { string data = $"{edp.ProviderName}\t{edp.Date.ToShortDateString()}\t{edp.Value}"; if (edp.HasDetailItems) { foreach (var item in edp.Details) data += $"\t{item.Key}:{item.Value}"; } else data += "\t(No Details)"; WriteToDebugLog(data); } } public override void Execute(BarHistory bars, int idx) { } } }
The ending date/time associated with the event. If an ending date has not been explicitly assigned, this property returns the value of Date.
Returns true if the Details Dictionary has been created and contains one or more items.
Returns true if the event's Date falls between the StartDate and EndDate of the BarHistory specified in bh, inclusive.
Returns a display-friendly version of the event's Name. If Name contains a prefix ending in a closing bracket (]), the prefix is removed and the remaining text is trimmed.
using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Data; namespace WealthLab { public class MyStrategy1 : UserStrategyBase { public override void Initialize(BarHistory bars) { if (bars.EventDataPoints.Count > 0) { EventDataPoint edp = bars.EventDataPoints[bars.EventDataPoints.Count - 1]; DrawHeaderText("The most recent event item is a " + edp.ItemName + " reported on " + edp.Date.ToShortDateString(), WLColor.Green, 18); } } public override void Execute(BarHistory bars, int idx) { } } }
The name of the event. Examples include "Split", "Dividend", or "Analyst Rating".
Contains the name of the Event Data Provider that generated this event.
Returns descriptive text for the event. The default implementation combines Name and Value, with Value formatted to two decimal places. Derived EventDataPoint classes can override this property to provide a more appropriate description.
using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Data; namespace WealthLab { public class MyStrategy1 : UserStrategyBase { public override void Initialize(BarHistory bars) { if (bars.EventDataPoints.Count > 0) { EventDataPoint edp = bars.EventDataPoints[bars.EventDataPoints.Count - 1]; DrawHeaderText("The most recent event item is " + edp.Text, WLColor.Green, 18); } } public override void Execute(BarHistory bars, int idx) { } } }
Returns the text used for the event's chart tooltip. The text begins with the value of Text. If ProviderName is not null, empty, or whitespace, a second line is appended in the form Source: ProviderName.
The numeric value associated with the event. For example, a 2:1 split could have a Value of 2, while a $1.50 per-share dividend could have a Value of 1.5.
using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Data; namespace WealthLab { public class MyStrategy1 : UserStrategyBase { public override void Initialize(BarHistory bars) { if (bars.EventDataPoints.Count > 0) { EventDataPoint edp = bars.EventDataPoints[bars.EventDataPoints.Count - 1]; DrawHeaderText("The most recent event item is a " + edp.ItemName + " with a value of " + edp.Value.ToString("N2"), WLColor.Green, 18); } } public override void Execute(BarHistory bars, int idx) { } } }
Returns the background color to use for a procedurally generated chart glyph. The default value is null, allowing WealthLab to determine the glyph color procedurally. Derived EventDataPoint classes can override this property to specify a particular color.
Returns the name of an image resource to use for the event's chart glyph. The default value is null, which causes WealthLab to generate the glyph using GlyphText and GlyphColor. Derived EventDataPoint classes can override this property to supply a custom image resource.
Returns the text used when WealthLab procedurally generates a chart glyph for the event. The default implementation returns the first character of ItemName.
Returns the value of DedupText as the string representation of the EventDataPoint.