try except deletion
This commit is contained in:
@@ -550,7 +550,7 @@ class HTS_122630:
|
||||
BASE_COUNT = 10
|
||||
|
||||
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}
|
||||
|
||||
result = {"check": set(),
|
||||
"time": [],
|
||||
@@ -561,7 +561,7 @@ class HTS_122630:
|
||||
"vol": []}
|
||||
|
||||
final_price = 0
|
||||
print("START...")
|
||||
print ("START...")
|
||||
THIS_TIME = datetime.now()
|
||||
while datetime.strptime(GIVEN_DAY + " 070000", '%Y%m%d %H%M%S') < THIS_TIME < datetime.strptime(GIVEN_DAY + " 15200", '%Y%m%d %H%M%S'):
|
||||
|
||||
@@ -576,15 +576,15 @@ class HTS_122630:
|
||||
# 사야 할 시점/가격과 팔아야 할 시점/가격을 체크한다.
|
||||
bs_buy_price, bs_weight, bs_sell_price = self.checkTransaction(data)
|
||||
data_size = len(data["close"])
|
||||
final_price = data["close"][data_size - 1]
|
||||
final_price = data["close"][data_size-1]
|
||||
|
||||
if bs_buy_price > 0:
|
||||
# 기본 100 주에 가중치를 추가해서 매수한다.
|
||||
# BUY_COUNT = int(BASE_COUNT * bs_weight)
|
||||
#BUY_COUNT = int(BASE_COUNT * bs_weight)
|
||||
BUY_COUNT = int(BASE_COUNT * 1)
|
||||
|
||||
# 매수를 주문한다.
|
||||
orderNum = self.requestOrder(OrderType.buy, stock_code, BUY_COUNT, bs_buy_price)
|
||||
orderNum = self.requestOrder(OrderType.buy, stock_code, BUY_COUNT , bs_buy_price)
|
||||
|
||||
# 미체결 기록을 가져온다.
|
||||
ORDER_LIST = self.requestOrderList()
|
||||
@@ -614,7 +614,7 @@ class HTS_122630:
|
||||
print("SELL", THIS_TIME.strftime('%Y%m%d %H%M%S'), selling_count, selling_price, len(orderListToCancel), len(ORDER_LIST))
|
||||
|
||||
# 로그 출력
|
||||
print("TIMECHECK", THIS_TIME, final_price, data["low"][data_size - 1], data["slow_k"][data_size - 1], data["slow_d"][data_size - 1])
|
||||
print("TIMECHECK", THIS_TIME, final_price, data["low"][data_size-1], data["slow_k"][data_size-1], data["slow_d"][data_size-1])
|
||||
timecheck[THIS_TIME] = True
|
||||
|
||||
if datetime.strptime(GIVEN_DAY + " 151530", '%Y%m%d %H%M%S') < THIS_TIME:
|
||||
@@ -648,12 +648,12 @@ if __name__ == "__main__":
|
||||
PROJECT_HOME = os.path.join(os.path.dirname(os.path.join(os.path.dirname(__file__))))
|
||||
RESOURCE_DIR = PROJECT_HOME + "/resources/analysis/"+today.strftime("%Y%m%d")
|
||||
|
||||
# KODEX 레버리지
|
||||
# KODEX 인버스 * 2
|
||||
hts = HTS_122630()
|
||||
stock_codes = ["122630"]
|
||||
given_day = datetime.today().strftime('%Y%m%d')
|
||||
|
||||
hts.writeStockData(stock_codes, "20211022")
|
||||
#hts.buyRealTime(stock_codes[0], given_day)
|
||||
#hts.writeStockData(stock_codes, "20211025")
|
||||
hts.buyRealTime(stock_codes[0], given_day)
|
||||
|
||||
print ("done...")
|
||||
|
||||
Reference in New Issue
Block a user