This commit is contained in:
dsyoon
2023-01-24 22:50:43 +09:00
parent 33a131ca43
commit 1827d6d8d1

View File

@@ -13,8 +13,6 @@ from hts.OrderChecker import OrderChecker
class HTS_DAILY (HTS): class HTS_DAILY (HTS):
RESOURCE_PATH = None RESOURCE_PATH = None
stock_code = None
buy_count = None
orderChecker = None orderChecker = None
buySellChecker = None buySellChecker = None
labelChecker = None labelChecker = None
@@ -44,20 +42,21 @@ class HTS_DAILY (HTS):
jangoDic = self.requstJango() jangoDic = self.requstJango()
if jangoDic and len(jangoDic.keys()) > 0: if jangoDic and len(jangoDic.keys()) > 0:
for code in jangoDic: for code in jangoDic:
if jangoDic[code]['매도가능'] > 0: if code == "A" + stock_code:
if check: if jangoDic[code]['매도가능'] > 0:
if jangoDic[code]['장부가']*0.05 < jangoDic[code]['장부가'] - final_price: if check:
sell_price = jangoDic[code]['장부가'] if jangoDic[code]['장부가']*0.05 < jangoDic[code]['장부가'] - final_price:
if code == "A" + stock_code: sell_price = jangoDic[code]['장부가']
orderNum = self.requestOrder(OrderType.sell, stock_code, jangoDic[code]['매도가능'], sell_price) orderNum = self.requestOrder(OrderType.sell, stock_code, jangoDic[code]['매도가능'], sell_price)
print("ORDER_SELL", stock_code, log_time.strftime('%Y%m%d %H%M%S'), jangoDic[code]['매도가능'], sell_price) print("ORDER_SELL", stock_code, log_time.strftime('%Y%m%d %H%M%S'), jangoDic[code]['매도가능'], sell_price)
else: else:
#max_price = max(jangoDic[code]['장부가'], final_price) #max_price = max(jangoDic[code]['장부가'], final_price)
# 10% 이상 수익이어야 매도한다. # 10% 이상 수익이어야 매도한다.
max_price = int(jangoDic[code]['장부가'] * 1.10) max_price = int(jangoDic[code]['장부가'] * 1.10)
if max_price <= final_price: if max_price <= final_price:
sell_price = (int(max_price) - int(max_price) % 5) sell_price = (int(max_price) - int(max_price) % 5)
if code == "A"+stock_code:
orderNum = self.requestOrder(OrderType.sell, stock_code, jangoDic[code]['매도가능'], sell_price) orderNum = self.requestOrder(OrderType.sell, stock_code, jangoDic[code]['매도가능'], sell_price)
print("ORDER_SELL", stock_code, log_time.strftime('%Y%m%d %H%M%S'), jangoDic[code]['매도가능'], sell_price) print("ORDER_SELL", stock_code, log_time.strftime('%Y%m%d %H%M%S'), jangoDic[code]['매도가능'], sell_price)
return orderNum return orderNum
@@ -140,7 +139,7 @@ class HTS_DAILY (HTS):
last_index = len(bsLine['sell']) - 1 last_index = len(bsLine['sell']) - 1
if bsLine['sell'][last_index] > 0: if bsLine['sell'][last_index] > 0:
bs_sell_price = bsLine['sell'][last_index] bs_sell_price = bsLine['sell'][last_index]
orderNum = self.getSellingPrice(THIS_TIME, self.stock_code, bs_sell_price) orderNum = self.getSellingPrice(THIS_TIME, stock_code, bs_sell_price)
self.orderChecker.delete(today, stock_code) self.orderChecker.delete(today, stock_code)
# 로그 출력 # 로그 출력