Adding/Removing symbols from Data Manager
Author: gwrowe
Creation Date: 12/26/2008 3:21 PM
profile picture

gwrowe

#1
Is there any command that allows adding or removing symbols from a Data Manager dataset from within a strategy script?
profile picture

Eugene

#2
Short answer: No. What's the point in doing that?

Detailed answer: Yes, but it's undocumented (read: unsupported), for example --

CODE:
Please log in to see this code.


Note that not every data provider supports this (some do and some do not) -- sdp.CanModifySymbols
Methods like this are intended to be used in data provider libraries.
profile picture

Eugene

#3
Another possible way (unsupported, of course):

CODE:
Please log in to see this code.


One drawback is that the change will be visible only when you restart Wealth-Lab.
profile picture

gwrowe

#4
Eugene
Thanks for the help! The reason that I want to be able to add/subtract symbols from a Data Manager dataset is that prior to running my strategy on a dataset of potential stocks I optimize the strategy each time for each symbol. Because I do this, it is possible that the strategy will give me a sell signal when I don't actually own the stock. By having a dataset that contains only the stocks that I own, I invoke my sell strategy only on the dataset that contains those stocks that I own and I will will not send a sell signal in Auto-Trading for a stock that I don't own. I then invoke my buy strategy on a larger group of stocks contained in a separate dataset. My problem goes away if Fidelity Wealth-Lab Pro 5.1 is smart enough to NOT send a sell order for a stock that I don't own. I'll check with Fidelity next week to determine what would happen if I do send a sell order to Fidelity if I don't own the stock. Thanks again for your assistance.
profile picture

Cone

#5
<< My problem goes away if Fidelity Wealth-Lab Pro 5.1 is smart enough to NOT send a sell order for a stock that I don't own. >>

5.3 will be smart enough for that, but it's not a problem for 5.1 either - the order will simply error out.
profile picture

gwrowe

#6
This solves one of my problems but not all. Since I want to run the sell strategy on only the stocks that I own, I need to either (1) add/remove symbols to a Dataset from within my strategy script, (2)link a Dataset to my account information, or (3)invoke my strategy on an acount directly. Any suggestions?
profile picture

Eugene

#7
QUOTE:
(3)invoke my strategy on an acount directly. Any suggestions?


"(3)invoke my strategy on an acount directly.":

Select one or more strategies... dialog -- Set Account...
profile picture

gwrowe

#8
Setting the Account in dialog does not appear to fix my problem. The strategy is still invoked on a DataSet rather than on the actual positions that I have in my account. I would like to somehow create a DataSet that automatically updates whenever I purchase/sell a position.
profile picture

Cone

#9
Set Account determines the account to which Strategies send their Alerts. If you don't assign an account, the default account is used (Preferences (F12) > Trading).

QUOTE:
I would like to somehow create a DataSet that automatically updates whenever I purchase/sell a position
There is no feature that provides feedback to a Strategy of account holdings. Fidelity customers should call their Fidelity reps to request features that they need.

Nonetheless as I mentioned before, Version 5.3 should suffice in giving you the results that you're looking for. You need only to run the Strategy on your overall DataSet (WatchList); exit Alerts that don't match Positions in your account will not be automatically Staged or Placed (this is the new "Portfolio Synch" feature). You can still manually Stage or Place these Alerts, but placing an exit order that doesn't correspond to an account Position will error out, like in 5.1.

Barring unforeseen obstacles, 5.3 should be out before the end of Jan 09.
profile picture

sedelstein

#10
Hello Eugene

Thanks for directing me here. What I'd like to do programatically is access a particular ds, remove all it's symbols which I gather I can do by
CODE:
Please log in to see this code.

and then add new symbols via
CODE:
Please log in to see this code.


I know I'm being a bit dumb but how do get access to a particular ds other than by looping and testing for a match via
CODE:
Please log in to see this code.
,


p.s.

Interesting, I just tried
CODE:
Please log in to see this code.


with a test dataset called to_delete and it only deleted 3 of the 5 symbols in there.
profile picture

Eugene

#11
To add/remove in one shot, better use ModifySymbols (see other thread I gave earlier today).

As I've been stressing, all this stuff is unsupported. You experiment with it on your own. But I can assure that all the example code (created by Cone and I) that you can find on the forums, works correctly. Keep in mind that any programmatic changes made to DataSets will apply only after WLP is restarted.