Newbie needs guidance on the next step past GUI--Importing Stock Data into App
I'm taking a VB class for financial analysts, and we're tasked with constructing a progrm we can use on the job. What I'm trying to do is build a VB program that will take Stock and Company information from certain sites on the Internet and extracting that information into the program to do some research on a company before investing. I have some grand plans, but based upon what I have read/heard on this forum I'm taking stock information from two websites (Yahoo Finance and Reuters) and populate several different tabs in this program I'm making (exporting to an Access database and Excel are also in the works, but I think I can figure that out).
I built the GUI with 4 different tabs that will house Earnings data, Trading Information, Company News, and Insider information that can be pulled from these two sites. I've attached the GUI to help give the flavor for what I'm trying to do. Here's an example of the sites I'm looking to grab data from (using COH as an example):
I found a nifty little app that converts websites to DHTML and saves it on your PC in txt format, so I have decoded at least to that point.
So here's my question. I know the basics of looping, arrays, procedures and functions, but I don't know where to begin on how to import web data into my little text boxes. It would seem like there's lots of different ways to do it, but I'm just looking for a gentle nudge in the right direction on the process by which I would go about doing this. Could somebody outline this for me? I'd really appreciate any guidance that could be provided.
Re: Newbie needs guidance on the next step past GUI--Importing Stock Data into App
I am now developing a project in which I have to retrieve the EUR-USD ratio from the internet. I download the file from internet and then read it to update the EURUSD. I think you'll find the idea quite useful for your project:
VB Code:
'Lee el cambio euro-dolar desde internet - Gets EURUSD from Internet
If My.Computer.Network.IsAvailable Then
Try
' Descarga fichero de internet - Downloads the file
Re: Newbie needs guidance on the next step past GUI--Importing Stock Data into App
Making progress here with Yahoo taking a different path, but uncertain how to code this next part. I have the first part of the app working now, it's actually pulling data from Yahoo Finance! Pretty cool stuff...makes me think this project is actually doable! But here's where I need help...
My GetHTML function is declared like this:
VB Code:
Public Function GetPageHTML(ByVal URL As String) As String
' Retrieves the HTML from the specified URL
Dim objWC As New System.Net.WebClient()
Return New System.Text.UTF8Encoding().GetString(objWC.DownloadData(URL))
End Function
Then I go to the website and download the information from Yahoo Finance like this:
VB Code:
Private Sub btnRefresh1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh1.Click
The above example has the stock symbol hard-wire into it (in this case "COH"). I'd like for it to take the symbol out of a box I have labeled "txtSymbol.text" and put it in where COH is currently located at. I'd also like to change the parameters at the end (in the above example this would be "nl1va2c1"). The parameters reference particular fields on the Yahoo pages that would correspond to things like price, volume, etc. The whole list can be found here
So I would have basically a function to call upon with the standard "http://quote.yahoo.com/d/quotes.csv?s=" Then have the txtSymbol.text stock symbol inserted (which will change with each stock I analyze, grabbed from the text box), and then another function to call the parameters at the end (in this case nl1va2c1). Maybe some sort of concatenate function? How would I go about coding this correctly?