This commit is contained in:
dosangyoon
2021-09-23 08:49:45 +09:00
parent 130950d764
commit 2781d31ade

View File

@@ -491,6 +491,8 @@ class HTS:
return
def buyRealTime(self, stock_code, given_day):
logFp = open(given_day+".log", "w")
timecheckList = pd.read_csv("timecheck.csv").values.tolist()
timecheck = {datetime.strptime(given_day + " " + str(second).zfill(6), '%Y%m%d %H%M%S'):False for second, check in timecheckList}
@@ -507,6 +509,8 @@ class HTS:
if second in timecheck and not timecheck[second]:
print("TIMECHECK", second)
logFp.write("%s,%s,\n" %("TIMECHECK", second))
logFp.flush()
# 데이터를 가지고 온다.
self.getRealTime(stock_code, given_day, result)
@@ -523,6 +527,8 @@ class HTS:
# 매수신청과 5원 높여서 매도신청
if price > 0:
print("BUY", second, price)
logFp.write("%s,%s, %d\n" % ("BUY", second, price))
logFp.flush()
count = 3
self.orderToBuy(stock_code, count, price)
@@ -535,9 +541,12 @@ class HTS:
timecheck[second] = True
else:
print("NONE", second)
logFp.write("%s,%s,\n" % ("NONE", second))
logFp.flush()
time.sleep(1)
logFp.close()
return
if __name__ == "__main__":