init
This commit is contained in:
@@ -64,7 +64,7 @@ class HTS_etf(HTS):
|
|||||||
for code in jangoDic:
|
for code in jangoDic:
|
||||||
if stock_code is not None:
|
if stock_code is not None:
|
||||||
if code == "A" + stock_code:
|
if code == "A" + stock_code:
|
||||||
return jangoDic[code]['장부가']
|
return jangoDic[code]['장부가'], jangoDic[code]['평가금액'], jangoDic[code]['평가손익'],
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def sellStocks(self, stock_code=None, bs_sell_price=None):
|
def sellStocks(self, stock_code=None, bs_sell_price=None):
|
||||||
@@ -393,7 +393,8 @@ class HTS_etf(HTS):
|
|||||||
# 매도를 체크한다.
|
# 매도를 체크한다.
|
||||||
check = self.sellStocks(self.stock_code)
|
check = self.sellStocks(self.stock_code)
|
||||||
|
|
||||||
buy_avg = self.getBallance(self.stock_code)
|
# jangoDic[code]['장부가'], jangoDic[code]['평가금액'], jangoDic[code]['평가손익'],
|
||||||
|
buy_avg, amount, profit = self.getBallance(self.stock_code)
|
||||||
if check or buy_avg == 0:
|
if check or buy_avg == 0:
|
||||||
BUY_LIST['buy_avg'] = 0
|
BUY_LIST['buy_avg'] = 0
|
||||||
BUY_LIST['buy_count'] = 0
|
BUY_LIST['buy_count'] = 0
|
||||||
@@ -429,14 +430,13 @@ class HTS_etf(HTS):
|
|||||||
BUY_LIST['buy_avg'] = 0
|
BUY_LIST['buy_avg'] = 0
|
||||||
BUY_LIST['buy_count'] = 0
|
BUY_LIST['buy_count'] = 0
|
||||||
BUY_LIST['buy_list'].clear()
|
BUY_LIST['buy_list'].clear()
|
||||||
self.bot.sendMsg( "Profit {:.2f}, {} ({})".format(amount * (profit_rate - 1), self.stock_code, self.stock_name))
|
self.bot.sendMsg( "Profit {:.2f}, {} ({})".format(profit, self.stock_code, self.stock_name))
|
||||||
|
|
||||||
if 'buy_price' in bsLine1:
|
if 'buy_price' in bsLine1:
|
||||||
buy_price = bsLine1['buy_price'][-1]
|
buy_price = bsLine1['buy_price'][-1]
|
||||||
buy_count = bsLine1['buy_count'][-1]
|
buy_count = bsLine1['buy_count'][-1]
|
||||||
if buy_price > 0:
|
if buy_price > 0:
|
||||||
# 매수를 요청 한다.
|
# 매수를 요청 한다.
|
||||||
amount = buy_price * buy_count
|
|
||||||
orderNum = self.requestOrder(OrderType.buy, self.stock_code, buy_count, buy_price)
|
orderNum = self.requestOrder(OrderType.buy, self.stock_code, buy_count, buy_price)
|
||||||
self.orderChecker.buy(today, "A" + self.stock_code, buy_count, buy_price, orderNum)
|
self.orderChecker.buy(today, "A" + self.stock_code, buy_count, buy_price, orderNum)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user