init
This commit is contained in:
@@ -491,6 +491,8 @@ class HTS:
|
|||||||
return
|
return
|
||||||
|
|
||||||
def buyRealTime(self, stock_code, given_day):
|
def buyRealTime(self, stock_code, given_day):
|
||||||
|
logFp = open(given_day+".log", "w")
|
||||||
|
|
||||||
timecheckList = pd.read_csv("timecheck.csv").values.tolist()
|
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}
|
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]:
|
if second in timecheck and not timecheck[second]:
|
||||||
print("TIMECHECK", second)
|
print("TIMECHECK", second)
|
||||||
|
logFp.write("%s,%s,\n" %("TIMECHECK", second))
|
||||||
|
logFp.flush()
|
||||||
|
|
||||||
# 데이터를 가지고 온다.
|
# 데이터를 가지고 온다.
|
||||||
self.getRealTime(stock_code, given_day, result)
|
self.getRealTime(stock_code, given_day, result)
|
||||||
@@ -523,6 +527,8 @@ class HTS:
|
|||||||
# 매수신청과 5원 높여서 매도신청
|
# 매수신청과 5원 높여서 매도신청
|
||||||
if price > 0:
|
if price > 0:
|
||||||
print("BUY", second, price)
|
print("BUY", second, price)
|
||||||
|
logFp.write("%s,%s, %d\n" % ("BUY", second, price))
|
||||||
|
logFp.flush()
|
||||||
|
|
||||||
count = 3
|
count = 3
|
||||||
self.orderToBuy(stock_code, count, price)
|
self.orderToBuy(stock_code, count, price)
|
||||||
@@ -535,9 +541,12 @@ class HTS:
|
|||||||
timecheck[second] = True
|
timecheck[second] = True
|
||||||
else:
|
else:
|
||||||
print("NONE", second)
|
print("NONE", second)
|
||||||
|
logFp.write("%s,%s,\n" % ("NONE", second))
|
||||||
|
logFp.flush()
|
||||||
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
logFp.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user