我是程序员和股票交易员。
之前
我写了一个日间交易应用程序。直到上周,还可以从 http://aktien.boerse.de/aktien_startseite.php?view=2&order=name%20asc&liste=prime&page=0 。每次浏览该网站时,报价都会发生变化。然后可以使用正则表达式 (regex) 对 HTML 内容进行解码。
问题
他们今天已经停止了这项服务。现在,在页面上冲浪时,报价不是实时的。现在获取股票报价的唯一方法是使用推送报价“Push starten”按钮。
但是我不知道如何在 C# 中基本上获取它们。
当我创建一个 webbrowser 元素时,我知道从中获取推送引号的唯一方法是为 webbrowser 元素提供焦点发送键 ctrl+A 和 ctrl+C 并将数据插入某个位置进行解码。这是不希望的,因为控件已远离用户,并且如果在此过程中单击其他控件,这可能会导致意外的行为。
问题
那么在 C# 中是否有正确的方法来解码推送股票报价?
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 desired 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#?
发布评论
评论(1)
您可以直接通过 Web 浏览器控件访问 DOM - 例如,要单击按钮,您可以使用以下命令(其中浏览器控件称为 _browser):
然后您可以每隔一段时间访问 broser DOM(使用
_browser.Document
)并使用正则表达式进行解析,就像以前一样。更简洁的方法可能是使用 XPath 提取表格和个股报价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):
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