init
This commit is contained in:
60
HTS_etf.py
60
HTS_etf.py
@@ -34,8 +34,6 @@ class HTS_etf (HTS):
|
|||||||
self.slackBot = SlackBot()
|
self.slackBot = SlackBot()
|
||||||
self.stockStatus = StockStatus(RESOURCE_PATH)
|
self.stockStatus = StockStatus(RESOURCE_PATH)
|
||||||
|
|
||||||
self.MAX_BUY_PRICE = 300000
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def getSellingPrice(self, log_time, stock_code, final_price, without_loss=False):
|
def getSellingPrice(self, log_time, stock_code, final_price, without_loss=False):
|
||||||
@@ -83,6 +81,15 @@ class HTS_etf (HTS):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def getCount(self, stock_code, price):
|
||||||
|
if stock_code == "252670" or stock_code == "122630":
|
||||||
|
MAX_BUY_PRICE = 300000
|
||||||
|
else:
|
||||||
|
MAX_BUY_PRICE = 100000
|
||||||
|
|
||||||
|
count = int(MAX_BUY_PRICE / price)
|
||||||
|
return count
|
||||||
|
|
||||||
def buyRealTime(self, today, stocks, analyzed_day=1000):
|
def buyRealTime(self, today, stocks, analyzed_day=1000):
|
||||||
|
|
||||||
print ("START...")
|
print ("START...")
|
||||||
@@ -133,8 +140,7 @@ class HTS_etf (HTS):
|
|||||||
if bs_buy_price > 0:
|
if bs_buy_price > 0:
|
||||||
|
|
||||||
if not self.orderChecker.exist(today, "A" + stock['stock_code'], mins=30):
|
if not self.orderChecker.exist(today, "A" + stock['stock_code'], mins=30):
|
||||||
|
buy_count = self.getCount(stock['stock_code'], bs_buy_price)
|
||||||
buy_count = int(self.MAX_BUY_PRICE/bs_buy_price)
|
|
||||||
|
|
||||||
# 매수를 주문한다.
|
# 매수를 주문한다.
|
||||||
orderNum = self.requestOrder(OrderType.buy, stock['stock_code'], buy_count , bs_buy_price)
|
orderNum = self.requestOrder(OrderType.buy, stock['stock_code'], buy_count , bs_buy_price)
|
||||||
@@ -209,7 +215,51 @@ if __name__ == "__main__":
|
|||||||
# KODEX 인버스 * 2
|
# KODEX 인버스 * 2
|
||||||
stocks = [
|
stocks = [
|
||||||
{"stock_code": "252670", "stock_name": "KODEX 200선물인버스2X"},
|
{"stock_code": "252670", "stock_name": "KODEX 200선물인버스2X"},
|
||||||
{"stock_code": "122630", "stock_name": "KODEX 레버리지"}
|
{"stock_code": "122630", "stock_name": "KODEX 레버리지"},
|
||||||
|
{"stock_code": "305720", "stock_name": "KODEX 2차전지산업"},
|
||||||
|
{"stock_code": "102780", "stock_name": "KODEX 삼성그룹"},
|
||||||
|
{"stock_code": "139260", "stock_name": "TIGER 200 IT"},
|
||||||
|
{"stock_code": "091180", "stock_name": "KODEX 자동차"},
|
||||||
|
{"stock_code": "401470", "stock_name": "KODEX K-메타버스액티브"},
|
||||||
|
{"stock_code": "329200", "stock_name": "TIGER 리츠부동산인프라"},
|
||||||
|
{"stock_code": "091170", "stock_name": "KODEX 은행"},
|
||||||
|
{"stock_code": "091160", "stock_name": "KODEX 반도체"},
|
||||||
|
{"stock_code": "161510", "stock_name": "ARIRANG 고배당주"},
|
||||||
|
{"stock_code": "228800", "stock_name": "TIGER 여행레저"},
|
||||||
|
{"stock_code": "150460", "stock_name": "TIGER 중국소비테마"},
|
||||||
|
{"stock_code": "143860", "stock_name": "TIGER 헬스케어"},
|
||||||
|
{"stock_code": "228810", "stock_name": "TIGER 미디어컨텐츠"},
|
||||||
|
{"stock_code": "139220", "stock_name": "TIGER 200 건설"},
|
||||||
|
{"stock_code": "139280", "stock_name": "TIGER 경기방어"},
|
||||||
|
{"stock_code": "322400", "stock_name": "HANARO e커머스"},
|
||||||
|
{"stock_code": "157490", "stock_name": "TIGER 소프트웨어"},
|
||||||
|
{"stock_code": "228790", "stock_name": "TIGER 화장품"},
|
||||||
|
{"stock_code": "139230", "stock_name": "TIGER 200 중공업"},
|
||||||
|
{"stock_code": "396500", "stock_name": "TIGER Fn반도체TOP10"},
|
||||||
|
{"stock_code": "365000", "stock_name": "TIGER KRX인터넷K-뉴딜"},
|
||||||
|
{"stock_code": "102970", "stock_name": "KODEX 증권"},
|
||||||
|
{"stock_code": "117680", "stock_name": "KODEX 철강"},
|
||||||
|
{"stock_code": "244580", "stock_name": "KODEX 바이오"},
|
||||||
|
{"stock_code": "266360", "stock_name": "KODEX 미디어&엔터테인먼트"},
|
||||||
|
{"stock_code": "375770", "stock_name": "KODEX 탄소효율그린뉴딜"},
|
||||||
|
{"stock_code": "364990", "stock_name": "TIGER KRX게임K-뉴딜"},
|
||||||
|
{"stock_code": "388420", "stock_name": "KBSTAR 비메모리반도체액티브"},
|
||||||
|
{"stock_code": "117460", "stock_name": "KODEX 에너지화학"},
|
||||||
|
{"stock_code": "300950", "stock_name": "KODEX 게임산업"},
|
||||||
|
{"stock_code": "266410", "stock_name": "KODEX 필수소비재"},
|
||||||
|
{"stock_code": "140700", "stock_name": "KODEX 보험"},
|
||||||
|
{"stock_code": "139270", "stock_name": "TIGER 200 금융"},
|
||||||
|
{"stock_code": "395160", "stock_name": "KODEX Fn시스템반도체"},
|
||||||
|
{"stock_code": "140710", "stock_name": "KODEX 운송"},
|
||||||
|
{"stock_code": "139240", "stock_name": "TIGER 200 철강소재"},
|
||||||
|
{"stock_code": "395150", "stock_name": "KODEX Fn웹툰&드라마"},
|
||||||
|
{"stock_code": "307510", "stock_name": "TIGER 의료기기"},
|
||||||
|
{"stock_code": "315270", "stock_name": "TIGER 200커뮤니케이션서비스"},
|
||||||
|
{"stock_code": "132030", "stock_name": "KODEX 골드선물(H)"},
|
||||||
|
{"stock_code": "144600", "stock_name": "KODEX 은선물(H)"},
|
||||||
|
{"stock_code": "261220", "stock_name": "KODEX WTI원유선물(H)"},
|
||||||
|
{"stock_code": "271050", "stock_name": "KODEX WTI원유선물인버스(H)"},
|
||||||
|
{"stock_code": "138910", "stock_name": "KODEX 구리선물(H)"}
|
||||||
]
|
]
|
||||||
|
|
||||||
hts = HTS_etf(RESOURCE_PATH)
|
hts = HTS_etf(RESOURCE_PATH)
|
||||||
|
|||||||
Reference in New Issue
Block a user