简体   繁体   English

使用C#/ Java获取实时市场/股票报价

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

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. 我开始通过从雅虎请求页面获取股票报价,并将html解析为自动收报机,并解析html。 I was wondering how to do this requesting and parsing html. 我想知道如何请求和解析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 谢谢,戴夫

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

You can get csv data from yahoo. 你可以从雅虎获得csv数据。

This page has more information. 此页面包含更多信息。

Afaik, this kind of data is available via subscription based models, Xignite is one that comes to mind. Afaik,这种数据可通过基于订阅的模型获得, Xignite是我想到的。 To my knowledge, NASDAQ and the NYSE do not provide any freely usable API's. 据我所知,纳斯达克和纽约证券交易所不提供任何可自由使用的API。

The Google and Yahoo API's have both gone away. Google和Yahoo API都已消失。 However, Investor's Exchange offers an API that's very easy to use for quote data. 但是, Investor's Exchange提供了一个非常容易用于报价数据的API

this internally uses yahoo stock api. 这内部使用雅虎股票API。 i hope this one helps you out. 我希望这个可以帮助你。

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

There is actually a yahoo web service that will return CSV file of stock quotes. 实际上有一个雅虎网络服务将返回股票报价的CSV文件。 So no HTML parsing needed 因此不需要HTML解析

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. 我还建议使用复杂事件处理引擎(如Esper)进行这种实时处理,这比从头开始编写整个应用程序堆栈要容易得多。

For downloading yahoo finance stock quotes in C# or VB.NET you can use the "Yahoo! Finance Managed" library. 要下载C#或VB.NET中的yahoo finance股票报价,您可以使用“Yahoo! Finance Managed”库。

Click here 点击这里

Here is a list of websites that provide free intraday data. 以下是提供免费日内数据的网站列表

You can export the data and use it in your software 您可以导出数据并在软件中使用它

Try to look at this channel9 presentation. 试着看看这个channel9演示文稿。 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). 这是一个F#的介绍,但从晚上27点开始,主持人Luca Bolognesi创建了一个应用程序来完成你要求的一些工作(在F#中,但至少对我来说非常鼓舞人心)。

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#

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM