Jumat, 11 Juli 2014

[smf_addin] Digest Number 3116

3 Messages

Digest #3116

Messages

Thu Jul 10, 2014 3:46 am (PDT) . Posted by:

Thanks Randy.. I enjoyed the class.

-----Original Message-----
From: "Randy Harmelink rharmelink@gmail.com [smf_addin]"
Sent: Jul 9, 2014 4:28 PM
To: smf_addin@yahoogroups.com
Subject: Re: [smf_addin] NEWBIE Question



The problem is that the add-in extracts data from the source code
of a web page. That is, what is sent. However, although what you
see displayed in your browser is based on that, it may run
JavaScript in order to grab the data from someplace else to place
into the display. If it does that, the raw data is NOT within the
source code of the web page. So the add-in has nothing to
extract.

It's all about parsing the raw data of the web pages to extract
the data.

In this case:

http://cef.morningstar.com/quote?t=hyf
<http://cef.morningstar.com/quote?t=hyf>

...doesn't really have any data to extract from its source code.
All of those displayed sections on the page are retrieved with
JavaScript from another source, and the web page is built from
that. The add-in doesn't process JavaScript, so that web page
with the retrieved data isn't available to it. However, I can
look at the JavaScript to find out from where the data is being
retrieved, in order to build the displayed page. That where this
comes from:

http://cef.morningstar.com/cef-header?&t=HYF
<http://cef.morningstar.com/cef-header?&t=HYF>

Since that web page DOES have the raw data, the add-in can
extract it from there. But, yes, it's just a data repository.
It's not anything MorningStar displays on any web page of theirs.

Now, on that data repository page above, the source code contains
something that looks like this:

<td class="data_small" id="last-act-nav">2.33</td>

That's where the last-act-nav label comes from. In order to find
the other labels, you'll need to look at the source code of the
web page to see out they have it coded. I typically use either
RCHGetTableCell() or smfGetTagContent() at that point. Note that
the "labels" are just search strings. They don't have to be "id"
fields. They just need to be a set of search strings (up to 4)
that are unique enough to get you to the data you want to
extract. It all depends on how the data provider tends to code
their web pages. The "id" usage is pretty consistent amongst the
MorningStar "static" web pages.

For example, if I wanted to get the "Last Price" from that web
page, I'd look through the source code of the web page and find
something like this:

<div id="lastPrice">2.11</div>

So, to extract that, I would need:

=smfConvertData(smfGetTagContent("http://cef.morningstar.com/cef-\
header?&t=HYF <http://cef.morningstar.com/cef-header?&t=HYF>
","div",-1,"id=""lastPrice"""))

But it does require looking through the source code of the web
page. What you see rendered from the source code is not always
the best way to extract the data.

On Wed, Jul 9, 2014 at 12:04 PM, armando@pipeline.com
<mailto:armando@pipeline.com> [smf_addin]
<smf_addin@yahoogroups.com <mailto:smf_addin@yahoogroups.com> >
wrote:

Hi Randy,
I am confused; perhaps getting more confused.... (smiles)
Let me try to clarify my confusion....
One of your answers to me, you suggested to use the following
command to get the NAV for HYF (a CEF):
=RCHGetTableCell("http://cef.morningstar.com/cef-header?&t=HYF
<http://cef.morningstar.com/cef-header?&t=HYF>
",0,"id=""last-act-nav""")
I noticed in the command above two things:
(1) the ID for the NAV cel for Morningstar CEF URL is
:last-act-nav. Perhaps I am using the wrong terminology. I use
the term "label" for the "last-act-nav". So, when I say the
other labels I mean the ids that identify the other items I am
looking for.
(2) I put the URL above in Internet Explorer and Chrome. Got a
much simpler screen than the regular Morningstar one. That
screen contains all info I needed . I figured that since you
got the label "las-act-nav" for the NAV info from that screen,
you'd know the other labels as well. Hence my question: Where do
I get the labels (IDs) for the other data I want.
I thought that since you know the NAV label, you'd know the other
labels as well..
In short, the GetTableCell you suggested is able to capture NAV
for all CEFs. Shouldn't the same command work for the other
items as well since they are right there on the screen? Dynamic
or not, the data is always there, under the same label
"last-act-nav"? Wouldn't the place you got the ID:last-act-nav
have the IDs for the other items as well?






Thu Jul 10, 2014 10:34 am (PDT) . Posted by:

The following:


=RCHGetYahooQuotes("^DJI", "L1") or =RCHGetYahooQuotes(C29, "l1") where cell C29 contains ^DJI



result in error: "Missing Symbol"


Is there a way to fix this?



Thanks

Armando




Thu Jul 10, 2014 10:46 am (PDT) . Posted by:

"Randy Harmelink" rharmelink

No, sorry. Several years ago, Dow Jones enforced their licensing and
stopped Yahoo from providing any of their indexes pricing data in CSV
files. So none of the Dow Jones indexes data can be retrieved with
RCHGetYahooQuotes() or RCHGetYahooHistory().

On Thu, Jul 10, 2014 at 10:34 AM, armando@pipeline.com [smf_addin] <
smf_addin@yahoogroups.com> wrote:

> The following:
>
> =RCHGetYahooQuotes("^DJI", "L1") or =RCHGetYahooQuotes(C29, "l1") where
> cell C29 contains ^DJI
>
> result in error: "Missing Symbol"
>
> Is there a way to fix this?
>
For the Add-in, Documentation, Templates, Tips and FAQs, visit http://ogres-crypt.com/SMF

Tidak ada komentar:

Posting Komentar