Framework Reference
WEALTHLAB FRAMEWORK / CLASS REFERENCE

MarketDetails

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

Search the framework

Find classes, members, and documentation.

NamespaceWealthLab.Core
Parent
Object

The MarketDetails class contains information about a financial market, such as the US stock market, futures markets, or cryptocurrency markets. It defines properties such as trading days, market hours, time zone, holidays, security type, currency, and display conventions. Historical Data Providers can create MarketDetails instances and associate them with symbols. Users can also create and modify markets using the Markets & Symbols tool.

Members

54

BaseTimeZone

public string BaseTimeZone

Contains the time zone in which the market trades. The value should be a valid Windows time zone ID, such as "Eastern Standard Time". Assigning this property also establishes the TimeZoneInfo and time offsets used by the market's time conversion methods.

BenchmarkSymbol

public string BenchmarkSymbol

Contains a suggested symbol to use as a benchmark for backtest comparisons. For example, a US Stocks market might use SPY, while a cryptocurrency market might use BTC.USD.

CanEdit

public bool CanEdit

Returns true if the MarketDetails instance can be edited by the user. Markets created locally in the WL9 Markets configuration are editable, while markets supplied by providers are generally read-only.

Clone

public MarketDetails Clone()

Creates a new MarketDetails instance containing a copy of this market's settings. The new market's Name is prefixed with "Copy of ".

Commission

public Commission Commission

Gets or sets the user-assigned Commission instance associated with this market.

CommissionDisplay

public string CommissionDisplay

Returns a string representation of the market's assigned Commission, or an empty string if no Commission is assigned.

ConvertLocalTimeToMarketTime

public DateTime ConvertLocalTimeToMarketTime(DateTime dt)

Converts the specified DateTime from the computer's local time zone to the market's BaseTimeZone.

ConvertMarketTimeToLocalTime

public DateTime ConvertMarketTimeToLocalTime(DateTime dt)

Converts the specified DateTime from the market's BaseTimeZone to the computer's local time zone.

ConvertMarketTimeToUtcTime

public DateTime ConvertMarketTimeToUtcTime(DateTime dt)

Converts the specified DateTime from the market's BaseTimeZone to UTC.

ConvertUtcTimeToMarketTime

public DateTime ConvertUtcTimeToMarketTime(DateTime dt)

Converts the specified UTC DateTime to the market's BaseTimeZone.

Currency

public string Currency

Contains the default currency for the market. The default value is "USD".

DisplayDecimals

public int DisplayDecimals

Contains the number of decimal places to use when displaying price data for the market. The default value is 2.

GetCloseTimeLocalTime

public DateTime GetCloseTimeLocalTime()

Returns today's market closing time expressed in the computer's local time zone.

GetCloseTimeMarketTime

public DateTime GetCloseTimeMarketTime()

Returns today's market closing time expressed in the market's BaseTimeZone.

GetHoursLocalTime

public MarketHours GetHoursLocalTime(DateTime dt)

Returns the MarketHours applicable to the specified DateTime. The dt parameter is interpreted in the computer's local time zone and converted to market time before the appropriate hours are determined.

GetHoursMarketTime

public MarketHours GetHoursMarketTime(DateTime dt)

Returns the MarketHours applicable to the specified DateTime, which is interpreted as being in the market's BaseTimeZone. Special market hours defined by the market's HolidaySet take precedence over its normal weekly hours.

GetMissingDates

public List<DateTime> GetMissingDates(string symbol)

Returns a List of dates known to be missing for the specified symbol. Returns an empty List if no missing dates are defined for the symbol.

GetOpenTimeLocalTime

public DateTime GetOpenTimeLocalTime(bool useBaseline)

Returns the applicable market opening time expressed in the computer's local time zone. If useBaseline is true, the baseline opening time defined by the MarketHours is used.

GetOpenTimeMarketTime

public DateTime GetOpenTimeMarketTime(bool useBaseline)

Returns the applicable market opening time expressed in the market's BaseTimeZone.

GetSecurityName

public string GetSecurityName(string symbol)

Returns the security name associated with the specified symbol in the market's SecurityNameMapping. Returns an empty string if no security name is available.

GetTimeZoneDifferenceInHours

public static double GetTimeZoneDifferenceInHours(string timeZoneId1, string timeZoneId2)

Returns the current time difference, in hours, between the two Windows time zone IDs specified in timeZoneId1 and timeZoneId2.

HolidayDates

public List<DateTime> HolidayDates

Returns a List of dates representing market holidays on which the market would normally trade but is closed. The list is obtained from the market's HolidaySet. If no HolidaySet is assigned, an empty List is returned.

HolidaySet

public HolidaySet HolidaySet

Contains the HolidaySet associated with the market. The HolidaySet defines market holidays and can also provide special market hours for particular dates.

IsAlwaysOpen

public bool IsAlwaysOpen

Returns true if the MarketHours applicable to the current market time indicate that the market is always open.

IsLastTradingDateInPeriod

public bool IsLastTradingDateInPeriod(DateTime dt, Frequency scale)

