Framework Reference
WEALTHLAB FRAMEWORK / CLASS REFERENCE

MarketManager

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

Search the framework

Find classes, members, and documentation.

NamespaceWealthLab.Core
Parent

MarketManager is a static utility class that manages information about markets and symbols in WealthLab. It maintains a collection of MarketDetails instances representing markets such as US stocks, futures, Forex, and cryptocurrencies, as well as SymbolInfo instances containing symbol-specific information. MarketManager is particularly useful to developers of custom Data Provider extensions that need to install or access market and symbol information.

Static Members

28

AddMarket

public static MarketDetails AddMarket(MarketDetails md, bool save = true)

Adds the MarketDetails instance specified in md to the collection of installed markets. If a market with the same name already exists, the existing MarketDetails instance is returned instead. If save is true, the updated market collection is saved to persistent storage. Returns the newly added or existing MarketDetails instance.

AddSymbol

public static SymbolInfo AddSymbol(SymbolInfo si)

Adds the SymbolInfo instance specified in si to the collection of symbol-specific information. If a matching symbol already exists, the existing SymbolInfo instance is returned instead. The symbol collection is sorted and saved to persistent storage after a new symbol is added.

Cryptos

public static MarketDetails Cryptos

Returns the MarketDetails instance that represents the cryptocurrency market.

Currencies

public static MarketDetails Currencies

Returns the MarketDetails instance that represents the Forex currencies market.

CurrencySymbols

public static List<string> CurrencySymbols

Returns a List containing the currency symbols recognized by MarketManager.

FindMarket

public static MarketDetails FindMarket(string name)

Searches the installed markets for the market whose Name matches the specified name. The comparison is case-insensitive. Returns the matching MarketDetails instance, or null if no matching market is found.

FindSymbol

public static SymbolInfo FindSymbol(string symbol)

Searches the installed symbol information for the specified symbol. Returns the matching SymbolInfo instance, or null if no matching symbol is found.

GetCommission

public static Commission GetCommission(MarketDetails market)
public static Commission GetCommission(SymbolInfo si)

Returns the user-defined Commission associated with the specified market or SymbolInfo instance (si). Returns null if no user-defined commission has been assigned.

GetContractMonth

public static int GetContractMonth(string code)

Converts a futures contract month code into its corresponding month number. For example, "F" returns 1 for January, "H" returns 3 for March, and "Z" returns 12 for December. Throws an ArgumentException if code is not a recognized futures contract month code.

HolidaySetNames

public static List<string> HolidaySetNames

Returns a sorted List containing the names of all Holiday Sets installed in MarketManager.

HolidaySets

public static Dictionary<string, HolidaySet> HolidaySets

Returns a Dictionary containing the HolidaySet instances installed in MarketManager, keyed by Holiday Set name. A HolidaySet contains the holiday dates and any special market hours associated with a particular market calendar.

Initialize

public static void Initialize()

Initializes MarketManager by loading user-defined market and symbol information from the WealthLab data folder. Market information is loaded from Markets.txt, and symbol-specific information is loaded from Symbols.txt.

IsForex

public static bool IsForex(string symbol)

Returns true if symbol appears to represent a Forex currency pair. The method recognizes six-character currency pairs such as "EURUSD", as well as common variations using separators or suffixes, such as "EUR/USD", "EUR.USD", and "EURUSD.FOREX". Both three-character components must be recognized currency symbols, and the base and quote currencies must be different.

Markets

public static List<MarketDetails> Markets

Returns a List containing all of the markets installed in MarketManager, expressed as MarketDetails instances.

MarketsTxt

public static string MarketsTxt

Returns the name of the file used to persist user-defined market information, "Markets.txt".

MarketsTxtFileName

public static string MarketsTxtFileName

Returns the complete path and file name of the file used to persist user-defined market information.

RegisterHolidaySet

public static List<DateTime> RegisterHolidaySet(
string holidaySetName,
string holidays,
double offsetHoursOpen = 0,
double offsetHoursClose = 0)

Registers a Holiday Set named holidaySetName using the newline-delimited holiday information supplied in holidays. Standard holiday entries use the yyyy-MM-dd format. Entries can also specify special market hours by supplying the date, opening time, and closing time separated by semicolons. The optional offsetHoursOpen and offsetHoursClose parameters adjust the special opening and closing times. Returns a List of DateTime values containing the full-market-closure holiday dates that were registered.

RemoveMarket

public static void RemoveMarket(MarketDetails md)

Removes the market specified in md from MarketManager, if it exists and can be edited. Any symbol-specific entries associated with the market are also removed.

RemoveSymbol

public static void RemoveSymbol(SymbolInfo si)

Removes the SymbolInfo instance specified in si from MarketManager and saves the updated symbol information to persistent storage.

SaveMarkets

public static void SaveMarkets()

Saves the editable MarketDetails instances in Markets to the WealthLab Markets.txt file.

SaveSymbols

public static void SaveSymbols()

Saves the SymbolInfo instances in Symbols to the WealthLab Symbols.txt file.

SetCommission

public static void SetCommission(MarketDetails market, Commission c)
public static void SetCommission(SymbolInfo si, Commission c)

Associates the Commission specified in c with a market or individual symbol. Pass null for c to remove an existing user-defined commission assignment.

Symbols

public static List<SymbolInfo> Symbols

Returns a List of SymbolInfo instances containing the symbol-specific information installed in MarketManager.

SymbolsTxt

public static string SymbolsTxt

Returns the name of the file used to persist symbol-specific information, "Symbols.txt".

SymbolsTxtFileName

public static string SymbolsTxtFileName

Returns the complete path and file name of the file used to persist symbol-specific information.

UpdateMarket

public static void UpdateMarket(MarketDetails md)

Updates the installed market whose name matches the MarketDetails instance specified in md. If no matching market exists, md is added as a new market.

UpdateSymbol

public static void UpdateSymbol(SymbolInfo si)

Updates the installed symbol information matching the SymbolInfo instance specified in si. If no matching symbol exists, si is added as a new symbol.

UsaStocks

public static MarketDetails UsaStocks

Returns the MarketDetails instance that represents the US stock market.

Need help with this API?

Ask the community or explore custom development services.