This commit is contained in:
dsyoon
2021-10-13 20:43:29 +09:00
parent b60036d611
commit cd44ca3d63

View File

@@ -1014,7 +1014,7 @@ class HTS:
def buyRealTime(self, stock_code, given_day):
PREVIOUS_PRICE = 0
BUY_COUNT = 130
BUY_COUNT = 200
timecheckList = pd.read_csv("timecheck.csv").values.tolist()
timecheck = {given_day + " " + str(second).zfill(6):False for second, check in timecheckList}
@@ -1049,28 +1049,27 @@ class HTS:
if bs_buy_price > 0:
if PREVIOUS_PRICE > 0:
if PREVIOUS_PRICE > bs_buy_price:
if BUY_COUNT > 170:
BUY_COUNT = 170
if BUY_COUNT < 70:
BUY_COUNT = 70
if BUY_COUNT > 240:
BUY_COUNT = 240
if BUY_COUNT < 140:
BUY_COUNT = 140
BUY_COUNT += 10
elif PREVIOUS_PRICE < bs_buy_price:
if BUY_COUNT > 180:
BUY_COUNT = 180
if BUY_COUNT < 90:
BUY_COUNT = 90
if BUY_COUNT > 260:
BUY_COUNT = 260
if BUY_COUNT < 160:
BUY_COUNT = 160
BUY_COUNT -= 10
PREVIOUS_PRICE = bs_buy_price
# 매수 주문
# 매수 전에 모든 미체결을 취소한다.
self.cancelOrderList()
# 현재까지 매입금액이 7백만원 이하일 때만 매수를 한다.
self.requestOrder("2", stock_code, BUY_COUNT , bs_buy_price)
print("BUY", second, bs_buy_price)
if bs_sell_price > 0:
# 매도 전에 모든 미체결을 취소한다.
self.cancelOrderList()
# 매도 가격을 가져온다.
selling_count, selling_price = self.getSellingPrice(final_price)
# 분석되 가격으로 매도 요청한다.