Add files
Add first batch of files
This commit is contained in:
+42
-1
@@ -148,7 +148,7 @@ class ChanLun():
|
||||
state_list.append("00")
|
||||
return state_list
|
||||
def get_bi_list(self, dataframe):
|
||||
bi_list, klc_list = self.cal_bi_list(self.get_klc_list(dataframe))
|
||||
bi_list = self.cal_bi_list(self.get_klc_list(dataframe))
|
||||
return bi_list
|
||||
def calculate_zs(self, bi_list, seg_list):
|
||||
return self.get_zs_list(bi_list, seg_list)
|
||||
@@ -528,6 +528,9 @@ class ChanLun():
|
||||
# Do nothing
|
||||
if fx == Chan_FX_TYPE.UNKNOWN:
|
||||
klc.set_fx(Chan_FX_TYPE.UNKNOWN)
|
||||
if len(bi_list) > 0:
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
else:
|
||||
if fx == Chan_FX_TYPE.TOP:
|
||||
if last_top:
|
||||
@@ -538,6 +541,8 @@ class ChanLun():
|
||||
if last_top.high > klc.high:
|
||||
klc.set_fx(Chan_FX_TYPE.TT)
|
||||
klc.set_state("20")
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
#print(klc.start_time, klc.fx, "二类买卖点Sell 1")
|
||||
else:
|
||||
# A new top found
|
||||
@@ -545,12 +550,16 @@ class ChanLun():
|
||||
last_top = klc
|
||||
#print(klc.start_time, klc.fx, "一类买卖点Sell 1")
|
||||
klc.set_state("10")
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
else:
|
||||
# 不满足结合律的分型
|
||||
if last_bottom.index + 4 > klc.index:
|
||||
if last_top.high > klc.high:
|
||||
#print(klc.start_time, last_bottom.start_time, klc.fx, "中枢买卖点Sell 1")
|
||||
klc.set_fx(Chan_FX_TYPE.UNKNOWN)
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
# New TOP Found replace last top
|
||||
else:
|
||||
if last_top.index + 4 < klc.index and len(bi_list) > 1:
|
||||
@@ -565,8 +574,12 @@ class ChanLun():
|
||||
last_bottom = pre_last_bi.start_klc
|
||||
#print(klc.start_time, last_bi.start_klc.start_time, "New TOP Found reset last bi")
|
||||
klc.set_state("10")
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
else:
|
||||
klc.set_fx(Chan_FX_TYPE.UNKNOWN)
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
#print(klc.start_time, last_bottom.start_time, klc.fx, "中枢买卖点Sell 2")
|
||||
# 满足结合律
|
||||
else:
|
||||
@@ -581,6 +594,8 @@ class ChanLun():
|
||||
bi_list.append(bi)
|
||||
last_top = klc
|
||||
klc.set_state('30')
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
#print(klc.start_time, last_bottom.start_time, "Normal TOP Found, Confirm down bi 4")
|
||||
# last bottom = None
|
||||
else:
|
||||
@@ -589,10 +604,14 @@ class ChanLun():
|
||||
last_bi.set_start_klc(klc, Chan_BI_DIR.DOWN)
|
||||
#last_top.set_fx(Chan_FX_TYPE.UNKNOWN)
|
||||
last_top = klc
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
else:
|
||||
klc.set_fx(Chan_FX_TYPE.TT)
|
||||
klc.set_state('20')
|
||||
#print(klc.start_time, klc.fx, "二类买卖点Sell 2")
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
else:
|
||||
if last_bottom:
|
||||
# 不满足结合律的分型
|
||||
@@ -618,6 +637,8 @@ class ChanLun():
|
||||
if last_bottom.low < klc.low:
|
||||
klc.set_fx(Chan_FX_TYPE.BB)
|
||||
klc.set_state("-20")
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
#print(klc.start_time, klc.fx, "二类买卖点Buy 1")
|
||||
else:
|
||||
# A new bottom found
|
||||
@@ -625,6 +646,8 @@ class ChanLun():
|
||||
last_bottom = klc
|
||||
#print(klc.start_time, klc.fx, "一类买卖点Buy 1")
|
||||
klc.set_state("-10")
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
else:
|
||||
# 不满足结合律的分型
|
||||
if last_top.index + 4 > klc.index:
|
||||
@@ -633,6 +656,8 @@ class ChanLun():
|
||||
#klc.set_fx(Chan_FX_TYPE.BB)
|
||||
#klc.set_state("-100")
|
||||
#print(klc.start_time, klc.fx, "中枢买卖点Buy 1")
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
# Found new bottom
|
||||
else:
|
||||
if last_bottom.index + 4 < klc.index and len(bi_list) > 1:
|
||||
@@ -647,8 +672,12 @@ class ChanLun():
|
||||
last_top = pre_last_bi.start_klc
|
||||
#print(klc.start_time, last_bi.start_klc.start_time, "New BOTTOM Found reset last bi")
|
||||
klc.set_state("-10")
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
else:
|
||||
klc.set_fx(Chan_FX_TYPE.UNKNOWN)
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
#print(klc.start_time, klc.fx, "中枢买卖点Buy 2")
|
||||
# 满足结合律的分型
|
||||
else:
|
||||
@@ -663,6 +692,8 @@ class ChanLun():
|
||||
bi_list.append(bi)
|
||||
last_bottom = klc
|
||||
klc.set_state('-30')
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
#print(klc.start_time, last_top.start_time, "Normal Bottom Found, Confirm up bi 6")
|
||||
# last_top = None
|
||||
else:
|
||||
@@ -671,25 +702,35 @@ class ChanLun():
|
||||
last_bi.set_start_klc(klc, Chan_BI_DIR.UP)
|
||||
#last_bottom.set_fx(Chan_FX_TYPE.UNKNOWN)
|
||||
last_bottom = klc
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
else:
|
||||
klc.set_fx(Chan_FX_TYPE.BB)
|
||||
klc.set_state('-20')
|
||||
#print(klc.start_time, klc.fx, "二类买卖点Buy 2")
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
# last_bottom = None
|
||||
else:
|
||||
if last_top:
|
||||
# 不满足结合律的分型
|
||||
if last_top.index + 4 > klc.index:
|
||||
klc.set_fx(Chan_FX_TYPE.UNKNOWN)
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
else:
|
||||
# First temp bottom and last top confirmed
|
||||
last_bottom = klc
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
# Last top = None, last bottom = None, create first up bi
|
||||
else:
|
||||
# First temp bottom and no top yet
|
||||
last_bottom = klc
|
||||
bi = ChanBI(klc, len(bi_list), Chan_BI_DIR.UP)
|
||||
bi_list.append(bi)
|
||||
bi_list[-1].add_klc(klc)
|
||||
klc.set_bi(bi_list[-1])
|
||||
#print(klc.start_time, 'Create first bottom')
|
||||
#print(klc.time, klc.fx, klc.state)
|
||||
for klc in klc_list:
|
||||
|
||||
Reference in New Issue
Block a user