Parent: Object
The MarketDetails class contains information about a market, such as the US Stock Market, or the Cryptocurrency markets. Historical Data Providers in WealthLab can create MarketDetails instances and assign them to symbols, or you can make such assignments yourself using the Markets & Symbols tool.
Contains the time zone that the market trades in. The string is compatible with Windows time zone ID values.
Contains a suggested symbol to use as a benchmark for backtest comparisons. For example, the US Stocks MarketDetails uses SPY, while the CryptoCurrencies MarketDetails uses BTC.USD.
Contains the number of decimal places to use when displaying price data for the market.
Returns the market hours in the market's time zone for the specified date (dt parameter) in the local time zone, as an instance of the MarketHours class.
Returns the market hours in the market's time zone for the specified date (dt parameter), as an instance of the MarketHours class.
Returns the security name of the specified symbol, if available.
A list of dates that represent market holidays where the market would normally be open but is closed.
using WealthLab.Backtest; using System; using WealthLab.Core; using System.Collections.Generic; namespace WealthScript { public class MyStrategy : UserStrategyBase { List<DateTime> _holidays; public override void Initialize(BarHistory bars) { _holidays = bars.Market.HolidayDates; //print the list of holidays for the bars' market foreach (DateTime holiday in _holidays) { WriteToDebugLog(holiday.ToShortDateString()); } } public override void Execute(BarHistory bars, int idx) { } } }
Uses the current system time and time zone, the BaseTimeZone of the market, and the market's GetHours method to determine if the market is currently open or closed.
Uses the current system time and time zone, the BaseTimeZone of the market, and the market's GetHours method to determine if the current time is considered "post-market close".
Uses the current system time and time zone, the BaseTimeZone of the market, and the market's GetHours method to determine if the current time is considered "pre-market open".
Returns true if the specified date (dt parameter) is an active trading day in this market.
Contains the name of the market.
Contains the number of decimal places to use when calculating the number of shares or contracts to use for a position in the market.
A List that contains DayOfWeek enumerated values that represent the days of the week that this market is open for trading.
Creates a new MarketDetails instance that copies all of the properties of this market.
Custom data providers that are creating MarketDetail instances can use this method to specify market open and close times for a specific day of the week. To specify the default market hours, they should call this method passing -1 as the dayOfWeek parameter. Every MarketDetails should have a default market hours (-1 value) defined in this way.
A Dictionary that data provider creators can use to map symbols to their corresponding security names. WealthLab will check this Dictionary at the time data is loaded to see if a security name is available, and if so will assign it to the SecurityName property of the resulting BarHistory instance.
Data Provider creators can call this method to indicate that the market trades on all days of the week. It populates the TradingDaysOfWeek property list with all 7 days of the week.
Data Provider creators can call this method to indicate that the market trades on weekdays. It populates the TradingDaysOfWeek property list with the values Monday through Friday.