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

网站建设满意度问卷调查设计北京

网站建设满意度问卷调查,设计北京,华容网站建设,青岛网站制作计划股价统计分析 数据样本 股价常用指标 极差 越高说明波动越明显 股价近期最高价的最大值和最小值的差价 成交量加权平均价格 英文名VWAP#xff08;Volume-Weighted Average Price#xff0c;成交量加权平均价格#xff09;是一个非常重要的经济学量#xff0c;代表着金融…股价统计分析 数据样本 股价常用指标 极差 越高说明波动越明显 股价近期最高价的最大值和最小值的差价 成交量加权平均价格 英文名VWAPVolume-Weighted Average Price成交量加权平均价格是一个非常重要的经济学量代表着金融资产的“平均”价格 收益率 简单收益率相邻两个价格之间的变化率 对数收益率指所有价格取对数后两两之间的差值 波动率 越高说明波动越明显 波动率是对价格变动的一种衡量 年波动率 对数波动率的标准差除以其均值再除以交易日倒数的平方根通常交易日取250天 月波动率 对数收益率的标准差除以其均值再乘以交易月的平方根通常交易月取12月 读取指定列 读取指定列numpy.loadtxt需要传入4个关键字参数1.fname是文件名数据类型为字符串str2.delimiter是分隔符数据类型为字符串str3.usecols是读取的列数数据类型为元组tuple, 其中元素个数有多少个则选出多少列4.unpack是是否解包数据类型为布尔bool。#def testReadFile(self):file_name rD:\lhjytest\demo.csvend_price,volumn np.loadtxt(fnamefile_name,delimiter,,usecols(2,6),unpackTrue)print(end_price)print(volumn)#计算最大值与最小值 def testMaxAndMin(self):file_name rD:\lhjytest\demo.csvhigh_price,low_price np.loadtxt(fnamefile_name,delimiter,,usecols(4,5),unpackTrue)print(max_price {}.format(high_price.max()))print(min_price {}.format(low_price.min()))计算极差 # 计算股价近期最高价的最大值和最小值的差值 和 计算股价近期最低价的最大值和最小值的差值 def testPtp(self):file_name rD:\lhjytest\demo.csvhigh_price, low_price np.loadtxt(fnamefile_name,delimiter,,usecols(4, 5),unpackTrue)print(max - min of high price : {}.format(np.ptp(high_price)))print(max - min of low price : {}.format(np.ptp(low_price)))计算成交量加权平均价格 # 成交量加权平均价格英文名VWAP(Volume-Weighted Average Price成交量加权平均价格是一个非常重要的经济学量代表着金融资产的“平均”价格def testAVG(self):file_name rD:\lhjytest\demo.csvend_price, volumn np.loadtxt(fnamefile_name,delimiter,,usecols(2, 6),unpackTrue)print(avg_price {}.format(np.average(end_price)))print(VWAP {}.format(np.average(end_price,weightsvolumn)))计算中位数 # 收盘价的中位数def testMedian(self):file_name rD:\lhjytest\demo.csvend_price, volumn np.loadtxt(fnamefile_name,delimiter,,usecols(2, 6),unpackTrue)print(median {}.format(np.median(end_price)))计算方差 # 收盘价的方差def testVar(self):file_name rD:\lhjytest\demo.csvend_price, volumn np.loadtxt(fnamefile_name,delimiter,,usecols(2, 6),unpackTrue)print(var {}.format(np.var(end_price)))print(var {}.format(end_price.var()))计算股票收益率、年波动率及月波动率 # 波动率是对价格变动的一种度量历史波动率可以根据历史价格数据计算得出。计算历史波动率时需要用到对数收益率# 年波动率等于对数收益率的标准差除以其均值再乘以交易日的平方根通常交易日取250天# 月波动率等于对数收益率的标准差除以其均值再乘以交易月的平方根。通常交易月取12月def testVolatility (self):file_name rD:\lhjytest\demo.csvend_price, volumn np.loadtxt(fnamefile_name,delimiter,,usecols(2, 6),unpackTrue)log_return np.diff(np.log(end_price))annual_volatility log_return.std() / log_return.mean() * np.sqrt(250)monthly_volatility log_return.std() / log_return.mean() * np.sqrt(12)print(log_return {}.format(log_return))print(annual_volatility {}.format(annual_volatility))print(monthly_volatility {}.format(monthly_volatility))股价均线 卷积 卷积可用于描述过去作用对当前的影响。卷积是时空响应的叠加可用作计算“滑动平均” 简单移动均线 一般用于分析时间序列上的股价趋势计算股价与等权重的指示函数的卷积 生成权重-卷积运算-均线可视化 指数移动均线 历史数据的权重以指数速度衰减计算股价与权重衰减的指示函数的卷积 权重初始化-权重衰减-卷积运算-均线可视化 class TestNumpyMA(TestCase): # 简单移动均线def testSMA(self):file_name rD:\lhjytest\demo.csvend_price np.loadtxt(fnamefile_name,delimiter,,usecols(2),unpackTrue)print(end_price)# 生成权重N 5weights np.ones(N) / Nprint(weights)# 卷积运算sma np.convolve(weights,end_price)[N-1:-N1]print(sma)# 均线可视化plt.plot(sma,linewidth5)plt.show()def testEXP(self):x np.arange(5)y np.arange(10)print(x, x) # exp 函数可以计算出每个数组元素的指数print(y, y)# 指数衰减print(Exp x : {}.format(np.exp(x)))print(Exp y : {}.format(np.exp(y)))print(Linespace : {}.format(np.linspace(-1,0,5)))def testEMA(self):file_name rD:\lhjytest\demo.csvend_price np.loadtxt(fnamefile_name,delimiter,,usecols(2),unpackTrue)print(end_price)N 5# 权重衰减weighs np.exp(np.linspace(-1,0,N))# 归一化weighs / weighs.sum()print(weighs)# 卷积运算ema np.convolve(weighs,end_price)[N-1:-N1]print(ema)# 均线可视化t np.arange(N-1,len(end_price))plt.plot(t,end_price[N-1:],lw1.0)plt.plot(t,ema,lw2.0)plt.show()
http://www.zqtcl.cn/news/998260/

