用Python求均值与方差,可以自己写,也可以借助于numpy,不过到底哪个快一点呢? 我做了个实验,首先生成9百万个样本: nlist=range(0,9000000) nlist=[float(i)/1000000 for i in nlist] N=len(nlist) 第二行是为了让样本小一点,否则从1加到9百万会溢出的. 自己实现,遍历数组来求均值方差: sum1=0.0 sum2=0.0 for i in range(N): sum1+=nlist[i] sum2+=nlist[i]
from __future__ import print_function # 均值计算 data = [3.53, 3.47, 3.51, 3.72, 3.43] average = float(sum(data))/len(data) print(average) #方差计算 total = 0 for value in data: total += (value - average) ** 2 stddev = math.sqrt(total/len(data)) print(stddev
Python股票数据分析 最近在学习基于python的股票数据分析,其中主要用到了tushare和seaborn.tushare是一款财经类数据接口包,国内的股票数据还是比较全的 官网地址:http://tushare.waditu.com/index.html#id5.seaborn则是一款绘图库,通过seaborn可以轻松地画出简洁漂亮的图表,而且库本身具有一定的统计功能. 导入的模块: import matplotlib.pyplot as plt import seaborn as sn
单策略单品种单策略多品种多策略单品种和加仓多策略多品种静态仓位和动态仓位 金肯特钠(kingKeltner)布林强盗(BollingerBandit)动态突破(DynamicBreakOutII)恒温器(Thermostat)幽灵交易者(ghostTrader) 均线交叉与通道突破相结合的交易策略(Moving Average CrossOver)均线和K线形态的高低点突破系统(Escalator trading system)基于置换均线的二次穿越突破系统(Double your Fun)基于
http://www.guosen.com.cn/gxzq/tradestation/help/operate/operate06.html power language https://seekingalpha-tainan.blogspot.com/2016/10/ifthen.html KOREA http://www.fntec.com/xe/ts/8739 Adaptrade自动策略生成器 http://www.0762jr.com/index.php Ralph Nelson Ell