当前位置: 首页 > news >正文

电商网站开发过程推广普通话宣传周活动方案

电商网站开发过程,推广普通话宣传周活动方案,开发公司组织机构图,海报设计免费模板股票时间序列 时间序列: 金融领域最重要的数据类型之一 股价、汇率为常见的时间序列数据 趋势分析: 主要分析时间序列在某一方向上持续运动 在量化交易领域,我们通过统计手段对投资品的收益率进行时间序列建模,以此来预测未来的收…

股票时间序列

时间序列:
金融领域最重要的数据类型之一
股价、汇率为常见的时间序列数据
趋势分析:
主要分析时间序列在某一方向上持续运动
在量化交易领域,我们通过统计手段对投资品的收益率进行时间序列建模,以此来预测未来的收益率并产生交易信
序列相关性:
金融时间序列的一个最重要特征是序列相关性
以投资品的收益率序列为例,我们会经常观察到一段时间内的收益率之间存在正相关或者负相关

Pandas时间序列函数

datetime:
时间序列最常用的数据类型
方便进行各种时间类型运算
loc:
Pandas中对DateFrame进行筛选的函数,相当于SQL中的where
groupby:
Pandas中对数据分组函数,相当于SQL中的GroupBy
读取数据

    def testReadFile(self):file_name = r"D:\lhjytest\demo.csv"df = pd.read_csv(file_name)print(df.info())print("-------------")print(df.describe())

image.png
image.png
时间处理

    def testTime(self):file_name = r"D:\lhjytest\demo.csv"df = pd.read_csv(file_name)df.columns = ["stock_id","date","close","open","high","low","volume"]df["date"] = pd.to_datetime(df["date"])df["year"] = df["date"].dt.yeardf["month"] = df["date"].dt.monthprint(df)

image.png
最低收盘价

    def testCloseMin(self):file_name = r"D:\lhjytest\demo.csv"df = pd.read_csv(file_name)df.columns = ["stock_id","date","close","open","high","low","volume"]print("""close min : {}""".format(df["close"].min()))print("""close min index : {}""".format(df["close"].idxmin()))print("""close min frame : {}""".format(df.loc[df["close"].idxmin()]))

image.png
每月平均收盘价与开盘价

    def testMean(self):file_name = r"D:\lhjytest\demo.csv"df = pd.read_csv(file_name)df.columns = ["stock_id","date","close","open","high","low","volume"]df["date"] = pd.to_datetime(df["date"])df["month"] = df["date"].dt.monthprint("""month close mean : {}""".format(df.groupby("month")["close"].mean()))print("""month open mean : {}""".format(df.groupby("month")["open"].mean()))

image.png
算涨跌幅

# 涨跌幅今日收盘价减去昨日收盘价def testRipples_ratio(self):file_name = r"D:\lhjytest\demo.csv"df = pd.read_csv(file_name)df.columns = ["stock_id","date","close","open","high","low","volume"]df["date"] = pd.to_datetime(df["date"])df["rise"] = df["close"].diff()df["rise_ratio"] = df["rise"] / df.shift(-1)["close"]print(df)

image.png
计算股价移动平均

def testMA(self):file_name = r"D:\lhjytest\demo.csv"df = pd.read_csv(file_name)df.columns = ["stock_id","date","close","open","high","low","volume"]df['ma_5'] = df.close.rolling(window=5).mean()df['ma_10'] = df.close.rolling(window=10).mean()df = df.fillna(0)print(df)

image.png

K线图

K线图
K线图蕴含大量信息,能显示股价的强弱、多空双方的力量对比,是技术分析最常见的工具

K线图实现

Matplotlib
一个Python 的 2D绘图库,窗以各种硬拷贝格式和跨平台的交互式环境生成出版质量级别的图形
matplotlib finance
python 中可以用来画出蜡烛图线图的分析工具,目前已经从 matplotlib 中独立出来
读取股票数据,画出K线图

    def testKLineChart(self):file_name = r"D:\lhjytest\demo.csv"df = pd.read_csv(file_name)df.columns = ["stock_id","date","close","open","high","low","volume"]fig = plt.figure()axes = fig.add_subplot(111)candlestick2_ochl(ax=axes,opens=df["open"].values,closes=df["close"].values,highs=df["high"].values,lows=df["low"].values,width=0.75,colorup='red',colordown='green')plt.xticks(range(len(df.index.values)),df.index.values,rotation=30)axes.grid(True)plt.title("K-Line")plt.show()

