init
This commit is contained in:
31
HTS_etf.py
31
HTS_etf.py
@@ -432,8 +432,16 @@ class HTS_etf(HTS):
|
||||
"limit_bottom_10": {"avg5": None, "avg20": None, "avg60": None, "avg120": None, "avg240": None, "avg480": None, "avg1500": None},
|
||||
"limit_top_20": {"avg5": None, "avg20": None, "avg60": None, "avg120": None, "avg240": None, "avg480": None, "avg1500": None},
|
||||
"limit_bottom_20": {"avg5": None, "avg20": None, "avg60": None, "avg120": None, "avg240": None, "avg480": None, "avg1500": None},
|
||||
"limit_top_50": {"avg5": None, "avg20": None, "avg60": None, "avg120": None, "avg240": None, "avg480": None, "avg1500": None},
|
||||
"limit_bottom_50": {"avg5": None, "avg20": None, "avg60": None, "avg120": None, "avg240": None, "avg480": None, "avg1500": None}
|
||||
"limit_top_20": {"avg5": None, "avg20": None, "avg60": None, "avg120": None, "avg240": None, "avg480": None, "avg1500": None},
|
||||
"limit_bottom_20": {"avg5": None, "avg20": None, "avg60": None, "avg120": None, "avg240": None, "avg480": None, "avg1500": None},
|
||||
"limit_top_20": {"avg5": None, "avg20": None, "avg60": None, "avg120": None, "avg240": None, "avg480": None, "avg1500": None},
|
||||
"limit_bottom_20": {"avg5": None, "avg20": None, "avg60": None, "avg120": None, "avg240": None, "avg480": None, "avg1500": None},
|
||||
"limit_top_30": {"avg5": None, "avg20": None, "avg60": None, "avg120": None, "avg240": None, "avg480": None, "avg1500": None},
|
||||
"limit_bottom_30": {"avg5": None, "avg20": None, "avg60": None, "avg120": None, "avg240": None, "avg480": None, "avg1500": None},
|
||||
"limit_top_40": {"avg5": None, "avg20": None, "avg60": None, "avg120": None, "avg240": None, "avg480": None, "avg1500": None},
|
||||
"limit_bottom_40": {"avg5": None, "avg20": None, "avg60": None, "avg120": None, "avg240": None, "avg480": None, "avg1500": None},
|
||||
"limit_top_99": {"avg5": None, "avg20": None, "avg60": None, "avg120": None, "avg240": None, "avg480": None, "avg1500": None},
|
||||
"limit_bottom_99": {"avg5": None, "avg20": None, "avg60": None, "avg120": None, "avg240": None, "avg480": None, "avg1500": None}
|
||||
}
|
||||
disparity['avg'] = avg
|
||||
disparity_1500 = sorted(list(set(avg['avg1500'])), reverse=True)
|
||||
@@ -444,8 +452,25 @@ class HTS_etf(HTS):
|
||||
disparity_20 = sorted(list(set(avg['avg20'])), reverse=True)
|
||||
disparity_5 = sorted(list(set(avg['avg5'])), reverse=True)
|
||||
|
||||
poses = [1, 3, 5, 10, 20, 50]
|
||||
poses = [1, 3, 5, 10, 20, 30, 40, 99]
|
||||
for pos in poses:
|
||||
if pos == 99:
|
||||
pos = int(len(disparity_20) * 0.03)
|
||||
disparity['limit_top_99']['avg1500'] = disparity_1500[pos - 1]
|
||||
disparity['limit_bottom_99']['avg1500'] = disparity_1500[len(disparity_1500) - pos - 1]
|
||||
disparity['limit_top_99']['avg480'] = disparity_480[pos]
|
||||
disparity['limit_bottom_99']['avg480'] = disparity_480[len(disparity_480) - pos - 1]
|
||||
disparity['limit_top_99']['avg240'] = disparity_240[pos]
|
||||
disparity['limit_bottom_99']['avg240'] = disparity_240[len(disparity_240) - pos - 1]
|
||||
disparity['limit_top_99']['avg120'] = disparity_120[pos]
|
||||
disparity['limit_bottom_99']['avg120'] = disparity_120[len(disparity_120) - pos - 1]
|
||||
disparity['limit_top_99']['avg60'] = disparity_60[pos]
|
||||
disparity['limit_bottom_99']['avg60'] = disparity_60[len(disparity_60) - pos - 1]
|
||||
disparity['limit_top_99']['avg20'] = disparity_20[pos]
|
||||
disparity['limit_bottom_99']['avg20'] = disparity_20[len(disparity_20) - pos - 1]
|
||||
disparity['limit_top_99']['avg5'] = disparity_5[pos]
|
||||
disparity['limit_bottom_99']['avg5'] = disparity_5[len(disparity_5) - pos - 1]
|
||||
else:
|
||||
disparity['limit_top_' + str(pos)]['avg1500'] = disparity_1500[pos - 1]
|
||||
disparity['limit_bottom_' + str(pos)]['avg1500'] = disparity_1500[len(disparity_1500) - pos - 1]
|
||||
disparity['limit_top_' + str(pos)]['avg480'] = disparity_480[pos]
|
||||
|
||||
@@ -178,16 +178,8 @@ class BuySellChecker():
|
||||
check = False
|
||||
if 0 < len(BUY_LIST['buy_list']):
|
||||
|
||||
"""
|
||||
if 1.05 < data['disparity_avg20'][i]:
|
||||
check = True
|
||||
|
||||
if 1.10 < data['disparity_avg480'][i]:
|
||||
check = True
|
||||
|
||||
if 1.15 < data['disparity_avg1500'][i]:
|
||||
check = True
|
||||
"""
|
||||
# 매수한지 3시간 이내라면
|
||||
if data['ymd'][i] - timedelta(hours=3) < BUY_LIST['buy_list'][-1]['buy_ymd']:
|
||||
|
||||
if BUY_LIST['disparity']['limit_top_3']['avg20'] < data['disparity_avg20'][i]:
|
||||
check = True
|
||||
@@ -200,9 +192,21 @@ class BuySellChecker():
|
||||
|
||||
if BUY_LIST['disparity']['limit_top_10']['avg1500'] < data['disparity_avg1500'][i]:
|
||||
check = True
|
||||
else:
|
||||
# 매수한지 3시간 이후라면
|
||||
if BUY_LIST['buy_list'][-1]['buy_price'] * 1.002 < data['close'][i]:
|
||||
|
||||
# if data['avg1500'][i-1] < data['trend_avg'][i-1] and data['trend_avg'][i] <= data['avg1500'][i]:
|
||||
# check = True
|
||||
if BUY_LIST['disparity']['limit_top_99']['avg20'] < data['disparity_avg20'][i]:
|
||||
check = True
|
||||
|
||||
if BUY_LIST['disparity']['limit_top_99']['avg60'] < data['disparity_avg60'][i]:
|
||||
check = True
|
||||
|
||||
if BUY_LIST['disparity']['limit_top_99']['avg480'] < data['disparity_avg480'][i]:
|
||||
check = True
|
||||
|
||||
if BUY_LIST['disparity']['limit_top_99']['avg1500'] < data['disparity_avg1500'][i]:
|
||||
check = True
|
||||
|
||||
if check:
|
||||
sell_price = data['close'][i]
|
||||
|
||||
Reference in New Issue
Block a user