开发者

c# webbrowser | pushed realtime quotes

I am programmer and share trader.

Before

I have written a day trading application. Until last week it was possible to fetch realtime quotes from http://aktien.boerse.de/aktien_startseite.php?view=2&order=name%20asc&liste=prime&page=0 . Every time the site was surfed the quotes had changed. The HTML contents could then be decoded with regular expressions (regex).

Problem

They have stopped this service by today. Now the quotes are not realtime when surfing on the page. The only way to get stock quotes now is to use pushed quotes "Push starten"-Button. However I do not know how to basically fetch them in C#. When I create a webbrowser element the only way which I know to get the push quotes out of it is to give the webbrowser element the focus send key ctrl+A and ctrl+C and insert the data some where for decoding. This is not desire开发者_开发问答d since the control is moved away from the user and in case some other control is clicked during the process this may result in unexpected behaviour.

Question

So is there a proper way to decode push stock quotes in C#?


You can access the DOM directly through the web browser control - for example to click the button you can use the following (where the browser control is called _browser):

HtmlDocument doc = _browser.Document;
HtmlElement el;
el = doc.GetElementById(ButtonName);
el.InvokeMember("click");

You can then access the broser DOM at intervals (using _browser.Document) and parse using regular expressions the same way as you were previously. A neater way may be to use XPath to extract the table and individual stock quotes

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