在 C#/Java 中获取实时市场/股票报价
我想制作一个程序,就像股票的大过滤器一样。为此,我需要获得市场的实时(或延迟)报价。我开始通过从 yahoo 请求页面,根据并将 html 解析为股票行情,然后解析 html 来获取股票报价。我想知道如何执行此请求和解析 html。有什么方法可以让我只请求股票报价及其信息吗?我知道有些应用程序会这样做,而且我很好奇它们是如何做到的,因为请求网页并解析它们非常耗时。
谢谢, 戴夫
I would like to make an program that acts like a big filter for stocks. To do so, I need to have real-time (or delayed) quotes from the market. I started getting stock quotes by requesting pages from yahoo, accordingand parsing the html to the ticker, and parsing the html. I was wondering how to do this requesting and parsing html. Is there some way I can request only the stock quotes and its info? I know some applications do this, and I am very curious how they do it, because requesting web pages and parsing them is very time-consuming.
Thanks,
Dave
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
解析网页的输出是一个傻瓜的游戏。它总是在变化,除非您愿意大量投资于某种非常有弹性的解析器,否则您将花费一生的时间来摆弄它。使用网络服务,Google 提供了一项 http://googleblog .blogspot.com/2007/01/real-time-quotes-for-free.html
Parsing the output of the webpage is a chump's game. It is always changing and unless you're willing to heavily invest in some sort of very resilient parser you're going to spend your life twiddling with it. Use a web service, google offers one http://googleblog.blogspot.com/2007/01/real-time-quotes-for-free.html
您可以从 yahoo 获取 csv 数据。
此页面提供更多信息。
You can get csv data from yahoo.
This page has more information.
Google 和 Yahoo API 都已消失。不过,Investor's Exchange 提供了一个 API,非常易于使用报价数据。
The Google and Yahoo API's have both gone away. However, Investor's Exchange offers an API that's very easy to use for quote data.
Afaik,此类数据可通过基于订阅的模型获得,我想到的是 Xignite。据我所知,纳斯达克和纽约证券交易所不提供任何可免费使用的 API。
Afaik, this kind of data is available via subscription based models, Xignite is one that comes to mind. To my knowledge, NASDAQ and the NYSE do not provide any freely usable API's.
实际上有一个雅虎网络服务可以返回股票报价的 CSV 文件。所以不需要HTML解析
There is actually a yahoo web service that will return CSV file of stock quotes. So no HTML parsing needed
在金融服务行业,大多数银行都会有路透社或彭博社提供的实时信息,但这显然会花费很多钱。如果你在谷歌上搜索“股票价格提要”或“市场数据提要”,你会得到一些选项,有些是免费的,有些是付费的。
我还建议使用复杂事件处理引擎,例如 Esper 来进行这种实时处理,它比从头开始编写整个应用程序堆栈要容易得多。
In the financial services industry, most banks will have a real time feed provided by Reuters or Bloomberg, but this, obviously, will cost a lot of money. If you Google for "stock price feed" or "market data feed" you will get some options, some free, some paid for.
I would also recommend using a Complex Event Processing engine such as Esper for doing this sort of real time processing, it will be substantially easier than writing the whole application stack from scratch.
要下载 C# 或 VB.NET 中的雅虎财经股票报价,您可以使用“Yahoo! Finance Managed”库。
点击此处
For downloading yahoo finance stock quotes in C# or VB.NET you can use the "Yahoo! Finance Managed" library.
Click here
这在内部使用雅虎股票 API。
我希望这个可以帮助你。
https://github.com/bhattumang7/gold-silver-share-price -api-印度
this internally uses yahoo stock api.
i hope this one helps you out.
https://github.com/bhattumang7/gold-silver-share-price-api-india
尝试查看此 channel9 演示文稿。这是一个 F# 介绍,但从 27:00 开始,演示者 Luca Bolognesi 创建了一个应用程序来完成您要求的一些工作(在 F# 中,但非常鼓舞人心 - 至少对我来说)。
Try to look at this channel9 presentation. It is a F# introduction but from 27:00 the presenter, Luca Bolognesi, creates an application that does some of the work you are asking for (in F# but very inspirational - to me at least).
这是提供免费日内数据的网站列表。
您可以导出数据并在您的软件中使用它
Here is a list of websites that provide free intraday data.
You can export the data and use it in your software
使用 Fidelity.com 和检查销售价格元素后,您可以操作 URL 以从程序内搜索任何股票。
使用 Visual Studio Community 2013 C#
Using Fidelity.com & inspecting the element for the selling price you can manipulate the URL to search any stock from inside your program.
Using Visual Studio Community 2013 C#