Streaming Data Provider API
A Streaming Data Provider Extension allows WealthLab 9 to subscribe to live market data for one or more symbols. As ticks, bid/ask updates, heartbeats, or completed streaming bars arrive from the underlying data source, the Streaming Data Provider forwards those updates to WealthLab.
Build Environment
You can create a Streaming Data Provider in a .NET development tool such as Visual Studio 2026.
Create a class library project that targets .NET10, then reference the WealthLab.Core library DLL that you'll find in the WL9 installation folder.
Your Streaming Data Provider will be a class in this library that descends from StreamingProviderBase, which is defined in the WealthLab.Core library, in the WealthLab.Data namespace. After you implement and build your library, simply copy the resulting assembly DLL into the WL9 installation folder. The next time WL9 starts up, it will discover your Streaming Data Provider, making it available in appropriate locations of the WL9 user interface.

Accessing the Host (WL9) Environment
The IHost interface provides access to the current WealthLab environment. Extensions can use it to retrieve application-level information and services, such as the location of the user's WealthLab data folder or the DataSets defined by the user.
You can access the current IHost instance from anywhere in your extension through the WLHost singleton and its Instance property. For example, the following code retrieves the path to the user's WealthLab data folder:
string folder = WLHost.Instance.DataFolder;
Use WLHost.Instance whenever your extension needs access to functionality exposed by the IHost interface.
Configuring a Streaming Data Provider
StreamingProviderBase ultimately derives from Configurable, which provides the standard WealthLab configuration framework. By default, StreamingProviderBase uses a ConfigurableType of ParameterList, so the Provider is configured using Parameter instances contained in a ParameterList. Define these Parameters by overriding GenerateParameters. Parameters can represent values such as:
- User names
- Passwords
- API keys
- Connection settings
- Other Provider-specific configuration
WealthLab presents these Parameters in a configuration dialog and allows the user to enter values of the appropriate types. You can alternatively use a ConfigurableType of VanillaString. In that case, the Provider works directly with the Configuration string rather than Parameter instances. If you use VanillaString and require a custom configuration interface, see Providing UI Elements for Extensions.
Descriptive Properties
The Configurable base class provides descriptive properties that determine how your Streaming Data Provider appears in WealthLab. The most important properties to override are:
- Name
- GlyphResource
- Description
- URL
Initialization
public virtual void Initialize()
Override this method to perform any initialization required before the Streaming Data Provider begins servicing requests. For example, you might initialize API clients, socket libraries, or other Provider-specific resources.
Connecting to the Streaming Source
protected abstract bool Connect()
Override this method to establish a connection to the streaming data source. Typical streaming sources include:
- Socket connections
- WebSocket connections
- APIs or threads that periodically poll for quotes
The Connect method is synchronous. Return true if the connection succeeds and false otherwise.
IsConnected
public bool IsConnected
Returns true if a previous connection attempt was successful and the Streaming Data Provider is considered connected.
DisconnectStreaming
public void DisconnectStreaming(
string reason,
Exception ex = null)
Call this method when your Provider detects that its connection to the streaming source has been lost. Pass a description of the problem in reason and, when available, the corresponding Exception in ex. If your Provider supports automatic reconnection, calling DisconnectStreaming starts the reconnection process. After a successful reconnect, WealthLab automatically restores existing tick and streaming-bar subscriptions.
SupportsAutoReconnect
public virtual bool SupportsAutoReconnect => false;
Override this property and return true to enable automatic reconnection. When enabled, call DisconnectStreaming after detecting a lost connection. StreamingProviderBase will then attempt to reconnect.
Reconnect
protected virtual bool Reconnect()
Override this method if your Provider needs custom reconnection logic. The default implementation first checks for internet connectivity and then calls your Provider's Connect method. If internet connectivity cannot be restored within the supported retry period, the reconnect attempt fails and the method returns false. Return true when the Provider has successfully reconnected.
ReconnectInProgress
public bool ReconnectInProgress { get; }
Returns true while StreamingProviderBase is attempting to reconnect. This can be useful inside Connect when the initial connection performs actions that should not be repeated during reconnection. For example, if you normally establish a heartbeat by subscribing to a symbol during Connect, you can skip that work while ReconnectInProgress is true, since WealthLab will restore existing subscriptions after the connection is reestablished.
Subscribing to Streaming Data
SubscribeTo
protected abstract void SubscribeTo(
string symbol)
Override this method to subscribe to live updates for the specified symbol. As market data arrives, call the appropriate update methods described below. WealthLab manages multiple internal consumers of the same symbol, so your Provider does not need to track duplicate WealthLab requests separately.
UnsubscribeFrom
protected abstract void UnsubscribeFrom(
string symbol)
WealthLab calls this method when it no longer requires streaming data for the specified symbol. Override it to cancel the corresponding subscription with the underlying data source.
Reporting Trade Ticks
public void UpdateTick(
string symbol,
DateTime dt,
double price,
double size,
double prevClose)
Call UpdateTick whenever the Provider receives a new trade tick. The parameters are:
- symbol - The symbol that traded.
- dt - Timestamp of the trade.
- price - Trade price.
- size - Trade size or volume.
- prevClose - Previous session's closing price, or
0if unavailable.
For example:
UpdateTick(
symbol,
timestamp,
tradePrice,
tradeSize,
previousClose);
Tick Timestamp
The DateTime supplied in dt should use the time zone of the market in which the symbol trades. A Streaming Data Provider can potentially handle symbols from different exchanges and time zones, so the timestamp should correspond to the individual symbol's market. If the Streaming Provider has a companion Historical Data Provider, both Providers should use the same market definition for the symbol.
Reporting Bid and Ask Updates
public void UpdateBidAsk(
string symbol,
double bid,
double ask)
Call this method whenever the source reports updated bid or ask prices. Pass:
- symbol
- bid
- ask
If only one side of the quote is available, pass Double.NaN or -1 for the unavailable value. For example:
UpdateBidAsk(
"MSFT",
bid,
ask);
Reporting Heartbeats
public void UpdateHeartbeat(DateTime dt)
Streaming services often provide heartbeat messages that indicate the connection is still healthy. Call UpdateHeartbeat whenever such a heartbeat is received. You can also generate a heartbeat from another reliable data source, such as a frequently traded symbol. WealthLab uses heartbeats to help close pending streaming bars at the proper time. For this reason, heartbeat updates should occur shortly after each one-minute boundary whenever possible. For example, an ideal heartbeat might arrive one second after each new minute.
Heartbeat Timestamp
Unlike trade ticks, a heartbeat is not associated with any specific symbol or market. The DateTime supplied in dt should therefore use the computer's local time zone.
Reporting Aggregate Tick Updates
public void UpdateTicksHighLow(
string symbol,
DateTime dt,
double high,
double low,
double close,
double size,
double prevClose)
Use this method instead of UpdateTick when the underlying source supplies aggregate updates containing:
- High
- Low
- Last price
- Aggregate volume
Pass the corresponding values along with the symbol, timestamp, and previous closing price.
SubscriptionCount
public int SubscriptionCount
Returns the number of symbols that currently have active streaming subscriptions.
Streaming Bars
Some streaming data sources can provide completed bars directly instead of, or in addition to, individual ticks. StreamingProviderBase supports this through a separate streaming-bar subscription mechanism.
SupportsStreamingBarInterval
public virtual bool SupportsStreamingBarInterval(
int interval)
Override this method and return true if the underlying source supports completed streaming bars for the specified interval. The interval is expressed in minutes. For example:
public override bool SupportsStreamingBarInterval(
int interval)
{
return interval == 1 ||
interval == 5 ||
interval == 15;
}
SubscribeToStreamingBar
protected virtual void SubscribeToStreamingBar(
string symbol,
HistoryScale scale)
Override this method to establish a completed-bar subscription for the specified symbol and HistoryScale.
UnsubscribeFromStreamingBar
protected virtual void UnsubscribeFromStreamingBar(
string symbol,
HistoryScale scale)
WealthLab calls this method when it no longer needs streaming bars for the specified symbol and scale. Override it to cancel the corresponding subscription with the source.
UpdateStreamingBar
public void UpdateStreamingBar(
string symbol,
HistoryScale scale,
BarData barData)
Call this method when the source reports that a complete streaming bar has finished. Pass:
- symbol - Symbol represented by the bar.
- scale - HistoryScale of the completed bar.
- barData - A BarData instance containing the bar's OHLC/V values.
For example:
BarData bar = new BarData
{
Date = barDate,
Open = open,
High = high,
Low = low,
Close = close,
Volume = volume
};
UpdateStreamingBar(
symbol,
scale,
bar);
Use UpdateStreamingBar only for completed bars. Partial or still-forming bars should not be reported through this method.