Framework Reference
WEALTHLAB FRAMEWORK / CLASS REFERENCE

IHost

API documentation, members, signatures, and C# examples.

Search the framework

Find classes, members, and documentation.

NamespaceWealthLab.Core
Parent

The IHost interface represents the WL9 host environment and provides key integration points for Strategies and WL9 Extensions. You can access the singleton instance of IHost through WLHost.Instance.

public static class WLHost

WLHost is a static class that provides global access to the current IHost implementation.

Members

31

AddLogItem

void AddLogItem(string senderName, string msg, WLColor color, Exception ex = null, object sender = null)

Adds a message to the WL9 log. The senderName identifies the component issuing the message, msg contains the message text, color determines its status indicator color, and ex can contain an associated Exception. Extension developers can optionally pass their extension instance in sender. When the sender is a StreamingProviderBase, WL9 can use the supplied color to update the streaming status indicator in windows using that provider.

AddLogItemOrders

void AddLogItemOrders(string senderName, string msg, WLColor color, Exception ex = null)

Adds a broker-related message to the Order Manager messages pane and the WL9 log.

AppFolder

string AppFolder

Returns the folder where WL9 is installed.

CanExtensionBeLoaded

bool CanExtensionBeLoaded(string productCode, ExtensionLicenseType elt)

Returns whether an Extension associated with the specified productCode and ExtensionLicenseType can be loaded under the user's current license.

ConfigureItem

bool ConfigureItem(Configurable c)

Displays a configuration dialog for the specified Configurable object c. Returns true if the user changes the configuration.

ConfigureParameters

bool ConfigureParameters(ParameterList pl, string title)

Displays a configuration dialog for the parameters contained in pl, using title as the dialog title. Returns true if the user changes the parameters.

CopyFileToDataFolder

void CopyFileToDataFolder(string sourceSubDir, string destSubDir, string fileName, bool alwaysOverwrite, bool reportErrors)

Copies the specified fileName from a subdirectory of the WL9 installation folder to a subdirectory of the WL9 Data Folder. If alwaysOverwrite is true, an existing destination file is overwritten. The reportErrors parameter controls whether errors encountered during the operation are reported.

DataFolder

string DataFolder

Returns the WL9 user data folder.

DataSets

List<DataSet> DataSets

Returns a List of DataSet instances currently available in WL9.

DisplayMessage

void DisplayMessage(string msg)

Displays the specified msg to the user in a message box.

EventsSelected

List<string> EventsSelected

Returns a List of strings containing the names of Event Data Items currently selected for plotting. Remarks

  • The corresponding Event Data Provider must also be enabled for the selected event items to actually be plotted.

ExecutePlatformMethod

object ExecutePlatformMethod(string callerName, string methodName, object parameter)

Executes a platform-specific method and returns its result. This allows platform-neutral WL9 Extension assemblies to invoke functionality implemented in a platform-specific companion assembly. In WL9 WPF, this mechanism is supported by ObjectEditorBase in the WealthLab.WPF library. A derived ObjectEditorBase can identify itself using callerName, respond to methodName, process parameter, and return a platform-specific result.

ExpertMode

bool ExpertMode

Returns true if WL9 is currently operating in Expert Mode. Expert Mode hides various explanatory elements throughout the WL9 user interface.

FindDataSet

DataSet FindDataSet(string name)

Searches for a DataSet with the specified name. Returns the corresponding DataSet instance, or null if no matching DataSet is found.

FindMarket

MarketDetails FindMarket(string symbol)

Returns a MarketDetails instance representing the market associated with the specified symbol.

GetCurrentQuote

Tick GetCurrentQuote(MarketDetails mkt, string symbol, DataSet ds)

Returns a current quote for the specified symbol. The mkt parameter specifies its MarketDetails and ds can specify a preferred DataSet.

GetHistories

List<BarHistory> GetHistories(List<string> symbols, HistoryScale scale, DateTime start, DateTime end, int maxBars, DataRequestOptions hcb)

Returns historical data for the specified list of symbols and scale. Specify a date range using start and end, or use maxBars to request a maximum number of bars. The hcb parameter can contain additional DataRequestOptions, such as a preferred DataSet and intraday filtering options.

GetHistory

BarHistory GetHistory(string symbol, HistoryScale scale, DateTime startDate, DateTime endDate, int maxBars, DataRequestOptions cb)

Returns historical data for the specified symbol and scale. Specify a date range using startDate and endDate, or use maxBars to request a maximum number of bars. The cb parameter can contain additional DataRequestOptions, such as a preferred DataSet and intraday filtering options.

GetPartialBar

BarData GetPartialBar(string symbol, HistoryScale scale, DataSet ds)

Returns the current partial bar for the specified symbol and scale. If ds is not null, WL9 attempts to obtain the data using the specified DataSet first.

InjectSourceCodeCompilerReferences

void InjectSourceCodeCompilerReferences(UniqueList<string> asmRef)

Injects the assembly references contained in asmRef into WL9's source code compiler reference list. This is primarily intended for Extensions that require custom assemblies during dynamic source code compilation.

IsWebSite

bool IsWebSite

Returns true if the current host environment is the WealthLab web site.

LocalUserName

string LocalUserName

Returns the name of the current WealthLab user.

OfflineMode

bool OfflineMode

Returns true if WL9 is currently operating in Offline Mode.

PerformOAuth

string PerformOAuth(string authUrl, string clientName, string matchUrl = "http://localhost")

Performs an OAuth authentication flow using the specified authUrl and clientName. The optional matchUrl identifies the URL used to recognize the OAuth redirect, and defaults to http://localhost. Returns the resulting localhost redirect URL.

PlatformToken

string PlatformToken

Returns a string identifying the current client platform, such as "Web", "WinForms", or "WPF".

PlaySound

void PlaySound(string soundName)

Plays the WL9 sound identified by soundName.

ShowWaitStatus

void ShowWaitStatus(bool wait)

Changes the application's wait cursor state. Pass true to display the wait cursor and false to restore the normal cursor.

WLBuildNumber

int WLBuildNumber

Returns the current WL9 build number.

WLBuildVersion

Version WLBuildVersion

Returns the current WL9 client version as a System.Version instance.

WLHost

1

Instance

public static IHost Instance

Returns the singleton IHost instance representing the current WL9 host environment. Strategies and Extensions can use WLHost.Instance to access the IHost members described above.

Need help with this API?

Ask the community or explore custom development services.