need some suggestion on a method to use
-
Hi all, I got a txt file filled with HTML code extract from www.finance.yahoo.com this is the data from finance.yahoo.com Dow 10,212.73 +27.20 +0.27% Nasdaq 2,174.00 +2.80 +0.13% 10 Yr Bond(%) 3.6500% -0.0400 Oil 75.25 +0.82 +1.10% Gold 1,113.60 +10.10 +0.91 the 3 values i wanna extract from each stock is all the values above. all the values need to be read from the HTML text file of finance.yahoo.com. so, how should i create the method and what parameter should i pass in? should i create individual method for each stock? example double getDOW(param1, param2, param3, etc) or a generic method that can search any stock quote
-
Hi all, I got a txt file filled with HTML code extract from www.finance.yahoo.com this is the data from finance.yahoo.com Dow 10,212.73 +27.20 +0.27% Nasdaq 2,174.00 +2.80 +0.13% 10 Yr Bond(%) 3.6500% -0.0400 Oil 75.25 +0.82 +1.10% Gold 1,113.60 +10.10 +0.91 the 3 values i wanna extract from each stock is all the values above. all the values need to be read from the HTML text file of finance.yahoo.com. so, how should i create the method and what parameter should i pass in? should i create individual method for each stock? example double getDOW(param1, param2, param3, etc) or a generic method that can search any stock quote
Use
getline
orCStdioFile
to read the file line by line. Then usestrtok_s
orCString::Tokenize
to extract the values from each line.«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
Hi all, I got a txt file filled with HTML code extract from www.finance.yahoo.com this is the data from finance.yahoo.com Dow 10,212.73 +27.20 +0.27% Nasdaq 2,174.00 +2.80 +0.13% 10 Yr Bond(%) 3.6500% -0.0400 Oil 75.25 +0.82 +1.10% Gold 1,113.60 +10.10 +0.91 the 3 values i wanna extract from each stock is all the values above. all the values need to be read from the HTML text file of finance.yahoo.com. so, how should i create the method and what parameter should i pass in? should i create individual method for each stock? example double getDOW(param1, param2, param3, etc) or a generic method that can search any stock quote
You can have one method to read the "raw" data for each data line as long as they follow the same pattern, for example, in your case, it looks like: after that, you have to interpret each data like depending on where it comes from, is it from Dow ? is it from "Oil"? and decide if it's a percentage, a absolute value, a "delta" and put those values in the appropriate fields in your application : if ( == Dow ) { ... } else (if == Nasdaq ) { ... } ... Technically, there must be dozen different ways to do that, but I try to keep it as simple as possible. Good luck with that.
This signature was proudly tested on animals.
-
Hi all, I got a txt file filled with HTML code extract from www.finance.yahoo.com this is the data from finance.yahoo.com Dow 10,212.73 +27.20 +0.27% Nasdaq 2,174.00 +2.80 +0.13% 10 Yr Bond(%) 3.6500% -0.0400 Oil 75.25 +0.82 +1.10% Gold 1,113.60 +10.10 +0.91 the 3 values i wanna extract from each stock is all the values above. all the values need to be read from the HTML text file of finance.yahoo.com. so, how should i create the method and what parameter should i pass in? should i create individual method for each stock? example double getDOW(param1, param2, param3, etc) or a generic method that can search any stock quote
benjamin yap wrote:
all the values need to be read from the HTML text file of finance.yahoo.com.
Use the
IHTMLDocument
interface to navigate the HTML. Did you read this article suggested to you three days ago?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
-
benjamin yap wrote:
all the values need to be read from the HTML text file of finance.yahoo.com.
Use the
IHTMLDocument
interface to navigate the HTML. Did you read this article suggested to you three days ago?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
how do i extract 2,190.06 from here? <span class="streaming-datum" id="yfs_l10_^ixic">2,190.06</span> The ihtmldocument quite complicated to understand
-
how do i extract 2,190.06 from here? <span class="streaming-datum" id="yfs_l10_^ixic">2,190.06</span> The ihtmldocument quite complicated to understand
benjamin yap wrote:
how do i extract 2,190.06 from here?
Look for a
SPAN
element named yfs_l10_^ixic. Then use one of theinnerText
,outerText
,innerHTML
, orouterHTML
properties."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
-
benjamin yap wrote:
how do i extract 2,190.06 from here?
Look for a
SPAN
element named yfs_l10_^ixic. Then use one of theinnerText
,outerText
,innerHTML
, orouterHTML
properties."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
do i have to #include anything to use the innertext, outertext etc etc?
-
do i have to #include anything to use the innertext, outertext etc etc?
They are methods of the
IHTMLElement
interface. You might need to includemshtml.h
."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius