Norgate Data Norgate Data
 

Wealth-Lab 8 Norgate Data Extension Usage

The following instructions are for Wealth-Lab 8. To view the instructions for Wealth-Lab 6.9 go here.

DataSets

Wealth-Lab strategies are performed against DataSets which directly reference Norgate Data's watchlists. Watchlists can be created and managed in NDU.

There are two types of Data Sets presented by the Norgate Data extension: Norgate Data - Current & Past - These DataSets contain the suvivorship bias-free set of constituents and index membership is automatically handled by Wealth-Lab's portfolio backtest.

Show illustration on Current & Past DataSets.

Norgate Data - These DataSets contain any watchlist that is not tagged by Norgate as a "Current and Past" watchlist. If you wish to incorporate your own suvivorship bias-free capabilities into Strategies that use this DataSet, you must code this directly into the Strategy.

Indicators, Dividends and Security Information

Making use of Historical Index Constituents

Backtesting against Historical index constituents can be achieved in two ways:

1. Use a DataSet from the Norgate Data - Current & Past DataSet. Wealth-Lab will only open a position when a stock is within the index on the date of entry; or

2. Use the Indicator "IndexConstituentTimeSeries" within your code as follows:

Add the following to the top of your code:

			using WealthLab.Norgate;
			

Within your strategy class, add a declaration for the IndexConstituentTimeSeries class:

			IndexConstituentTimeSeries  indexConstituent;

In the Initialize method of your stragegy, add:

			indexConstituent = new IndexConstituentTimeSeries(bars, "$SPX");

Either the index name (eg. "S&P 500") or the index symbol ("$SPX") can be specified. Details of the Historical Index Constituent coverage can be found in the Data Content Tables.

In the part of Execute() where you analyze conditions to enter a position, you can check to see whether the stock was in the index on the current bar, by incorporating a very simple condition into your buy signal:

	&& indexConstituent[idx] == 1

Note 1: The function does not return dates. Instead, it returns true or false (1 or 0) for index membership for any date.
Note 2: You will need either a Platinum or Diamond level subscription to access historical index constituent information. At Silver or Gold level, the function will always return 0.

Determining when a US stock was listed on a major exchange

Some US stocks have had periods where they were not listed on a major exchange and only tradeable as OTC/Pink Sheet stocks.

In backtesting, you can elect to only trigger a trade if the stock was listed on a major exchange (NYSE, Nasdaq, NYSE American, NYSE Arca, Cboe BZX, IEX) on the signal date by using the class MajorExchangeListedTimeSeries as follows:

Add the following to the top of your code:

			using WealthLab.Norgate;
			

Within your strategy class, add a declaration for the MajorExchangeListedTimeSeries class:

			MajorExchangeListedTimeSeries  majorExchangeListed;

In the Initialize method of your stragegy, add:

			majorExchangeListed = new MajorExchangeListedTimeSeries(bars);

In the part of Execute() where you analyze conditions to enter a position, you can check to see whether the stock was major exchange listed on the current bar, by incorporating a very simple condition into your buy signal:

	&& majorExchangeListed[idx] == 1

Note 1: The function does not return dates. Instead, it returns true or false (1 or 0) for major exchange listing for any date.
Note 2: You will need either a Platinum or Diamond level subscription to access major exchange listing information. At Silver or Gold level, the function will always return 0.

Determining when a US stock was a Blank Check Company/SPAC

Some US stocks have had periods where they were designated as Blank Check Companies - this includes SPACS (Special Purpose Acquisition Companies).

In backtesting, you can elect to only trigger a trade if the stock was not a blank check company on the signal date by using the class BlankCheckCompanyTimeSeries as follows:

Add the following to the top of your code:

			using WealthLab.Norgate;
			

Within your strategy class, add a declaration for the BlankCheckCompanyTimeSeries class:

			BlankCheckCompanyTimeSeries  blankCheckCompany;

In the Initialize method of your stragegy, add:

			blankCheckCompany = new BlankCheckCompanyTimeSeries(bars);

In the part of Execute() where you analyze conditions to enter a position, you can ignore a stock that was a blank check company on the current bar, by incorporating a very simple condition into your buy signal:

	&& blankCheckCompany[idx] == 0

Note 1: The function does not return dates. Instead, it returns true or false (1 or 0) to designate the Blank Check Company status.
Note 2: You will need either a Platinum or Diamond level subscription to access major exchange listing information. At Silver or Gold level, the function will always return 0.

Here is an example of how you could filter out Blank Check Companies; as well as any stocks that were formerly Blank Check Companies which haven't completed a "seasoning" period of 6-months (125 trading days). Just add the following in the Execute() part of your Strategy:

			const int seasoningBarsRequired = 125;
			bool nonBlankCheckCompanyOrSeasoned = blankCheckCompany[idx] == 0 &&
				blankCheckCompany.GetHighest(idx, seasoningBarsRequired) == 0;
				
			// Then simply add 
			// && nonBlankCheckCompanyOrSeasoned 
			// to your buy condition code			
			

Referencing Distributions/Dividends

