This commit is contained in:
dsyoon
2022-08-02 23:43:47 +09:00
parent a357efc803
commit e3595ea4d0

View File

@@ -27,23 +27,40 @@ class LabelMaker (HTS):
bsLine['sell'] = [-1 for i in range(size)]
bsLine['sell_weight'] = [-1 for i in range(size)]
p_min_price = 999999999
p_max_price = 999999999
for i in range(size-60):
min_price, min_price_c, max_price, max_price_c = 9999999, -1, 0, -1
for c in range(i, i+60):
if min(data["close"][c], data["close"][c]) < min_price:
min_price = min(data["close"][c], data["close"][c])
min_price_c = c
if max(data["close"][c], data["close"][c]) > max_price:
max_price = max(data["close"][c], data["close"][c])
max_price_c = c
if min(data["close"][c], data["close"][c]) < min_price:
min_price = data["close"][c]
min_price_c = c
if min_price_c > 0:
isValid = True
for c in range(2, 10):
if bsLine['buy'][min_price_c - c] > 0:
isValid = False
break
if isValid:
if min_price < p_min_price:
bsLine['buy'][min_price_c] = min_price
bsLine['buy_weight'][min_price_c] = 1
if max_price_c > 0:
p_min_price = min_price
if max_price_c > 0 and bsLine['buy'][max_price_c-2] < 0:
isValid = True
for c in range(2, 10):
if bsLine['buy'][max_price_c - c] > 0:
isValid = False
break
if isValid:
if max_price > p_max_price:
bsLine['sell'][max_price_c] = max_price
bsLine['sell_weight'][min_price_c] = 1
bsLine['sell_weight'][max_price_c] = 1
p_max_price = max_price
return bsLine, data
def draw_simple(self, stock_code, given_day, data, bsLine):
@@ -220,4 +237,4 @@ if __name__ == "__main__":
stock_code = "252670"
#stock_code = "122630"
labelMaker.makeCandidate(stock_code, "20220802")
labelMaker.makeCandidate(stock_code, "20220801")