您的位置:首页 > 其它

股票数据获取处理和显示的开发笔记

2015-01-11 14:10 169 查看

IDE :jetbraints webstorm 5.0.1

jdk :jdk1.6.0_31

3d :three.js

目的:获取股市数据,以3d的方式展示出来。

目的1:获取股票名称列表、代码列表和总股本列表

目的2:获取每一只股票的历史收盘数据,日线。

目的3:以频率 天/间隔 刷新以总股本为面积的,以收盘价为立方体

2015-01-11

这里都是取得实时数据所需要了解的东西。
http://www.gummy-stuff.org/Yahoo-data.htm 可能关于雅虎的数据格式比较详细的介绍都来自这里,但是我打开链接一看,被雅虎干了

。可以理解,人家是混pv的嘛,大家都搞了后台数据刷刷啥的肯定不行了。不过应该雅虎犯不着改代码,代价太大了,而且尝试了一下网页取数据没问题。
I've deleted this web page after having received the following email:


Dear Peter Ponzo,

I serve as copyright counsel for Yahoo and write to you with respect to your site http://gummy-stuff.org, specifically the page located at http://www.gummy-stuff.org/Yahoo-data.htm.

Yahoo offers certain services on its website, including the Yahoo Finance service available at finance.yahoo.com, subject to its Terms of Service, located at https://info.yahoo.com/legal/us/yahoo/utos/utos-173.html. It has come to our attention, through a data partner, that your page located at http://www.gummy-stuff.org/Yahoo-data.htm provides a tool and instructions for using the tool to enable users to hack the Yahoo Finance site.

......

Sincerely,

继续寻找相关的格式介绍啦。

http://www.financialwisdomforum.org/gummy-stuff/Yahoo-data.htm  吼吼这里有哦。

直接无牙的直接引用了,不需要一声感谢。怎么调行高?全靠空格

翻译几个咱需要的

a Aska2 Average Daily Volumea5 Ask Size
bBidb2Ask (Real-time)b3Bid (Real-time)
b4Book Valueb6Bid SizecChange & Percent Change
c1Changec3Commissionc6Change (Real-time)
c8After Hours Change (Real-time)dDividend/Shared1Last Trade Date(上次交易日期)
d2Trade DateeEarnings/Sharee1Error Indication (returned for symbol changed / invalid)
e7EPS Estimate Current Yeare8EPS Estimate Next Yeare9EPS Estimate Next Quarter
f6Float SharesgDay's LowhDay's High
j52-week Lowk52-week Highg1Holdings Gain Percent
g3Annualized Gaing4Holdings Gaing5Holdings Gain Percent (Real-time)
g6Holdings Gain (Real-time)iMore Infoi5Order Book (Real-time)
j1Market Capitalizationj3Market Cap (Real-time)j4EBITDA
j5Change From 52-week Lowj6Percent Change From 52-week Lowk1Last Trade (Real-time) With Time
k2Change Percent (Real-time)k3Last Trade Sizek4Change From 52-week High
k5Percebt Change From 52-week HighlLast Trade (With Time)(上次交易带有时间)l1Last Trade (Price Only)(上次交易(仅包含价格))
l2High Limitl3Low LimitmDay's Range
m2Day's Range (Real-time)m350-day Moving Averagem4200-day Moving Average
m5Change From 200-day Moving Averagem6Percent Change From 200-day Moving Averagem7Change From 50-day Moving Average
m8Percent Change From 50-day Moving AveragenName(股票名称)n4Notes
oOpenpPrevious Closep1Price Paid
p2Change in Percentp5Price/Salesp6Price/Book
qEx-Dividend DaterP/E Ratior1Dividend Pay Date
r2P/E Ratio (Real-time)r5PEG Ratior6Price/EPS Estimate Current Year
r7Price/EPS Estimate Next YearsSymbol(代码 沪市+.ss 深市+.szs1Shares Owned
s7Short Ratiot1Last Trade Timet6Trade Links
t7Ticker Trendt81 yr Target PricevVolume(成交量)
v1Holdings Valuev7Holdings Value (Real-time)w52-week Range
w1Day's Value Changew4Day's Value Change (Real-time)xStock Exchange
yDividend Yield

查询请求范例:http://download.finance.yahoo.com/d/quotes.csv?s=601727.ss&f=as

这里有一个合集可以参考参考:

http://thesimplesynthesis.com/article/finance-apis

关于实时的获取qutes.csv已经了解了大概了,但关于table.csv获取的历史数据还是搞不清楚参数是什么标准:直到,我找到了这个

https://community.jaspersoft.com/wiki/building-custom-datasource-yahoo-finance-data

看上去很详细的哦样子哦。研究下。


遇到了一个问题,因为我使用js,试图从本地向雅虎的服务器发请求,导致了跨域访问错误。一度尝试更换一个3d引擎,但是想想就麻烦。还有没有其他路线可以走呢?

2015-01-13 00:59

找到个办法哦

,唉,其实很土的办法了,从服务器上使用jsp页面先从服务器上抓数据下来,等待js页面上的请求去使用一个很牛的jsonp方法,到我自己建设的服务器上搞定。

原理自己再复习一下哦,因为js标签 <script> 的 src属性是可以从服务器上取回值的。可以在服务器上设置一个暗号,一旦有一个客户端的js中都有一个src是需要到某一个特定的url,则替换成为一段json。也就把所有的内容都搞到客户端上去了。

测试使用:

http://ichart.finance.yahoo.com/table.csv?s=002001.SZ&a=0&b=1&c=2014&d=0&e=13&f=2015&g=d

BufferedInputStream bis = new BufferedInputStream( new URL(Url).openStream());

</pre><span style="font-size:32px;color:#3333ff;">2015-01-14 23:52</span>
服务器从雅虎的服务器上获取股票信息的时候,历史数据,出问题,总是在取回2000左右的时候,变得无法继续下去了。
不知道是不是服务器端的控制,只有多扫几遍了。
依然还有几只股票获取不到信息。就这样吧。
002160 404
002318 Connection reset
002319 Connection reset
002710 404
002720 Connection reset
002724 404
002730 404
002731 404
002733 Connection reset
002734 Connection reset
002735 404
002736 404
002738 404
002739 404
002740 404
300318 [code]300361
300364
300388
300389
300392
300396
300397
300400
300402
300403
300405
300406
300409
300411
以上皆是 Connection reset

[/code]
2015-01-18
这几天时间花费在如何整理获取回来的一大堆数据上面,虽然只取得了一年的数据,但是体量还是很大。为了在后期,查询的时候速度快,把以股票为单位的文件中的按照时间排列的价格文件,取出来,转换为一个整体文件。在这个整体文件中,每一行都是一个gson字符串,表示的是每一个天为时间单位,的所有股票的价格。
这样在服务器为外部提供检索的时候,就可以根据时间,进行快速的获取当前所有股票的close收盘价格。
2015-01-26
three.js scene更新children的时候,最好是在渲染之后,就直接把所有的模型都删除掉,否则,很容易出现长期占有内存不释放,当重复的时候,容易出错。而且要对多边形、材质、和模型,都调用dispose()。
无图无真相,,上个截屏为证。


黄色的条,是股市的总体量,天文数字哦。
[/code]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