Stock quote question

henryvii99

New Member
Joined
Apr 22, 2011
Messages
32
Hello everyone,

I am trying to learn VB for stock quoting.

I want to quote the index from this site.

https://www.etnet.com.hk/www/eng/stocks/realtime/quote.php?code=0011

I would like to quote Nominal, High, Low and Turnover values in the blue boxes. And P/E ratio in the table. and export it to Excel

I found a thread posted 3 years ago which may be very useful for this purpose. (Thanks Tom Schreiner and everyone else for their efforts.)

Extracting web data from a sub web page http://excel.bigresource.com/Track/excel-6zCXgwED/

It seems that CNBC got some updates from now and I modified them as far as I can understand. I changed a few lines in class module RTDItem.

==========================================
Private Const UrlPart As String = "http://www.cnbc.com/id/15837290?q="

to

Private Const UrlPart As String = "http://data.cnbc.com/quotes/"
==========================================

Set LastSpan = HTMLDoc.getElementById("WSODQ_" & pSymbol & "_LAST_0_" & pSessionID)

to

Set LastSpan = HTMLDoc.getElementById("WSODQSTREAMOFF_" & pSymbol & "_LAST_0_" & pSessionID)

===========================================

I tried to use the UDF, but Excel hang after I enter the symbol MSFT to the function (as in the original post), any ideas? It seems that the original template Excel files are removed. I cannot find the UDF and Realtime Data Sync Example sheets anywhere in the web.

By the way, I will be very happy if someone can actually quote the numbers from the website for Hong Kong stock market :)

Thanks everyone in advance!!
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
I want to quote the index from this site.

https://www.etnet.com.hk/www/eng/stocks/realtime/quote.php?code=0011

I would like to quote Nominal, High, Low and Turnover values in the blue boxes. And P/E ratio in the table. and export it to Excel
Try a web query.

PS - that old thread is probably specific to getting quotes from cnbc.com. I don't think it would work for your etnet.com.hk without significant investigation and debugging, unless etnet.com.hk uses cnbc.com to get the underlying data.
 
Upvote 0
Thanks for the reply.

But the problem is that www.etnet.com.hk blocks me from extracting data by Excel web query. In the way very similar to CNBC.

The banner on the top belongs to other frame, and the table below is hosted elsewhere. In that old thread they extracted data by the getElementById trick from the webpage, along with extensive quality checks.

So if I can the old thread work on CNBC and modify it, or I write a completely new one to quote data on the stock site, probably I can get what I wanted.

In fact there are 3 sites that have the real time data I needed. They are:

http://www.etnet.com.hk/www/eng/stocks/realtime/quote.php?code=0011
http://money18.on.cc/eng/info/liveinfo_quote.html?symbol=00011
http://www.aastocks.com/en/ltp/rtquote.aspx?symbol=00011

All of them prevents simple excel web query, but I think some website may be easier to quote the data by macros. Getting the info from either one site is sufficient. Thanks for your help!
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top