Returns true if dt is the last trading date in the period specified by scale. This method accounts for the market's trading days and holidays when determining the next trading date. It supports weekly, monthly, quarterly, and yearly periods.

IsOpenLocalTime

public bool IsOpenLocalTime(DateTime dt)

Returns true if the market is open at the specified DateTime, interpreted in the computer's local time zone.

IsOpenMarketTime

public bool IsOpenMarketTime(DateTime dt)

Returns true if the market is open at the specified DateTime, interpreted in the market's BaseTimeZone. The method accounts for trading days, holidays, markets that are always open, and markets whose sessions trade through midnight.

IsOpenNow

public bool IsOpenNow

Uses the current system time, the market's BaseTimeZone, trading days, holidays, and market hours to determine whether the market is currently open.

IsPostMarket

public bool IsPostMarket

Returns true if the current time is after the market's regular trading session on an active trading day. Markets whose sessions trade through midnight are handled appropriately.

IsPreMarket

public bool IsPreMarket

Returns true if the current time is before the market's regular trading session on an active trading day. For markets that trade through midnight, this represents the gap between the previous session close and the next session open.

IsPrePostMarketTime

public bool IsPrePostMarketTime(DateTime dt, HistoryScale scale)

Returns true if the specified DateTime falls outside the market's regular trading session for the specified HistoryScale.

IsReadOnly

public bool IsReadOnly

Returns true if this MarketDetails instance cannot be edited by the user. This is the inverse of CanEdit.

IsTradingDay

public bool IsTradingDay(DateTime dt)

Returns true if the specified date is an active trading day based on the market's TradingDaysOfWeek and HolidayDates.

IsTradingDayLocalTime

public bool IsTradingDayLocalTime(DateTime dt)

Returns true if the specified local DateTime corresponds to an active trading day in the market. The DateTime is converted to the market's BaseTimeZone before the trading day is determined.

IsTradingDayMarketTime

public bool IsTradingDayMarketTime(DateTime dt)

Returns true if the specified DateTime, interpreted in the market's BaseTimeZone, is an active trading day.

MappedSymbols

public List<string> MappedSymbols

Returns a List containing the symbols currently defined in the market's SecurityNameMapping.

Name

public string Name

Contains the descriptive name of the market.

NowMarketTime

public DateTime NowMarketTime

Returns the current time expressed in the market's BaseTimeZone.

Offset

public TimeSpan Offset

Returns the current time offset between the computer's local time zone and the market's BaseTimeZone.

OffsetUTC

public TimeSpan OffsetUTC

Returns the current time offset between UTC and the market's BaseTimeZone.

QuantityDecimals

public int QuantityDecimals

Contains the number of decimal places permitted when calculating share or contract quantities for positions in the market. The default value is zero.

SecurityNameMapping

public Dictionary<string, string> SecurityNameMapping

A Dictionary that maps symbols to their corresponding security names. Data Provider creators can populate this Dictionary so that WL9 can assign security names when historical data is loaded.

SecurityType

public SecurityType SecurityType

Contains the default SecurityType for symbols in the market. The default value is SecurityType.Stock.

Source

public string Source

Contains information identifying the source of the MarketDetails instance.

SpecifyMarketHours

public void SpecifyMarketHours(int dayOfWeek, TimeSpan mktOpen, TimeSpan mktClose)

Specifies the market opening and closing times for a particular day of the week. Pass -1 in dayOfWeek to specify the default hours used for days that do not have their own specific hours.

TimeTilClose

public TimeSpan TimeTilClose

Returns the amount of time remaining until the market closes. If the market is not currently open, returns a zero TimeSpan.

TimeTilOpen

public TimeSpan TimeTilOpen

Returns the amount of time remaining until the market opens when the market is currently in its pre-market period. Otherwise, returns a zero TimeSpan.

TimeZoneInfo

public TimeZoneInfo TimeZoneInfo

Returns the System.TimeZoneInfo instance corresponding to the market's BaseTimeZone.

TradeOnAllDays

public void TradeOnAllDays(bool includeSaturday = true)

Configures the market to trade every day of the week. If includeSaturday is false, Saturday is omitted, resulting in a Sunday-through-Friday trading week.

TradeOnWeekdays

public void TradeOnWeekdays()

Configures the market to trade Monday through Friday.

TradeOnWeekdaysAndSunday

public void TradeOnWeekdaysAndSunday()

Configures the market to trade Sunday through Friday, excluding Saturday.

TradingDaysOfWeek

public List<DayOfWeek> TradingDaysOfWeek

Contains the DayOfWeek values representing the days of the week on which the market trades.

TradingDaysOfWeekString

public string TradingDaysOfWeekString

Returns a compact string representation of the market's trading days. Common values include "All", "Weekdays", and "Sun+Weekdays". Other combinations are represented using abbreviated day names.

WeeklyHours

public MarketWeeklyHours WeeklyHours

Contains the MarketWeeklyHours instance that defines the market's normal trading hours for each day of the week.

Need help with this API?

Ask the community or explore custom development services.