init
This commit is contained in:
@@ -181,7 +181,7 @@ class BuySellChecker:
|
||||
if data["open"][i] == data["low"][i] and data["close"][i] == data["high"][i]:
|
||||
if data["close"][i] > max(data["avg3"][i], data["avg5"][i], data["avg10"][i], data["avg20"][i], data["avg30"][i]):
|
||||
buy = data["low"][i]
|
||||
weight = 5
|
||||
weight = 3
|
||||
return self.getBuyCheck(data, i, buy, weight)
|
||||
|
||||
# 만약 30원 이상 장대 양봉이 나온 경우, 다음이나 다다음 중간 값에서 매수를 한다.
|
||||
@@ -279,7 +279,7 @@ class BuySellChecker:
|
||||
if data['avg3'][i-index1-1] < data['avg10'][i-index1-1]:
|
||||
if data["slow_k"][i] < 40:
|
||||
buy = data["close"][i]
|
||||
weight = 5
|
||||
weight = 3
|
||||
return self.getBuyCheck(data, i, buy, weight)
|
||||
|
||||
|
||||
@@ -440,7 +440,7 @@ class BuySellChecker:
|
||||
START_TIME_INDEX = c
|
||||
break
|
||||
|
||||
if i >= START_TIME_INDEX:
|
||||
if i >= START_TIME_INDEX + 60:
|
||||
# 매수 분석
|
||||
|
||||
# 이동선을 이용한 매매
|
||||
|
||||
@@ -152,7 +152,7 @@ class Simulation:
|
||||
|
||||
return
|
||||
|
||||
def simulate(self, days):
|
||||
def simulate(self, days, path=None):
|
||||
result = {"check": set(),
|
||||
"time": [],
|
||||
"open": [],
|
||||
@@ -164,9 +164,12 @@ class Simulation:
|
||||
last_day = days[0]
|
||||
today = days[1]
|
||||
|
||||
if path == None:
|
||||
path = "./hts/data"
|
||||
|
||||
# 데이터를 가지고 온다.
|
||||
self.getCSV("./hts/data/" + self.stock_code + "_" + last_day + ".csv", last_day, result)
|
||||
self.getCSV("./hts/data/" + self.stock_code + "_" + today + ".csv", today, result)
|
||||
self.getCSV(path + "/" + self.stock_code + "_" + last_day + ".csv", last_day, result)
|
||||
self.getCSV(path + "/" + self.stock_code + "_" + today + ".csv", today, result)
|
||||
|
||||
# 분석을 통해서 볼린저밴드 상/하단을 계산한다.
|
||||
data = self.buySellChecker.analyze(result)
|
||||
@@ -216,16 +219,17 @@ if __name__ == "__main__":
|
||||
}
|
||||
"""
|
||||
|
||||
fileList = glob('./hts/backup/252670_*.csv')
|
||||
fileList = sorted(fileList)
|
||||
stock_codes = {'252670':[]}
|
||||
for i in range(1, 11):
|
||||
stock_codes['252670'].append((fileList[i-1][20:28], fileList[i][20:28]))
|
||||
path = './hts/backup'
|
||||
fileList = glob(path + '/122630*.csv')
|
||||
fileList = sorted(fileList, reverse=True)
|
||||
stock_codes = {'122630':[]}
|
||||
for i in range(11, 21):
|
||||
stock_codes['122630'].append((fileList[i][20:28], fileList[i-1][20:28]))
|
||||
|
||||
for stock_code in stock_codes:
|
||||
simulation = Simulation(stock_code)
|
||||
|
||||
for given_day in stock_codes[stock_code]:
|
||||
simulation.simulate(given_day)
|
||||
simulation.simulate(given_day, path)
|
||||
|
||||
print ("done...")
|
||||
|
||||
Reference in New Issue
Block a user