股票数据在线获取

推荐:使用如下地址注册tushare并分享此链接。

https://tushare.pro/register?reg=133232 分享此链接,注册tushare.

以前是使用tushare等下载保存到本地数据库后进行计算分析。

现在不想维护本地数据库,想使用时直接在线获取数据。经查找如下实现:

参考了:

https://blog.youkuaiyun.com/luanpeng825485697/article/details/78442062

import requests
#第一步:获取数据为字符串 code为股票代码
#第二步:处理字符串,初步设想是splits.格式化为标准的dict 转换为df
#第三步:

#新浪实时行情
#url = 'http://hq.sinajs.cn/list=' + code
url = 'http://hq.sinajs.cn/list=' + 'sh601069'
response = requests.get(url).text
print(response)

#腾讯日K
#url = 'http://data.gtimg.cn/flashdata/hushen/latest/daily/code.js?maxage=43201&visitDstTime=1'
url = 'http://data.gtimg.cn/flashdata/hushen/latest/daily/sh601069.js?maxage=43201&visitDstTime=1'
response = requests.get(url).text
print(response)
   

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值