使用python进行股票分析
目录
- 使用python进行股票分析
- 数据获取
- 数据分析
- 量价关系
- 底部盘整止跌企稳
数据获取
数据获取可以看前一篇文章,各大股票开放接口介绍
数据分析
量价关系
当股价缩量回调时,我们需要进行关注,但是如何找出类似的股票呢,可以通过python自己分析,如下:
下面展示一些 分析代码片段
。
for k,v in query_datas.items():if len(v) <= 5:continuetoday_inc = (v[0]['price_end'] - v[1]['price_end']) / v[1]['price_end']today_inc_real = v[0]['price_end'] - v[0]['price_begin']yesterday_inc = (v[1]['price_end'] - v[2]['price_end']) / v[2]['price_end']yesterday_inc_real = v[1]['price_end'] - v[1]['price_begin']yesterday_yes_inc = (v[2]['price_end'] - v[3]['price_end']) / v[3]['price_end']yesterday_yes_inc_real = v[2]['price_end'] - v[2]['price_begin']yesterday_yes_yes_inc = (v[3]['price_end'] - v[4]['price_end']) / v[4]['price_end']yesterday_yes_yes_inc_real = v[3]['price_end'] - v[3]['price_begin']yesterday_yes_yes_yes_inc = (v[4]['price_end'] - v[5]['price_end']) / v[5]['price_end']yesterday_yes_yes_yes_inc_real = v[4]['price_end'] - v[4]['price_begin']if v[0]['sales'] and v[1]['sales'] and round(max(v[0]['sales'], v[1]['sales'])/min(v[0]['sales'], v[1]['sales'])) > 4:continueif v[1]['sales'] and v[2]['sales'] and round(max(v[1]['sales'], v[2]['sales'])/min(v[1]['sales'], v[2]['sales'])) > 4:continue_tmp_list = []for _i in range(len(v)):_tmp_list.append(v[_i]['price_end'])if abs(today_inc) < 0.06 and (yesterday_inc > today_inc or yesterday_yes_inc > today_inc or yesterday_yes_yes_inc > today_inc):w = max(_cal_sales(v[0]['sales'], v[1]['sales']), _cal_sales(v[0]['sales'], v[2]['sales']), _cal_sales(v[0]['sales'], v[3]['sales']), _cal_sales(v[0]['sales'], v[4]['sales']))if w > 1:datas_dict.update({k: {"stock_id": k,"price_end": v[0]['price_end'],"weight": w,"is_up": 0}})
可以找到如下的形态的股票:
底部盘整止跌企稳
当股价缩量回调时,回调一段时间之后,会出现底部盘整形态,盘整一段时候,则有上冲上方均价线压力尝试,那么可以加入到关注中,后续可以重点关注一下,通过python分析,可以发下大概如下形态的股票:
通过分析出来的股票还可以通过微信、邮箱等推送到个人的通信工具中,简直太方面了。