I am curious if anybody has figured out a way to show company name, industry group, and exchange info on the chart. I am using ASCII historical data provider to get data from Norgate (have to export to ASCII from Norgate Data Downloader as there is no data provider extension for WL7 yet). I think the simplest way I can think of is to read the company name etc data from a txt file in the script and show using DrawHeaderText(). Is there any better way than this brute force approach?
Rename
We have a SymbolMetadataExtractor class that works like this. It's an undocumented method of the WealthLab.Data namespace which can nonetheless be relied on.
The SymbolMetadata class that is returned by the GetMetadataForSymbol method contains an object with the following string properties (currently): Sector, Industry, Description, Exchange, and Float.
The SymbolMetadata class that is returned by the GetMetadataForSymbol method contains an object with the following string properties (currently): Sector, Industry, Description, Exchange, and Float.
CODE:
using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Data; using System.Reflection; using System.Drawing; namespace WealthScript2 { public class MyStrategy : UserStrategyBase { public override void Initialize(BarHistory bars) { var m = SymbolMetadataExtractor.GetMetadataForSymbol(bars.Symbol); foreach (PropertyInfo p in m.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) { DrawHeaderText(p.GetValue(m, null).ToString(), Color.Green, 12); } } public override void Execute(BarHistory bars, int idx) { } } }
Thank you @Eugene!
Worked like a charm! Very handy!
What is the source of this data and what is the symbol set for which this data is available?
Worked like a charm! Very handy!
What is the source of this data and what is the symbol set for which this data is available?
You're welcome. Multiple sources are currently powering this undocumented method. And they may break from time to time (it did happen).
QUOTE:
the GetMetadataForSymbol method contains an object with ... Sector, Industry, Description, Exchange, and Float.
And what is "Float"?
Is this metadata disk cached locally or queried each time?
The "ZM" company name is automatically identified on WL6 but not WL7. Why is that? I'm using IQFeed for both WL apps.
Look up Investopedia on what float is.
Metadata isn't cached but you can use SetGlobal/GetGlobal for the purpose.
Identifying the company name depends on historical data provider - some do and some don't.
Metadata isn't cached but you can use SetGlobal/GetGlobal for the purpose.
Identifying the company name depends on historical data provider - some do and some don't.
Note: code above will return -1 since Morningstar stopped returning the float data for stocks.
Your Response
Post
Edit Post
Login is required