Yahoo! Data - Change Perform Split Adjustment from inside Strategy?
Author: Panache
Creation Date: 10/5/2015 7:53 AM
profile picture

Panache

#1
Is it possible to change whether or not the Yahoo Split Adjustments and Dividend Adjustments are made from inside a Strategy, ie. is there a command that has the same effect as checking the box in Data Manager? If not, is it possible to check whether or not Perform Split Adjustment and Perform Dividend Adjustment have been selected in Data Manager from within a Strategy?

The reason for my question is that if I am doing my own split and/or dividend adjustments (http://www.wealth-lab.com/Forum/Posts/Yahoo-quot-Perform-Split-Adjustment-quot-to-not-adjust-Volume-37925), I need to make sure I don't have those boxes checked in Data Manager. Yes, I should be smart enough not to do that, but if I forget, I'm going to have really screwed up data.

I'm assuming the answers to both are "no", but I just thought I'd make sure.
profile picture

Eugene

#2
Attempting to change that (and any other) preference of the Yahoo! provider is not a use case and may lead to incorrect or unexpected results i.e. you're on your own without support from us. What you can safely do is to check the state of split/dividend adjustment options. The most straightforward way to do so is by parsing the settings file (XML). To run the enclosed code you have to:

1) Add references to System.Core and System.Xml
2) Click "Other assemblies to reference", click "Add a reference", navigate to C:\Windows\Microsoft.NET\Framework64\v4.0.30319, and pick System.Xml.Linq.dll

The latter assumes you're using 64-bit WLP; pick the "Framework" folder instead if using 32-bit (but what's the point in doing so?) Here you go:

CODE:
Please log in to see this code.


P.S. There are different ways to parse an XML document so using LINQ to XML is certainly not carved in stone.

profile picture

Panache

#3
Excellent! Thank you Eugene. I'll just insert this at the beginning, only run the rest of the code if it is false and generate an error message if it is true.

Also, thank you for the information about how to use LINQ in WealthLab. I was missing the reference when I tried to use it in the past.
profile picture

Panache

#4
I think I just learned something. Checking or unchecking the boxes in Data Manager doesn't have any effect until WealthLab is restarted. Is that correct?
profile picture

Eugene

#5
That's only partially correct.

1. Changes to provider's settings are nicely picked up by Wealth-Lab so you just have to refresh the chart (F5) for them to apply. This is an in-memory operation.

2. Your particular case, however, is an exception. Changes to the XML file may be only flushed after exiting the application. This means that any changes you make during WLP session will not be reflected by your Strategy until WL is closed and reopened.