资源简介
通过不断调用新浪财经的API获取A股的实时数据,包括实时数据,最高最低价,昨日收盘价,买5,卖5的成交价,成交量等信息,并可以实时进行分时图的绘画。
代码片段和文件信息
# -*- coding: utf-8 -*-
# author:llx time: 2018/1/3
import requests
import time as time_sleep
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from datetime import datetime
def getHTMLText(url):
try:
r = requests.get(url timeout=30)
r.raise_for_status()
r.encoding = r.apparent_encoding # ‘utf-8‘ #
return r.text
except:
return “ “
def getData(data):
data = data.split(‘‘)
# name = data[0]
todayOpen = data[1]
yesterdayClose = data[2]
nowPrice = data[3]
todayHigh = data[4]
todayLow = data[5]
bidPrice = data[6]
askPrice = data[7]
quantity = data[8]
money = data[9]
buy1Volume = data[10]
buy1Price = data[11]
buy2Volume = data[12]
buy2Price = data[13]
buy3Volume = data[14]
buy3Price = data[15]
buy4Volume = data[16]
buy4Price = data[17]
buy5Volume = data[18]
buy5Price = data[19]
sell1Volume = data[20]
sell1Price = data[21]
sell2Volume = data[22]
sell2Price = data[23]
sell3Volume = data[24]
sell3Price = data[25]
sell4Volume = data[26]
sell4Price = data[27]
sell5Volume = data[28]
sell5Price = data[29]
date = data[30]
time = data[31]
data = {‘todayOpen‘: todayOpen ‘yesterdayClose‘: yesterdayClose ‘nowPrice‘: nowPrice ‘todayHigh‘: todayHigh
‘todayLow‘: todayLow ‘bidPrice‘: bidPrice ‘askPrice‘: askPrice ‘quantity‘: quantity ‘money‘: money
‘buy1Volume‘: buy1Volume ‘buy1Price‘: buy1Price ‘buy2Volume‘: buy2Volume ‘buy2Price‘: buy2Price
- 上一篇:文本分类算法LDA
- 下一篇:python爬虫抓取百度贴吧中邮箱地址
相关资源
- python爬虫抓取百度贴吧中邮箱地址
- 文本分类算法LDA
- python Django websocket 实时消息推送
- python serial模块
- mod_wsgi.so全版本
- Python 标准库 中文版
- 改进的SIR模型评估k个重要点算法(
-
gameob
jects-0.0.3 for python3 - opencv-python的dll
- 《Python标准库》中文版
- 使用Python操作摄像头[Windows]
- python的简单测试代码
- 贝叶斯方法预测的demo(Python版本)
- 天眼查抓取脚本tianyancha.py
- 逻辑回归 python代码+训练数据
- python3实现多线程破解tomcat简单密码
- scipy-0.18.1-cp27-27m-win_amd64.whl
- python模拟登录带验证码的网站demo
- 加州理工大学Python OpenGL教程
- 传智播客python基础班/就业班课件
- python人脸识别、人体识别、耳朵眼睛
- 算法基础第五版 Foundation Of Algorithms
- Python多线程
- python简略图书管理系统.doc
- ANSYS ACT二次开发.doc
- 请求分页存储管理(操作系统课设)
- Python Sample for Leap Motion
- python最佳实践指南--中文版
- Python植物大战僵尸.zip
- Python图像聚类
评论
共有 条评论