Syntax
public MorningstarSymbolData
public static MorningstarSymbolData MorningstarSymbolDataExtractor.GetSymbolData(string symbol)
Parameter Description
symbol | Any stock symbol valid on Morningstar website |
Description
Morningstar is a well-known investment resource. Methods of the
MorningstarSymbolDataExtractor class return some helpful snapshot data for U.S./international stock symbols: sector, industry, business description, NAICS/SIC/ISIC codes, stock type and style.
- GetSymbolData returns an instance of MorningstarSymbolData class populated with eight string variables: Sector, Industry, Description, NAICS, SIC, ISIC, StockType, StockStyle.
Example
Here's an illustration of working with Morningstar data in a Wealth-Lab strategy. It caches data requests to avoid repeated re-requests that slows script execution down:
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Components;
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
protected override void Execute()
{
string symbol = Bars.Symbol;
string key = string.Format("msd {0}", symbol);
if (GetGlobal(key) == null)
{
var msd = MorningstarSymbolDataExtractor.GetSymbolData(symbol);
SetGlobal(key, (object)msd);
Test(symbol, msd);
}
else
{
var msd = GetGlobal(key);
Test(symbol, msd as MorningstarSymbolData);
}
}
void Test(string symbol, MorningstarSymbolData msd)
{
ClearDebug();
PrintDebug("Stock: " + symbol + "\r");
PrintDebug("Sector: " + "\t" + msd.Sector);
PrintDebug("Industry: " + "\t" + msd.Industry);
PrintDebug("Description: " + "\t" + msd.Description);
PrintDebug("NAICS: " + "\t" + msd.NAICS);
PrintDebug("SIC: " + "\t" + msd.SIC);
PrintDebug("ISIC: " + "\t" + msd.ISIC);
PrintDebug("Stock type: " + "\t" + msd.StockType);
PrintDebug("Stock style: " + "\t" + msd.StockStyle);
}
}
}