In your "Price & Volume Adjustment" settings, you can remove the effect of any distributions/dividends received by adjusting the price and volume on a proportional basis. This methodology simulates re-investing the dividend on the day prior to the ex-date and mirrors the methodology used in Total Return indices. To change this setting, click Data Manager, select the Norgate Data tab and select "Capital reconstructions, special distributions and ordinary cash dividends" as shown below:

However, if you would prefer to track the dividends separately instead, you should use a price adjustment method that does not include the dividends you wish to track (e.g. if you want to track ordinary dividends only, then set your adjustment method to "Capital reconstructions and special dstributions"), and use the WealthLab.Norgate.Dividend indicator within your code.

Referencing Security Information

The following Symbol properties are built into Wealth-Lab and automatically populated by the Norgate Data Extension, and can be queried within your code using:

Bars.SymbolInfo.<property>
PropertyC# TypeDescription
SecurityType
SecurityType enumType of Security (Stock, Future)
PointValue
DoubleThe point value represents how much profit is gained when a single futures contract moves up one full point.
Tick
DoubleThe mininum tick increment for a futures contract
Margin
DoubleFor futures, the initial margin required to open a position of 1 contract.

Additional Metadata for each security is availble, using methods provided inside the static class WealthLab.Norgate.Metadata, including:

The following Security Information methods are available for querying:

MethodC# TypeDescription
SecondLastQuotedDate
DateTimeSecond last bar of trading for any delisted/expired security
For example usage see Note (1)
LastQuotedDate
DateTimeLast bar of trading for any delisted/expired security
BusinessSummary
StringSummary of the company's operations
BusinessSummaryLastUpdate
StringDate when the Business Summary was last updated
FinancialSummary
StringSummary of the company's most recent reported financials
WebSite
StringWeb site of company
Domicile
StringCountry of Domicile
AssetId
IntegerUnique identifier of securities
Classification
StringReturns the classification for the given classification scheme
ClassificationAtLevel
StringReturns the classification and level for the given classification scheme
ClassificationName
StringReturns the classification name for the given classification scheme
ClassificationNameAtLevel
StringReturns the classification name and level for the given classification scheme
ClassificationDescription
StringReturns the detailed description of the classification, given a classification scheme
ClassificationDescriptionAtLevel
StringReturns the detailed description and level of the classification, given a classification scheme
CorrespondingIndustryIndex
StringReturns the symbol for the industry index applicable to the given security
For example usage see Note (2)
SharesOutstanding
DoubleReturns the current number of shares outstanding
SharesFloat
DoubleReturns the current number of shares available to trade as free float
Exchange
StringReturns the exchange name of the security
Currency
StringReturns the trading currency of the security
BaseType
StringReturns the base type of the security
Subtype1
StringReturns the sub type 1 of the security
Subtype2
StringReturns the sub type 2 of the security
Subtype3
StringReturns the sub type 3 of the security
LowestEverTickSize
DoubleReturns the lowest ever tick size for a futures contract

Notes:

(1) To obtain the SecondLastQuotedDate, you would use the following:
	var slqd = Metadata.SecondLastQuotedDate(Bars.Symbol);

Supported classification schemes include ThomsonReutersBusinessClassification, GICS, NorgateDataFuturesClassification and NorgateDataCashCommoditiesClassification.


(2) To retrieve the industry index symbol for the current security (for instance, to compare the current stock against its applicable industry index), you can use the CurrentIndustryIndexSymbol method as follows:

	var indexsymbol = Metadata.CorrespondingIndustryIndex(Bars.Symbol," < index family > ", < level > ,"< index type >");
where: For example, to determine the S&P 1500 Level 4 (Sub-Industry) price return index applicable to the current symbol, you would use:
	var indexsymbol = Metadata.CorrespondingIndustryIndex(Bars.Symbol,"$SP1500",4,"PR");

If the current symbol has no applicable classification or there is no industry index present at the given level, then indexsymbol in the example above will be empty.

Referencing Fundamental Data

In addition to using the Event Provider within Wealth-Lab, fundamental data provided by Norgate can be referenced using the GetFundamentalItem from Wealth-Lab strategies. For example, to retrieve the current fundamental value, use the following code within your Initialize method:

	
    var field = "ttmepsxclx";
    var fundamentalItem = Metadata.GetFundamentalItem(bars.Symbol, field); 
	

Further information on the fundamental fields are shown here.

Referencing the Original Unadjusted Close

If your trading system needs to reference the original unadjusted closing price of a security, you can use the following -

Add the following to the top of your code:

			using WealthLab.Norgate;
			

Within your strategy class, add a declaration for the IndexConstituentTimeSeries class:

			OriginalCloseTimeSeries  originalClose;

In the Initialize method of your stragegy, add:

			originalClose = new OriginalCloseTimeSeries(bars);
	var originalClose = OriginalCloseTimeSeries.Series(Bars);

Then within your code, you can reference the current bar's original close with:

	originalClose[idx] 
For example, you could add a condition into your buy formula to only trade stocks that close above $2 with:
	&& originalClose[idx] > 2

Additional Time Series functions provided

DividendTimeSeries, TurnoverTimeSeries, OpenInterestTimeSeies, DividendYieldTimeSeries are also provided, and can be called in the same manner as OriginalCloseTimeSeries.

Next page: Wealth-Lab FAQ