开盘秃阳线和收盘秃阳线及判断方法.

发布于: 雪球转发:0回复:0喜欢:0

“开盘秃阳线”,也称光脚阳线,既只有上影线而无下影线的阳线...
“收盘秃阳线”,也称光头阳线,既只有下影线而无上影线的阳线

众所周知,阳线的定义是:收盘价>开盘价。所以开盘秃阳线就是开盘时最低价的阳线,收盘秃阳线就是收盘价时最高价的阳线,如果时光头光脚的阳线,则又是开盘秃阳线,就是收盘秃阳线。

下面以乐视网为例,找出开盘秃阳线和收盘秃阳线:

代码如下:

import baostock as bs

import pandas as pd

import numpy as np

import matplotlib.pyplot as plt

import datetime

def get_his_k_data(stockcode = 'sh.600000'):

login()

# 详细指标参数,参见“历史行情指标参数”章节

rs = bs.query_history_k_data_plus(stockcode,

"date,code,open,high,low,close,preclose,volume,amount,pctChg",

start_date='2018-01-01', end_date='2018-09-13',

frequency="d", adjustflag="2")

print (rs.error_code)

#### 打印结果集 ####

data_list = []

while (rs.error_code == '0') & rs.next():

# 获取一条记录,将记录合并在一起

data_list.append(rs.get_row_data())

result = pd.DataFrame(data_list, columns=rs.fields)

print (result)

bs.logout()

return result

def find_RedMarubozu(stockcode = 'sh.600000'):

""" 寻找出现的开盘秃阳线和收盘秃阳线 """

hisdata = get_his_k_data(stockcode)

highlist = hisdata['high'].astype('float')

lowlist = hisdata['low'].astype('float')

closelist = hisdata['close'].astype('float')

openlist = hisdata['open'].astype('float')

datelist = hisdata['date']

for i in range(len(datelist)):

if closelist[i] <= openlist[i]:

continue

if lowlist[i] == openlist[i]:

print("%s 是开盘秃阳线,"%datelist[i]),

if highlist[i] == closelist[i]:

print("并且是光头光脚阳线")

if highlist[i] == closelist[i]:

print("%s 是收盘秃阳线"%datelist[i])

if __name__ == '__main__':

# plot_CCI_close_pic('sz.300104')

find_RedMarubozu('sz.300104')


结果如下:

2018-02-08 是开盘秃阳线,

2018-02-22 是收盘秃阳线

2018-03-09 是开盘秃阳线,

2018-03-13 是开盘秃阳线,

并且是光头光脚阳线

2018-03-13 是收盘秃阳线

2018-03-20 是开盘秃阳线,

并且是光头光脚阳线

2018-03-20 是收盘秃阳线

2018-04-17 是收盘秃阳线

2018-04-19 是收盘秃阳线

2018-04-20 是收盘秃阳线

2018-04-27 是开盘秃阳线,

2018-05-10 是开盘秃阳线,

2018-05-17 是开盘秃阳线,

2018-06-06 是收盘秃阳线

2018-06-13 是开盘秃阳线,

2018-07-09 是开盘秃阳线,

2018-07-12 是开盘秃阳线,

2018-07-16 是开盘秃阳线,

2018-08-15 是开盘秃阳线,

2018-08-21 是收盘秃阳线

2018-08-22 是收盘秃阳线

2018-08-30 是收盘秃阳线

2018-09-03 是收盘秃阳线

2018-09-04 是收盘秃阳线

2018-09-05 是开盘秃阳线,

并且是光头光脚阳线

2018-09-05 是收盘秃阳线