在 C#/Java 中获取实时市场/股票报价

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1975085/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 22:20:32  来源:igfitidea点击:

Getting real-time market/stock quotes in C#/Java

c#javastocks

提问by David Menard

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.

我想做一个程序,就像一个大的股票过滤器。为此,我需要从市场获得实时(或延迟)报价。我开始通过从 yahoo 请求页面来获取股票报价,根据并将 html 解析为股票代码,然后解析 html。我想知道如何请求和解析 html。有什么方法可以让我只请求股票报价及其信息?我知道有些应用程序会这样做,我很好奇它们是如何做到的,因为请求网页并解析它们非常耗时。

Thanks, Dave

谢谢,戴夫

采纳答案by stimms

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

解析网页的输出是一个笨蛋的游戏。它总是在变化,除非您愿意大量投资于某种非常有弹性的解析器,否则您将一生都在玩弄它。使用网络服务,谷歌提供了一个http://googleblog.blogspot.com/2007/01/real-time-quotes-for-free.html

回答by Ta01

Afaik, this kind of data is available via subscription based models, Xigniteis one that comes to mind. To my knowledge, NASDAQ and the NYSE do not provide any freely usable API's.

Afaik,这种数据可通过基于订阅的模型获得,Xignite是我想到的一种。据我所知,纳斯达克和纽约证券交易所不提供任何可免费使用的 API。

回答by Mongus Pong

You can get csv data from yahoo.

您可以从雅虎获取 csv 数据。

This pagehas more information.

此页面有更多信息。

回答by Aye

There is actually a yahoo web service that will return CSV file of stock quotes. So no HTML parsing needed

实际上有一个雅虎 Web 服务可以返回股票报价的 CSV 文件。所以不需要 HTML 解析

回答by John Channing

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.

在金融服务行业,大多数银行都会有路透社或彭博社提供的实时信息流,但这显然会花费很多钱。如果您在 Google 上搜索“股票价格提要”或“市场数据提要”,您将获得一些选项,有些是免费的,有些是付费的。

I would also recommend using a Complex Event Processing engine such as Esperfor doing this sort of real time processing, it will be substantially easier than writing the whole application stack from scratch.

我还建议使用诸如Esper 之类的复杂事件处理引擎来进行这种实时处理,这比从头开始编写整个应用程序堆栈要容易得多。

回答by Moberg

Try to look at this channel9presentation. 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).

试着看看这个channel9演示。这是一个 F# 介绍,但从 27:00 开始,演示者 Luca Bolognesi 创建了一个应用程序来完成您要求的一些工作(在 F# 中但非常鼓舞人心 - 至少对我而言)。

回答by Maas

For downloading yahoo finance stock quotes in C# or VB.NET you can use the "Yahoo! Finance Managed" library.

要在 C# 或 VB.NET 中下载雅虎财经股票报价,您可以使用“Yahoo! Finance Managed”库。

Click here

点击这里

回答by bhatt.umang7

this internally uses yahoo stock api. i hope this one helps you out.

这在内部使用雅虎股票 api。我希望这个能帮到你。

https://github.com/bhattumang7/gold-silver-share-price-api-india

https://github.com/bhattumang7/gold-silver-share-price-api-india

回答by Atom

Here is a list of websitesthat provide free intraday data.

以下是提供免费日内数据的网站列表

You can export the data and use it in your software

您可以导出数据并在您的软件中使用它

回答by Montana

Using Fidelity.com & inspecting the element for the selling price you can manipulate the URL to search any stock from inside your program.

使用 Fidelity.com 并检查销售价格元素,您可以操纵 URL 以从程序内部搜索任何股票。

Using Visual Studio Community 2013 C#

使用 Visual Studio Community 2013 C#