js输入股票代码获得nodejs页面实时刷新价格

求网页上显示股票行情的代码【javascript吧】_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:160,791贴子:
求网页上显示股票行情的代码收藏
想在中间加一段股票行情显示的代码,好不容易找到一个插件但不会操作。页面引入以下脚本&script src=&& type=&text/javascript&&&/script&&script src=&& type=&text/javascript&&&/script&调用javascript函数jrj_show_flash(s_code,s_type,divId,flashWidth,flashHeigth)s_code:证券代码s_type:证券类型,s表示股票,i表示指数,传空字符串默认为股票divId:div容器idflashWidth:flash宽度flashHeigth:flash高度求操作方法或者其他方法。谢谢
登录百度帐号js如何得到股票行情实时数据?_百度知道
js如何得到股票行情实时数据?
我想在页面上做个股票实时更新的数据表.我设置一段时间自动刷新一次页面,但是那些数据从哪里可以得到呢?有具体的脚本代码吗???
我有更好的答案
是要跟供应商协商得到他的接口才能得到那些数据
采纳率:100%
为您推荐:
其他类似问题
您可能关注的内容
股票行情的相关知识
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。&>&获取股票信息的JS控件改进版
获取股票信息的JS控件改进版
上传大小:3KB
输入股票代码获取股票详细信息,可用于金融类网站辅助开发的控件。
综合评分:0
下载个数:
{%username%}回复{%com_username%}{%time%}\
/*点击出现回复框*/
$(".respond_btn").on("click", function (e) {
$(this).parents(".rightLi").children(".respond_box").show();
e.stopPropagation();
$(".cancel_res").on("click", function (e) {
$(this).parents(".res_b").siblings(".res_area").val("");
$(this).parents(".respond_box").hide();
e.stopPropagation();
/*删除评论*/
$(".del_comment_c").on("click", function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_invalid/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parents(".conLi").remove();
alert(data.msg);
$(".res_btn").click(function (e) {
var parentWrap = $(this).parents(".respond_box"),
q = parentWrap.find(".form1").serializeArray(),
resStr = $.trim(parentWrap.find(".res_area_r").val());
console.log(q);
//var res_area_r = $.trim($(".res_area_r").val());
if (resStr == '') {
$(".res_text").css({color: "red"});
$.post("/index.php/comment/do_comment_reply/", q,
function (data) {
if (data.succ == 1) {
var $target,
evt = e || window.
$target = $(evt.target || evt.srcElement);
var $dd = $target.parents('dd');
var $wrapReply = $dd.find('.respond_box');
console.log($wrapReply);
//var mess = $(".res_area_r").val();
var mess = resS
var str = str.replace(/{%header%}/g, data.header)
.replace(/{%href%}/g, 'http://' + window.location.host + '/user/' + data.username)
.replace(/{%username%}/g, data.username)
.replace(/{%com_username%}/g, data.com_username)
.replace(/{%time%}/g, data.time)
.replace(/{%id%}/g, data.id)
.replace(/{%mess%}/g, mess);
$dd.after(str);
$(".respond_box").hide();
$(".res_area_r").val("");
$(".res_area").val("");
$wrapReply.hide();
alert(data.msg);
}, "json");
/*删除回复*/
$(".rightLi").on("click", '.del_comment_r', function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_comment_del/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parent().parent().parent().parent().parent().remove();
$(e.target).parents('.res_list').remove()
alert(data.msg);
//填充回复
function KeyP(v) {
var parentWrap = $(v).parents(".respond_box");
parentWrap.find(".res_area_r").val($.trim(parentWrap.find(".res_area").val()));
评论共有0条
综合评分:
积分/C币:5
VIP会员动态
CSDN下载频道资源及相关规则调整公告V11.10
下载频道用户反馈专区
下载频道积分规则调整V1710.18
spring mvc+mybatis+mysql+maven+bootstrap 整合实现增删查改简单实例.zip
资源所需积分/C币
当前拥有积分
当前拥有C币
输入下载码
为了良好体验,不建议使用迅雷下载
获取股票信息的JS控件改进版
会员到期时间:
剩余下载个数:
剩余积分:0
为了良好体验,不建议使用迅雷下载
积分不足!
资源所需积分/C币
当前拥有积分
您可以选择
程序员的必选
绿色安全资源
资源所需积分/C币
当前拥有积分
当前拥有C币
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
您的积分不足,将扣除 10 C币
为了良好体验,不建议使用迅雷下载
无法举报自己的资源
你当前的下载分为234。
你还不是VIP会员
开通VIP会员权限,免积分下载
你下载资源过于频繁,请输入验证码
您因违反CSDN下载频道规则而被锁定帐户,如有疑问,请联络:!
若举报审核通过,可返还被扣除的积分
被举报人:
njxiaoxiao79
举报的资源分:
请选择类型
资源无法下载 ( 404页面、下载失败、资源本身问题)
资源无法使用 (文件损坏、内容缺失、题文不符)
侵犯版权资源 (侵犯公司或个人版权)
虚假资源 (恶意欺诈、刷分资源)
含色情、危害国家安全内容
含广告、木马病毒资源
*详细原因:
获取股票信息的JS控件改进版javascript&获取实时股票信息
两种方法:
1.http/javascript接口取数据
2.web-service接口
1. http/javascript接口取数据
1.1 Sina股票数据接口
以大秦铁路(股票代码:601006)为例,如果要获取它的最新行情,只需访问新浪的股票数据
这个url会返回一串文本,例如:
var hq_str_sh601006="大秦铁路, 27.55,
27.25, 26.91, 27.55, 26.20, 26.91, 26.92,
95, 26.91,
5, 1, 14300,
&26.88, 1,
, , 1, 2, 1,
, 15:05:32";
这个字符串由许多数据拼接在一起,不同含义的数据用逗号隔开了,按照程序员的思路,顺序号从0开始。
0:”大秦铁路”,股票名字;
1:”27.55&P,今日开盘价;
2:”27.25&P,昨日收盘价;
3:”26.91&P,当前价格;
4:”27.55&P,今日最高价;
5:”26.20&P,今日最低价;
6:”26.91&P,竞买价,即“买一”报价;
7:”26.92&P,竞卖价,即“卖一”报价;
8:”&P,成交的股票数,由于股票交易以一百股为基本单位,所以在使用时,通常把该值除以一百;
9:”&P,成交金额,单位为“元”,为了一目了然,通常以“万元”为成交金额的单位,所以通常把该值除以一万;
10:”4695&P,“买一”申请4695股,即47手;
11:”26.91&P,“买一”报价;
12:”57590&P,“买二”
13:”26.90&P,“买二”
14:”14700&P,“买三”
15:”26.89&P,“买三”
16:”14300&P,“买四”
17:”26.88&P,“买四”
18:”15100&P,“买五”
19:”26.87&P,“买五”
20:”3100&P,“卖一”申报3100股,即31手;
21:”26.92&P,“卖一”报价
(22, 23), (24, 25), (26,27), (28,
29)分别为“卖二”至“卖四的情况”
30:”&P,日期;
31:”15:05:32&P,时间;
这个接口对于JavaScript程序非常方便,通常的使用方式为,静态或动态地在页面中插入:
type="text/javascript" src="http://hq.sinajs.cn/list=sh601006"
charset="gb2312"&
type="text/javascript"&
elements=hq_str_sh601006.split(",");
document.write("current
price:"+elements[3]);
这段代码输出大秦铁路(股票代码:601006)的当前股价
current price:14.20
如果你要同时查询多个股票,那么在URL最后加上一个逗号,再加上股票代码就可以了;比如你要一次查询大秦铁路(601006)和大同煤业(601001)的行情,就这样使用URL:
但如果你要查询大盘指数,情况会有不同,比如查询上证综合指数(000001),使用如下URL:
http://hq.sinajs.cn/list=s_sh000001
服务器返回的数据为:
hq_str_s_sh000001="上证指数,8.073,-3.97,8126";
数据含义分别为:指数名称,当前点数,当前价格,涨跌率,成交量(手),成交额(万元);
查询深圳成指的URL为:
对于股票的K线图,日线图等的获取可以通过请求http://image.sinajs.cn/…./…/*.gif此URL获取,其中*代表股票代码,详见如下:
查看日K线图:
分时线的查询:
日K线查询:
周K线查询:
月K线查询:
web-service接口
CHINAstock的web-service:
中国股票行情数据 WEB
服务(支持深圳和上海股市的全部基金、债券和股票),数据即时更新。输出GIF分时走势图、日/周/月 K
线图、及时行情数据(股票名称、行情时间、最新价、昨收盘、今开盘、涨跌额、最低、最高、涨跌幅、成交量、成交额、竞买价、竞卖价、委比、买一
- 买五、卖一 - 卖五)。此WEB服务提供了如下几个接口:
getStockImageByCode
GET 股票GIF分时走势图
INput:theStockCode =
股票代号,如:sh000001
/WebServices/ChinaStockWebService.asmx HTTP/1.1
Host: www.webxml.com.cn
Content-Type: text/
charset=utf-8
Content-Length: length
SOAPAction:
&?xml version="1.0"
encoding="utf-8"?&
&soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&
&soap:Body&
&getStockImageByCode
xmlns="http://WebXml.com.cn/"&
&theStockCode&string&/theStockCode&
&/getStockImageByCode&
&/soap:Body&
&/soap:Envelope&
2.1.2 getStockImageByteByCode
获得中国股票GIF分时走势图字节数组
INput:theStockCode =
股票代号,如:sh000001
/WebServices/ChinaStockWebService.asmx HTTP/1.1Host:
www.webxml.com.cnContent-Type: text/
charset=utf-8Content-Length: lengthSOAPAction:
"http://WebXml.com.cn/getStockImageByteByCode" &?xml
version="1.0"
encoding="utf-8"?&&soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&&
&soap:Body&&&&
&getStockImageByteByCode
xmlns="http://WebXml.com.cn/"&&&&&&
&theStockCode&string&/theStockCode&&&&
&/getStockImageByteByCode&&
&/soap:Body&&/soap:Envelope&
返回的数据如下:
&?xml version="1.0"
encoding="utf-8" ?&
&base64Binary
xmlns="http://WebXml.com.cn/"&R0lGODlhIQIsAfcAAAAAAAwLBxkGBQ4ODhAQEBsSChUVFS4TDB8eGQkA9koPCDAAzy4mFVgAp2UYC0IqEUYuBVwiDEAsI1QnFX8AgDU1NUozFlgxD6cBWVY5FnIwEmQ4Gc0AMlhDHPEADlVJMEpKSm1IHOUBWpY3FZMyVY9IGXRWIEFmWGNYUmpdPXJgHQB8HK9EGGBgX4lXIACoAHhkMyt4m4VkJtstbv8A
getStockImage_kByCode
直接获得中国股票GIF日/周/月 K
线图(545*300pixel/72dpi)
INPUT: theStockCode = 股票代号
theType = K 线图类型(D:日[默认]、W:周、M:月),
/WebServices/ChinaStockWebService.asmx HTTP/1.1Host:
www.webxml.com.cnContent-Type: text/
charset=utf-8Content-Length: lengthSOAPAction:
"http://WebXml.com.cn/getStockImage_kByCode" &?xml
version="1.0"
encoding="utf-8"?&&soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&&
&soap:Body&&&&
&getStockImage_kByCode
xmlns="http://WebXml.com.cn/"&&&&&&
&theStockCode&string&/theStockCode&&&&&&
&theType&string&/theType&&&&
&/getStockImage_kByCode&&
&/soap:Body&&/soap:Envelope&
比如按照下图所示输入:
返回的结果就是周K线图:
getStockImage_kByteByCode
获得中国股票GIF日/周/月 K 线图字节数组
Input:theStockCode =
股票代号,如:sh000001
/WebServices/ChinaStockWebService.asmx HTTP/1.1Host:
www.webxml.com.cnContent-Type: text/
charset=utf-8Content-Length: lengthSOAPAction:
"http://WebXml.com.cn/getStockImage_kByteByCode"
&?xml version="1.0"
encoding="utf-8"?&&soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&&
&soap:Body&&&&
&getStockImage_kByteByCode
xmlns="http://WebXml.com.cn/"&&&&&&
&theStockCode&string&/theStockCode&&&&&&
&theType&string&/theType&&&&
&/getStockImage_kByteByCode&&
&/soap:Body&&/soap:Envelope&HTTP/1.1
200 OKContent-Type: text/ charset=utf-8Content-Length: length
&?xml version="1.0"
encoding="utf-8"?&&soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&&
&soap:Body&&&&
&getStockImage_kByteByCodeResponse
xmlns="http://WebXml.com.cn/"&&&&&&
&getStockImage_kByteByCodeResult&base64Binary&/getStockImage_kByteByCodeResult&&&&
&/getStockImage_kByteByCodeResponse&&
&/soap:Body&&/soap:Envelope&比如按照下图输入
返回的结果就是周K线图字节数组
&?xml version="1.0"
encoding="utf-8" ?&
&base64Binary
xmlns="http://WebXml.com.cn/"&R0lGODlhIQIsAfcAAAAAAAwLBxkGBQ4ODhAQEBsSChUVFS4TDB8eGQkA9koPCDAAzy4mFVgAp2UYC0IqEUYuBVwiDEAsI1QnFX8AgDU1NUozFlgxD6cBWVY5FnIwEmQ4Gc0AMlhDHPEADlVJMEpKSm1IHOUBWpY3FZMyVY9IGXRWIEFmWGNYUmpdPXJgHQB8HK9EGGBgX4lXIACoAHhkMyt4m4VkJtstbv8A
getStockInfoByCode
获得中国股票及时行情
input:theStockCode = 股票代号
/WebServices/ChinaStockWebService.asmx HTTP/1.1Host:
www.webxml.com.cnContent-Type: text/
charset=utf-8Content-Length: lengthSOAPAction:
"http://WebXml.com.cn/getStockInfoByCode" &?xml
version="1.0"
encoding="utf-8"?&&soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&&
&soap:Body&&&&
&getStockInfoByCode
xmlns="http://WebXml.com.cn/"&&&&&&
&theStockCode&string&/theStockCode&&&&
&/getStockInfoByCode&&
&/soap:Body&&/soap:Envelope&返回的值一个一维字符串数组
String(24),结构为:String(0)股票代号、String(1)股票名称、String(2)行情时间、String(3)最新价(元)、String(4)昨收盘(元)、String(5)今开盘(元)、String(6)涨跌额(元)、String(7)最低(元)、
String(8)最高(元)、String(9)涨跌幅(%)、String(10)成交量(手)、String(11)成交额(万元)、String
(12)竞买价(元)、String(13)竞卖价(元)、String(14)委比(%)、String(15)-String(19)买一
- 买五(元)/手、String(20)-String(24)卖一 - 卖五(元)/手。
service的方法类似于现在concurrent项目的DBWS数据的获取,都是通过SOAP协议向DBWS服务器获取相关的数据。
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。

我要回帖

更多关于 nodejs页面实时刷新 的文章

 

随机推荐