Simplification of TradingDaysRemaining function
Author: Sammy_G
Creation Date: 10/27/2010 9:58 AM
profile picture

Sammy_G

#1
I am translating some WL4 code. This is one of the sections inside a class of Date fnxns:
CODE:
Please log in to see this code.

It seems to me the code could be simplified e.g. the while() code block is repetitive and perhaps could be invoked just once? But I am not able to figure out how.
profile picture

Eugene

#2
profile picture

Cone

#3
You're encouraged to use the Community.Component's method, and you can see the open source code there, but the method was posted in this discussion.
profile picture

Sammy_G

#4
Maybe I am dense b/c I still couldn't figure out how to condense the repeating code.

Perhaps I should restate my Q:
Inside a switch/case routine, how does one re-use a code block w/o typing the whole thing every time? [If I had 20 cases, I would be repeating the code 20 times; surely there's a more elegant way.]
profile picture

Eugene

#5
By extracting the code block into a new function?
profile picture

Sammy_G

#6
Ok, will try it out.

Re: MarketInfo property, would you happen to know if this will, like fundamental data, have info going back approx 6yrs (+ some future years), or will it be now be cumulative going forward (currently, info is from Jan 2004 onward)?
profile picture

Cone

#7
The Holiday and special hours data come from the ..\Data\Markets.xml file, which hasn't been updated for more than a year. I'd like Fidelity to backfill the U.S. Holidays to at least 1991 (the start of Fidelity EOD backfill). Hopefully this will get done for the next release. Nonetheless, you can edit that file yourself and put anything you want in it. I did.
profile picture

Eugene

#8
fyi, they have a helpful Holiday web service that returns a XML that can be cached:

GetHolidaysForDateRange @ holidaywebservice.com
profile picture

Sammy_G

#9
Cone,
While waiting for Fidelity, can you look into making an updated Markets.xml file available for download through, say, the Extension Manager? Alternately, perhaps a "Holiday update" page can be created, like you have the Watchlist update page, that you/Eugene/users can update as needed and folks can then update their Markets.xml file manually that way? I would imagine that updates would be needed very infrequently.

I must say that I have become a fan of MarketsInfo property since I became aware of it just a few days ago.

Lastly, I have more or less finished translating some Date functions from WL4 to WL.NET and I will be submitting them shortly for review; it would be great if users start off with an updated Markets.xml file.
profile picture

Eugene

#10
QUOTE:
can you look into making an updated Markets.xml file available for download through, say, the Extension Manager?

Just FYI: not through the Extension Manager because this XML file is not an Extension.
QUOTE:
folks can then update their Markets.xml file manually that way?

Folks will be able to update Markets.xml through a convenient and otherwise helpful tool called the Market Manager which is still unreleased, unfortunately.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).