Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #5278
| From | DrMajorBob <btreat1@austin.rr.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: More FinancialData glitches |
| Date | 2011-09-29 06:11 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j6125k$m3d$1@smc.vnet.net> (permalink) |
| References | <201109260813.EAA08560@smc.vnet.net> <j5tk1n$3b6$1@smc.vnet.net> |
Tyler,
Thanks for the info.
I have thought of two ways to guard against times when data disappears.
It would be nice if Yahoo, Xignite, Wolfram, or SOMEBODY would do this at
their end, so that I (and thousands of others) didn't have to deal with it
at ours.
1) I can save a spreadsheet (CSV) from the Yahoo website and import it
when FinancialData fails (for a specific stock symbol). Here is part of
the code for doing that. It could be applied to all symbols, but I've only
applied it to "JNSGX".
(This comes AFTER going to Yahoo and saving the CSV file, but it won't do
anything when FinancialData starts working again for that symbol.)
ClearAll[manual, financialData, price, adjustedData, volatility]
manual[s_] = False;
p = Quiet@FinancialData["JNSGX"];
s = "JNSGX";
manual[s] = List =!= Head@p;
If[manual@s,
import =
Reverse@Rest@Import[s <> ".csv"] /. {dt_String,
other__} :> {DateList[dt][[;; 3]], other};
p = (financialData@s = import[[All, {1, 5}]]);
priceDate[s] = DateString[p[[-1, 1]], {"Month", "/", "Day"}];
volatility@s = 1.;
Scan[(price[s, First@#] = n[2]@Last@#) &, p];
price[s] = price[s, today] = p[[-1, -1]];
adjustedData[s] = import[[All, {1, 7}]];
]
"adjustedData" corresponds to "Close", while "financialData" stores
"RawClose" data. I've found a use for the first, but the second is far
more important. I show "volatility" in one one of my reports, but it's not
a big deal for it to be wrong.
In later code, I use "manual" to see if I need to retrieve data from
FinancialData -- and to report which symbols may not have recent data. I
had recently closed my position in "JNSGX", but some reports need the old
data.
2) I can Put data for a symbol when FinancialData DOES work, and Get it
later when it does not, with similar logic. I may eventually do both --
belt AND suspenders -- but I haven't instituted that level of protection,
as yet.
Bobby
On Wed, 28 Sep 2011 01:45:55 -0500, Tyler <hayes.tyler@gmail.com> wrote:
> I found this, looks like they have a deal with another vendor
> (Xignite) for some information
>
> http://reference.wolfram.com/mathematica/note/FinancialDataSourceInformation.html
>
> For the record, the Financial data functionality is one of my most
> loved (and hated) features. It's one of the best things going compared
> to other environments to have a common interface natural to the
> language to get the data for analysis. Perhaps a wrapper function to
> allow you to specify a secondary source would help alleviate these
> issues? Basically, same function, but with a try/catch in the middle.
> If both bomb, well, a bad day I guess. Nonetheless, this should come
> out of the box in my mind.
>
> Cheers,
>
> t.
>
>
--
DrMajorBob@yahoo.com
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: More FinancialData glitches DrMajorBob <btreat1@austin.rr.com> - 2011-09-27 22:51 +0000 Re: More FinancialData glitches Tyler <hayes.tyler@gmail.com> - 2011-09-28 06:48 +0000 Re: More FinancialData glitches DrMajorBob <btreat1@austin.rr.com> - 2011-09-29 06:11 +0000
csiph-web