相关文章:

  • 网站的建立目的来宾网站优化
  • 建设国家游戏网站网站建设规范方案
  • 做网站价位wordpress tag 列表
  • 网站建设 李奥贝纳百度软文推广公司
  • 网站建设流程平台企业微信开发者文档
  • 唐山建设网站的网站青海网站建设企业
  • 北京企业建站系统模板网站建设公司专业网站科技开发
  • 工商注册在哪个网站手机浏览器网站开发
  • 建设电影网站的目的各个国家的google网站
  • centos 网站搭建中国互联网协会调解中心
  • 手机端视频网站模板下载做单页网站需要做什么的
  • 太原网站建设外包中国做乱的小说网站
  • 青海做网站哪家好旅游网站的功能及建设
  • 百度网站优化工具汉川网页设计
  • 网站标签优化怎么做可以看图片的地图什么软件
  • 品牌网站建设9小蝌蚪9wordpress会务网站模版
  • 免费推广网站入口202网页与网站建设
  • 武夷山市网站建设网站标签制作
  • 广州网站定制开发方案河南省新闻发布会直播
  • 普陀网站建设哪家便宜网站建设辶金手指排名十五
  • 网站怎么做百度百科租房网站开发视频教程
  • 动态做网站做自己的网站不是免费的
  • 小学校园门户网站建设方案宁波seo软件
  • 想自己做网站做推广从哪些方面进行网站建设
  • 北京南站在哪个区哪个街道html表白简单代码
  • 海口网站建设流程郑州三牛网站建设
  • 谁有国外hs网站沈阳关键字优化公司
  • wordpress双站企业品牌类网站
  • 网站架构软件做淘客app要网站吗
  • 云南云桥建设股份有限公司官方网站汽车seo是什么意思