image.png

 def testKLineByVolume(self):file_name = r"D:\lhjytest\demo.csv"df = pd.read_csv(file_name)df.columns = ["stock_id","date","close","open","high","low","volume"]df = df[["date","close","open","high","low","volume"]]df["date"] = pd.to_datetime(df["date"])df = df.set_index('date')my_color = mpf.make_marketcolors(up = 'red',down = 'green',wick = 'i',volume = {'up':'red','down':'green'},ohlc = 'i')my_style  = mpf.make_mpf_style(marketcolors = my_color,gridaxis = 'both',gridstyle = '-.',rc = {'font.family':'STSong'})mpf.plot(df,type = 'candle',title = 'K-LineByVolume',ylabel = 'price',style = my_style,show_nontrading = False,volume = True,ylabel_lower = 'volume',datetime_format = '%Y-%m-%d',xrotation = 45,linecolor = '#00ff00',tight_layout = False)

image.png
K线图带交易量及均线

   def testKLineByMA(self):file_name = r"D:\lhjytest\demo.csv"df = pd.read_csv(file_name)df.columns = ["stock_id","date","close","open","high","low","volume"]df = df[["date","close","open","high","low","volume"]]df["date"] = pd.to_datetime(df["date"])df = df.set_index('date')my_color = mpf.make_marketcolors(up = 'red',down = 'green',wick = 'i',volume = {'up':'red','down':'green'},ohlc = 'i')my_style  = mpf.make_mpf_style(marketcolors = my_color,gridaxis = 'both',gridstyle = '-.',rc = {'font.family':'STSong'})mpf.plot(df,type = 'candle',mav = [5,10],title='K-LineByVolume',ylabel='price',style=my_style,show_nontrading=False,volume=True,ylabel_lower='volume',datetime_format='%Y-%m-%d',xrotation=45,linecolor='#00ff00',tight_layout=False)

image.png

http://www.hkea.cn/news/189836/

相关文章:

  • 手机网站建设用乐云seo搜索引擎是什么意思啊
  • 昆明做大的网站开发公司google网页搜索
  • 做网站运营需要什么证宁波靠谱营销型网站建设
  • 天津进口网站建设电话青岛网站建设公司
  • 游戏币网站建设win7优化大师官方网站
  • 技术专业网站建设班级优化大师网页版登录
  • 外国网站上做雅思考试台州百度推广优化
  • 男女做那种的的视频网站国内最好的搜索引擎
  • 泉州做网站优化价格成功品牌策划案例
  • 做网站去哪个平台资源优化排名网站
  • 备案的网站名称可以改吗百度青岛代理公司
  • 专做进口批发的网站关键词优化多少钱
  • 做网站有了空间在备案吗百度权重高的网站有哪些
  • 做空间的网站著名的网络营销案例
  • 做网站客户尾款老不给怎么办百度推广年费多少钱
  • 想要将网站信息插到文本链接怎么做百度关键词搜索
  • 江苏网站备案要多久seo域名综合查询
  • 大型网站建设机构津seo快速排名
  • 建设证件查询官方网站宁波做网站的公司
  • 那些网站招聘在家里做的客服网店推广策略
  • 湘西 网站 建设 公司sem代运营托管公司
  • 用css为wordpress排版西安seo外包服务
  • vs2005做网站百度推广官方网站登录入口
  • 乐从网站建设公司北京seo优化推广
  • 如何在网上接做网站的小项目市场监督管理局电话
  • 淘宝购物站优化
  • 石家庄最新疫情轨迹河南网站优化公司哪家好
  • 网站色彩搭配服务器ip域名解析
  • 哪个网站专业做安防如何注册域名网站
  • 穆棱市住房和城乡建设局网站关键词词库