如果有以前取得的数据,就可以利用这些数据进行股票分析。 (请通过breaksoftware的csdn博客指定转载)
为了便于计算,我们决定引入numpy库
pipinstallnumpy-I http://pypi.douban.com/simple其实这篇文章正好不能告诉你有用的样品。 因为以前分析说同花顺等分析软件的公式有很多弊端,不能满足我们复杂的需要。 我没有保证利润的非常准确的模型。
举个简单的例子吧。 只是个假设。 如果30日平均线高于5日平均线,就不在我们的考虑范围内。
首先获取股票一个周期的信息
def_get_average_info(self,share_id,table_name,period=0) : stock _ conn _ manager _ obj=stock 120 ) types=['close_ma ',' volume_ma'] columns=['time ',' today_close ',' today_high ',' today ' ' turnover'] fortype _ itemintypes 3360 for period _ iteminperiods 3360 column_name=period _ item (columns.append ) column _ name ) tr=' % sli ion period (data=fetch _ data.get _ data (fetch _ data.select _ db ) Conn_name,table_name,cole extend=extend _ str (infos=[ ] fordata _ item in data 3360info={ } forindexinrange (len (columns ) ) 3360 info ) coludem
today _ close _ ma5 _ info=self._ get _ history _ data (data,index,0, ' close _ ma5 ' (today _ close _ ma 100 ) ) today _ close _ ma10 ' (today _ close _ ma20 _ info=' close_ma30 ' ) today _ close _ ma60 _ info=self._ get _ history _ data (data,index,0, ' close_ma60 ' ) today _ close _ ma5=today _ close _ ma5 _ info [1] today _ close _ ma10=today _ close _ ma1110
if today _ close _ ma30 today _ close _ ma20 and today _ close _ ma30 today _ close _ ma10 and today _ close _ ma30 today _ ma30 tod
当然,我不否认没有适当列举这个例子。 因为需求很简单,所以同样的花顺式也可以做。
但是,有了所有的数据,我们可以做很多。 包含同花顺所没有的“模型重测”功能。
这个项目是去年写的。 我试着运行了一个多月,发现系统非常稳定。 之后,由于各种各样的理由,没能马上追加相关说明。
为了补充这些博文,我重新审视了系统。 虽然还有很多不完善的地方,但一般不是特别要求的生产环境可以放心使用。
最后,附加git地址https://github.com/f 304646673/scheduler _ frame.git。