I am in a coded Strategy.
I want to know the name of the currently used DataSet.
(i.e. what is entered in Strategy Settings->Portfolio Backtest->Select Backtest DataSet)
How can I find out?
(I want to use this name in logging, reporting, as part of a result filename, etc...)
I want to know the name of the currently used DataSet.
(i.e. what is entered in Strategy Settings->Portfolio Backtest->Select Backtest DataSet)
How can I find out?
(I want to use this name in logging, reporting, as part of a result filename, etc...)
Rename
Couldn't find such property, too. Dion will correct me if I'm wrong.
You’re correct. We already have a feature request to obtain the execution mode, this can be bundled with that eventual feature.
Here's that request just for reference:
https://www.wealth-lab.com/Discussion/Is-there-a-way-to-know-if-strategy-is-running-in-backtest-mode-SM-or-streaming-in-a-chart-6103
https://www.wealth-lab.com/Discussion/Is-there-a-way-to-know-if-strategy-is-running-in-backtest-mode-SM-or-streaming-in-a-chart-6103
I am using the construction
If the feature in this post is implemented, I expect I would be able to dynamically supply the variable "Test" instead of hardcoding it. Sometimes I use the same strategy on different datasets.
While this DataSetFactory.FindDataSet("DS Name); is super useful, I will have to remember to change the "DS Name" in the code to designate a different dataset if I use one.
CODE:
DataSet ds = DataSetFactory.FindDataSet("Test"); foreach (string symb in ds.Symbols) {
If the feature in this post is implemented, I expect I would be able to dynamically supply the variable "Test" instead of hardcoding it. Sometimes I use the same strategy on different datasets.
While this DataSetFactory.FindDataSet("DS Name); is super useful, I will have to remember to change the "DS Name" in the code to designate a different dataset if I use one.
Only 2 votes still and I'm one of them!
Sorry @Cone. Where can I vote on this and other features?
Robert
Robert
@Cone
Aren't those 2 votes on the linked topic for a quite different request (strategy run mode)?
@innertrader
You can vote on this topic (and move it a step closer) since it's marked with #FeatureRequest by upvoting the title post. Currently it has zero votes. For other items in the backlog see the Wishlist - you'll get there with a characteristic button near "Ask a question".
Aren't those 2 votes on the linked topic for a quite different request (strategy run mode)?
@innertrader
You can vote on this topic (and move it a step closer) since it's marked with #FeatureRequest by upvoting the title post. Currently it has zero votes. For other items in the backlog see the Wishlist - you'll get there with a characteristic button near "Ask a question".
It's a bit circular and confusing to me.
@Eugene - in Post #3 of this thread you supplied a link to what you called the #FeatureRequest for this, which out to be Strategy Run Mode. Your post followed @Glitch Post #2 that WL already had a feature request for DataSet Name. The Strategy Run Mode post has a #FeatureRequest tag at the top. I assumed you knew that (technically) the Strategy Run mode incorporated (or could) the DataSet name feature.
At the bottom of the Strategy Run mode post, you link back to this post calling it as a "linked feature request".
This post has tag #WealthLab7 at the top. Is that a feature request tag also, or is #FeeatureRequest missing?
Which of these two posts should I be upvoting for DataSet Name?
Robert
@Eugene - in Post #3 of this thread you supplied a link to what you called the #FeatureRequest for this, which out to be Strategy Run Mode. Your post followed @Glitch Post #2 that WL already had a feature request for DataSet Name. The Strategy Run Mode post has a #FeatureRequest tag at the top. I assumed you knew that (technically) the Strategy Run mode incorporated (or could) the DataSet name feature.
At the bottom of the Strategy Run mode post, you link back to this post calling it as a "linked feature request".
This post has tag #WealthLab7 at the top. Is that a feature request tag also, or is #FeeatureRequest missing?
Which of these two posts should I be upvoting for DataSet Name?
Robert
You're right, this is confusing. Marked this very topic with #FeatureRequest.
Activating this item for Build 14 delivery!
@Glitch - Was this actually implemented? Where can I find documentation? Where is info on new build features?
You can find it documented in the QuickRef, it's a property called ExecutionDataSetName.
Thank you @Glitch.
So how do I get ExecutionDataSetName to reveal the dataset name when you're executing in single-symbol mode?
My stocks are grouped by type with the dataset name revealing that type. And I need to know what that type is in single-symbol mode. This wasn't a problem in WL6.
My stocks are grouped by type with the dataset name revealing that type. And I need to know what that type is in single-symbol mode. This wasn't a problem in WL6.
This is not possible in WL7 ¯\_ (ツ)_/¯
The symbol could be anything you type in. It could be contained in multiple, or no, DataSets.
But if you want to look for a match you could enumerate the DataSets using DataSetFactory and look at each one’s Symbols.
But if you want to look for a match you could enumerate the DataSets using DataSetFactory and look at each one’s Symbols.
Looks like we found something WL6 does better than WL7.
Well, I know the DataSet names I'm trying to avoid. Basically, any DataSet name with "screener" or "ETF" in it because I don't want to query fundamentals for stocks in those. So I need to write a procedure for doing this in WL7. Two questions:
1) Is there a better way to avoid certain stocks than placing them in taboo DataSets?
2) How do a get a listing of all stock symbols in a certain DataSet?
With WL6, this business is a simple DataSetName string test.
And we need a thumbs down arrow. I know, that's a separate "feature" request. :)
QUOTE:
... you could enumerate the DataSets using DataSetFactory and look at each one’s Symbols.
Well, I know the DataSet names I'm trying to avoid. Basically, any DataSet name with "screener" or "ETF" in it because I don't want to query fundamentals for stocks in those. So I need to write a procedure for doing this in WL7. Two questions:
1) Is there a better way to avoid certain stocks than placing them in taboo DataSets?
2) How do a get a listing of all stock symbols in a certain DataSet?
With WL6, this business is a simple DataSetName string test.
QUOTE:
This is not possible in WL7 ¯\_ (ツ)_/¯
And we need a thumbs down arrow. I know, that's a separate "feature" request. :)
QUOTE:
And we need a thumbs down arrow. I know, that's a separate "feature" request. :)
Feel free to submit it. I'm gonna be a devotee of this dislike button! :)
As a team we've decided not to implement "downvote", just a heads up to save you from wasting the effort to submit a request we'll just decline.
You still haven't answered my question about how to return a DataSet name for a symbol that you type in that is not in ANY DataSet, or even in MULTIPLE DataSets? Maybe WL7 is doing things better than WL6 after all here. The fact is when you test using a single symbol, you DON'T HAVE a DataSet specified, so it's behaving correctly.
>>2) How do a get a listing of all stock symbols in a certain DataSet?<<
Use its Symbols property.
You still haven't answered my question about how to return a DataSet name for a symbol that you type in that is not in ANY DataSet, or even in MULTIPLE DataSets? Maybe WL7 is doing things better than WL6 after all here. The fact is when you test using a single symbol, you DON'T HAVE a DataSet specified, so it's behaving correctly.
>>2) How do a get a listing of all stock symbols in a certain DataSet?<<
Use its Symbols property.
QUOTE:
You still haven't answered my question about how to return a DataSet name for a symbol that you type in that is not in ANY DataSet, or even in MULTIPLE DataSets?
Well, the DataSetName query is being processed by a strategy in single-symbol mode, so it's a valid stock. What I want to do is a next-earnings-date lookup for that stock if it's:
1) not an EFT and ...
2) not in one of several screener DataSets.
If it's contained in neither, then I want to do a next-earnings-date lookup. And that's true even if the stock doesn't exists in any DataSet. Bottom line, I want to avoid the earnings lookup if the stock is contained in a taboo DataSet.
I suppose special DataSet state attributes (one for "ETF" and another for "screener") could be created that the strategy could test against. But that's an awkward solution. I'm trying to think of something simple and straightforward for this solution. Any ideas?
It depends on how you have your DataSets organized. If there is just one DataSet of ETFs, for example, you can use DataSetFactory.FindDataSet, then use the DataSet.Symbols property to see if that symbol is in that DataSet.
There are several ETF DataSets and several screener DataSets, and "ETF" or "screener" appears in their dataset name. The procedure I was thinking of writing would grab the contents of all taboo datasets in the constructor of the strategy (storing them in a sorted set that would then be converted to a "taboo" string array), then that sorted string array would be searched as needed.
I find this an awkward solution too. But I'm open to other suggestions.
I find this an awkward solution too. But I'm open to other suggestions.
Maybe create a reusable method like:
to do the heavy lifting for you?
CODE:
public bool IsSymbolInDataSet(string symbol, string dsNameSubstring)
to do the heavy lifting for you?
No, I don't want to test each taboo dataset independently. That's even more awkward. I like my approach above better where I combine all taboo datasets (eliminating duplicates) into one big taboo string array (strategy constructor) and test against that.
But if you can think of a better way, let me know. Could BacktestBegin() sample the "current" DataSet name and set a taboo logical? UPDATE: This doesn't work in single-symbol mode.
But if you can think of a better way, let me know. Could BacktestBegin() sample the "current" DataSet name and set a taboo logical? UPDATE: This doesn't work in single-symbol mode.
It’s already called. And, I’m not sure what you mean by “current” DataSet?
QUOTE:
It’s already called.
I mean I'm doing this batch in the constructor of the strategy, building a taboo string array. Then in Initialize I can test against each stock (using the taboo string array) as the strategy encounters them over the day.
QUOTE:
what you mean by “current” DataSet?
Well, the strategy will be hopping between different datasets over the course of the day. Some will be from ETF datasets, some from screener datasets, and most from none of the above. I just want next earnings dates from the latter (which is most of the datasets). This strategy samples all the datasets.
I implemented my proposed solution with the tabooSymbols array, and it works. The calling sequence is
And the WL utility class (WLUtil.) method being called is
If you can think of a less messy way, let me know. I simply want to exclude some symbols for future earnings date lookups based on the dataset name they reside in.
CODE:
public class MyStrategy : UserStrategyBase { readonly string[] tabooSymbols = WLUtil.ExcludeSymbolsByDataSetName(new String[] { "screener", "ETF" }); public override void Initialize(BarHistory bars) { . . . if (Array.BinarySearch(tabooSymbols, bars.Symbol) < 0) //exec below if not a taboo symbol WLTradingExtras.ShowBarsUntilEarnings(bars,decorrelated,decorrelated.Description,100); }
And the WL utility class (WLUtil.) method being called is
CODE:The binary array search requires a sorted array, but the SortedSet datatype takes care of that. I don't like all the Unions it does, but that happens only in the MyStrategy constructor, so it's not too bad.
public static string[] ExcludeSymbolsByDataSetName(string[] tabooDataSetNameParts) { SortedSet<string> tabooSymbols = new SortedSet<string>(); foreach (DataSet dataSet in WLHost.Instance.DataSets) { foreach (string tabooNameSnippet in tabooDataSetNameParts) { if (dataSet.Name.Contains(tabooNameSnippet)) tabooSymbols.UnionWith(dataSet.Symbols); } } string[] tabooSymbolsArray = new string[tabooSymbols.Count]; tabooSymbols.CopyTo(tabooSymbolsArray); return tabooSymbolsArray; }
If you can think of a less messy way, let me know. I simply want to exclude some symbols for future earnings date lookups based on the dataset name they reside in.
Your Response
Post
Edit Post
Login is required