init
This commit is contained in:
@@ -207,7 +207,7 @@ class BuySellChecker:
|
|||||||
##########################
|
##########################
|
||||||
if i < 40:
|
if i < 40:
|
||||||
if data["low"][i] < data["lower"][i]+5:
|
if data["low"][i] < data["lower"][i]+5:
|
||||||
if data["slow_k"][i-1] < 40 and data["slow_k"][i] < 45:
|
if data["slow_k"][i-1] < 50 and data["slow_k"][i] < 55:
|
||||||
if data["slow_k"][i-1] < data["slow_d"][i-1] and data["slow_d"][i] < data["slow_k"][i] and data["slow_k"][i-1] < data["slow_k"][i]:
|
if data["slow_k"][i-1] < data["slow_d"][i-1] and data["slow_d"][i] < data["slow_k"][i] and data["slow_k"][i-1] < data["slow_k"][i]:
|
||||||
buy = data["low"][i]
|
buy = data["low"][i]
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ class HTS_252670:
|
|||||||
|
|
||||||
def all_stocks(self):
|
def all_stocks(self):
|
||||||
# 종목코드 리스트 구하기
|
# 종목코드 리스트 구하기
|
||||||
|
|
||||||
self.objCpCodeMgr = win32com.client.Dispatch("CpUtil.CpCodeMgr")
|
self.objCpCodeMgr = win32com.client.Dispatch("CpUtil.CpCodeMgr")
|
||||||
codeList = self.objCpCodeMgr.GetStockListByMarket(1) # 거래소
|
codeList = self.objCpCodeMgr.GetStockListByMarket(1) # 거래소
|
||||||
codeList2 = self.objCpCodeMgr.GetStockListByMarket(2) # 코스닥
|
codeList2 = self.objCpCodeMgr.GetStockListByMarket(2) # 코스닥
|
||||||
@@ -482,9 +481,9 @@ class HTS_252670:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
open = objStockChart.GetDataValue(2, i)
|
open = objStockChart.GetDataValue(2, i)
|
||||||
|
close = objStockChart.GetDataValue(5, i)
|
||||||
high = objStockChart.GetDataValue(3, i)
|
high = objStockChart.GetDataValue(3, i)
|
||||||
low = objStockChart.GetDataValue(4, i)
|
low = objStockChart.GetDataValue(4, i)
|
||||||
close = objStockChart.GetDataValue(5, i)
|
|
||||||
vol = objStockChart.GetDataValue(6, i)
|
vol = objStockChart.GetDataValue(6, i)
|
||||||
|
|
||||||
if len(result["check"]) == 0:
|
if len(result["check"]) == 0:
|
||||||
@@ -521,7 +520,6 @@ class HTS_252670:
|
|||||||
return -1, -1, -1
|
return -1, -1, -1
|
||||||
|
|
||||||
buy, weight, sell = self.buySellChecker.getPriceAndWeight1(data, i)
|
buy, weight, sell = self.buySellChecker.getPriceAndWeight1(data, i)
|
||||||
#buy, weight, sell = self.buySellChecker.getPriceAndWeight_1minute(data, i)
|
|
||||||
return buy, weight, sell
|
return buy, weight, sell
|
||||||
|
|
||||||
def getSellingPrice(self, final_price):
|
def getSellingPrice(self, final_price):
|
||||||
@@ -551,7 +549,7 @@ class HTS_252670:
|
|||||||
|
|
||||||
def buyRealTime(self, GIVEN_DAY):
|
def buyRealTime(self, GIVEN_DAY):
|
||||||
orderChecker = OrderChecker(self.stock_code)
|
orderChecker = OrderChecker(self.stock_code)
|
||||||
BASE_COUNT = 190
|
BASE_COUNT = 100
|
||||||
|
|
||||||
timecheckList = pd.read_csv("timecheck.csv").values.tolist()
|
timecheckList = pd.read_csv("timecheck.csv").values.tolist()
|
||||||
timecheck = {GIVEN_DAY + " " + str(second).zfill(6):False for second, check in timecheckList}
|
timecheck = {GIVEN_DAY + " " + str(second).zfill(6):False for second, check in timecheckList}
|
||||||
@@ -619,12 +617,10 @@ class HTS_252670:
|
|||||||
print("SELL", THIS_TIME.strftime('%Y%m%d %H%M%S'), selling_count, selling_price, len(orderListToCancel), len(ORDER_LIST))
|
print("SELL", THIS_TIME.strftime('%Y%m%d %H%M%S'), selling_count, selling_price, len(orderListToCancel), len(ORDER_LIST))
|
||||||
"""
|
"""
|
||||||
# 로그 출력
|
# 로그 출력
|
||||||
print("TIMECHECK: %s, price: %d, \n\t\t\topen: %d, close: %d, low: %d, high: %d, lower: %.2f, upper: %.2f, \n\t\t\tavg2: %.2f, avg3: %.2f, avg5: %.2f, \n\t\t\tslow_k_1: %.2f, slow_k: %.2f, slow_d_1: %.2f, slow_d: %.2f, \n\t\t\trsi_1: %.2f, rsis_1: %.2f, rsi: %.2f, rsis: %.2f" %
|
print("TIMECHECK: %s, price: %d, low: %d, lower: %.2f, avg5: %.2f, slow_k_1: %.2f, slow_d_1: %.2f, slow_k: %.2f, slow_d: %.2f, rsi: %.2f, rsis: %.2f" %
|
||||||
(str(THIS_TIME), final_price,
|
(str(THIS_TIME), final_price, data["low"][data_size-1], data["lower"][data_size-1], data["avg5"][data_size-1],
|
||||||
data["open"][data_size-1], data["close"][data_size-1], data["low"][data_size-1], data["high"][data_size-1], data["lower"][data_size-1], data["upper"][data_size-1],
|
data["slow_k"][data_size-2], data["slow_d"][data_size-2], data["slow_k"][data_size-1], data["slow_d"][data_size-1],
|
||||||
data["avg2"][data_size-1], data["avg3"][data_size-1], data["avg5"][data_size-1],
|
data["rsi"][data_size-1], data["rsis"][data_size-1]))
|
||||||
data["slow_k"][data_size-2], data["slow_k"][data_size-1], data["slow_d"][data_size-2], data["slow_d"][data_size-1],
|
|
||||||
data["rsi"][data_size-2], data["rsis"][data_size-2], data["rsi"][data_size-1], data["rsis"][data_size-1]))
|
|
||||||
timecheck[THIS_TIME] = True
|
timecheck[THIS_TIME] = True
|
||||||
"""
|
"""
|
||||||
if datetime.strptime(GIVEN_DAY + " 151530", '%Y%m%d %H%M%S') < THIS_TIME:
|
if datetime.strptime(GIVEN_DAY + " 151530", '%Y%m%d %H%M%S') < THIS_TIME:
|
||||||
@@ -664,7 +660,7 @@ if __name__ == "__main__":
|
|||||||
hts = HTS_252670(stock_code)
|
hts = HTS_252670(stock_code)
|
||||||
given_day = datetime.today().strftime('%Y%m%d')
|
given_day = datetime.today().strftime('%Y%m%d')
|
||||||
|
|
||||||
#hts.writeStockData(stock_code, "20220421")
|
#hts.writeStockData(stock_code, "20220520")
|
||||||
hts.buyRealTime(given_day)
|
hts.buyRealTime(given_day)
|
||||||
|
|
||||||
print ("done...")
|
print ("done...")
|
||||||
|
|||||||
Reference in New Issue
Block a user