init
This commit is contained in:
@@ -156,7 +156,7 @@ class HTS:
|
||||
return result
|
||||
|
||||
# 주식 현금 매수주문
|
||||
def requestOrder(self, type, stock_code, count, price):
|
||||
def requestOrder(self, type, stock_code, count, price, slackBot=None):
|
||||
# type = 2: buy, type=1: sell
|
||||
# 주문 초기화
|
||||
# 연결 여부 체크
|
||||
@@ -200,13 +200,18 @@ class HTS:
|
||||
rqRet = objStockOrder.GetDibMsg1()
|
||||
print("통신상태", rqStatus, rqRet)
|
||||
if rqStatus != 0:
|
||||
slackBot.post_msg_to_slack("통신상태: "+ str(rqStatus)+' ('+str(rqRet)+')')
|
||||
return None
|
||||
|
||||
orderNum = objStockOrder.GetHeaderValue(0)
|
||||
|
||||
if (type == "1"):
|
||||
if slackBot is not None:
|
||||
slackBot.post_to_slack(stock_code, stock_code, "SELL", price, count)
|
||||
print ("(SELL", count, price, ")")
|
||||
else:
|
||||
if slackBot is not None:
|
||||
slackBot.post_to_slack(stock_code, stock_code, "BUY", price, count)
|
||||
print ("(BUY", count, price, ")")
|
||||
return orderNum
|
||||
|
||||
|
||||
Reference in New Issue
Block a user