Initial commit

This commit is contained in:
jackyu66git
2025-04-22 10:04:30 +08:00
commit 626d3a6f26
43 changed files with 8607 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
import copy
from typing import Dict, Optional
from ChanEnum import Chan_FX_TYPE, Chan_KLINE_DIR, Chan_SEG_DIR
import ChanKLU
import ChanCTime
from ChanBI import ChanBI
class ChanSEG():
def __init__(self, start_bi: ChanBI, index, ddir=Chan_SEG_DIR.UP):
self.start_bi = start_bi
self.end_bi = None
self.dir = ddir
self.low = 0
self.high = 0
if self.dir == Chan_SEG_DIR.UP and start_bi:
self.low = start_bi.low
else:
if start_bi:
self.high = start_bi.high
self.index = index
self.pre = None
self.next = None
self.bi_list = []
self.bi_list.append(start_bi)
self.is_sure = False
self.sure_time = None
self.macd_hist = 0
self.macd_div = 0
def set_macd_hist(self, macd_hist):
self.macd_hist = macd_hist
def set_macd_div(self, macd_div):
self.macd_div = macd_div
def set_end_bi(self, bi: ChanBI, sure_bi: ChanBI):
self.end_bi = bi
if bi:
if self.dir == Chan_SEG_DIR.UP:
self.high = bi.high
else:
self.low = bi.low
self.is_sure = True
if sure_bi.is_sure:
self.sure_time = sure_bi.end_klc.end_time
def pre_set_end_bi(self, bi: ChanBI):
self.end_bi = bi
if bi:
if self.dir == Chan_SEG_DIR.UP:
self.high = bi.high
else:
self.low = bi.low
def set_pre(self, seg):
self.pre = seg
def set_next(self, seg):
self.next = seg
def set_sure(self, sure_bi):
if sure_bi.is_sure:
self.sure_time = sure_bi.end_klc.end_time
self.is_sure = True
def add_bi(self, bi: ChanBI):
if len(self.bi_list) > 1:
self.bi_list.append(bi)