时间:2019-03-17 标签:c#webbrowser|推送实时行情

发布于 2024-08-27 15:38:17 字数 710 浏览 5 评论 0 原文

我是程序员和股票交易员。

之前
我写了一个日间交易应用程序。直到上周,还可以从 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#?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

錯遇了你 2024-09-03 15:38:17

您可以直接通过 Web 浏览器控件访问 DOM - 例如,要单击按钮,您可以使用以下命令(其中浏览器控件称为 _browser):

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

然后您可以每隔一段时间访问 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):

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文