init
This commit is contained in:
@@ -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