init
This commit is contained in:
@@ -166,21 +166,21 @@ class HTS_etf (HTS):
|
||||
|
||||
|
||||
type_stock = {'day':1, 'week':10, 'month':100}
|
||||
if slow_k > p_slow_k:
|
||||
if slow_k < 10: type_stock['day'] = 10
|
||||
if 10 < slow_k < 20: type_stock['day'] = 7.5
|
||||
if 20 < slow_k < 30: type_stock['day'] = 5
|
||||
if 30 < slow_k < 40: type_stock['day'] = 2.5
|
||||
if slow_k_week > p_slow_k_week:
|
||||
if slow_k_week < 10: type_stock['week'] = 100
|
||||
if 10 < slow_k_week < 20: type_stock['week'] = 75
|
||||
if 20 < slow_k_week < 30: type_stock['week'] = 50
|
||||
if 30 < slow_k_week < 40: type_stock['week'] = 25
|
||||
if slow_k_month > p_slow_k_month:
|
||||
if slow_k_month < 10: type_stock['month'] = 1000
|
||||
if 10 < slow_k_month < 20: type_stock['month'] = 750
|
||||
if 20 < slow_k_month < 30: type_stock['month'] = 500
|
||||
if 30 < slow_k_month < 40: type_stock['month'] = 250
|
||||
|
||||
if slow_k < 10: type_stock['day'] = 10
|
||||
if 10 < slow_k < 20: type_stock['day'] = 7.5
|
||||
if 20 < slow_k < 30: type_stock['day'] = 5
|
||||
if 30 < slow_k < 40: type_stock['day'] = 2.5
|
||||
|
||||
if slow_k_week < 10: type_stock['week'] = 100
|
||||
if 10 < slow_k_week < 20: type_stock['week'] = 75
|
||||
if 20 < slow_k_week < 30: type_stock['week'] = 50
|
||||
if 30 < slow_k_week < 40: type_stock['week'] = 25
|
||||
|
||||
if slow_k_month < 10: type_stock['month'] = 1000
|
||||
if 10 < slow_k_month < 20: type_stock['month'] = 750
|
||||
if 20 < slow_k_month < 30: type_stock['month'] = 500
|
||||
if 30 < slow_k_month < 40: type_stock['month'] = 250
|
||||
|
||||
return type_stock
|
||||
|
||||
@@ -275,15 +275,15 @@ class HTS_etf (HTS):
|
||||
self.orderChecker.buy(today, "A" + stock['stock_code'], buy_count, bs_buy_price, orderNum)
|
||||
|
||||
# slackbot에 메시지를 보냄
|
||||
self.slackBot.post_to_slack(stock['stock_code'], stock['stock_name'], "BUY", bsLine['buy'][len(bsLine['buy']) - 1], buy_count)
|
||||
self.slackBot.post_to_slack(stock['stock_code'], stock['stock_name'], "BUY", bs_buy_price, buy_count)
|
||||
|
||||
# 로그 출력
|
||||
print("BUY", THIS_TIME.strftime('%Y%m%d %H%M%S'), orderNum, stock['stock_code'], stock['stock_name'], bs_buy_price, buy_count)
|
||||
|
||||
# 로그 출력
|
||||
print("TIMECHECK: %s, code: %s, name: %s, buy: %d, sell: %d, avg5: %.2f, avg30: %.2f, open: %d, high: %d, low: %d, slow_k: %.2f, slow_k_5: %.2f, slow_k_30: %.2f" %
|
||||
(str(THIS_TIME), stock['stock_code'], stock['stock_name'], bs_buy_price, bs_sell_price, data["avg5"][0], data["avg30"][0],
|
||||
data["open"][0], data["high"][0], data["low"][0], data["slow_k"][0], data_5["slow_k"][0], data_30["slow_k"][0]))
|
||||
print("TIMECHECK: %s, code: %s, name: %s, buy: %d, avg5: %.2f, avg30: %.2f, open: %d, high: %d, low: %d, slow_k: %.2f" %
|
||||
(str(THIS_TIME), stock['stock_code'], stock['stock_name'], bs_buy_price, data["avg5"][0], data["avg30"][0],
|
||||
data["open"][0], data["high"][0], data["low"][0], data["slow_k"][0]))
|
||||
|
||||
"""
|
||||
elif datetime.strptime(today + " 151530", '%Y%m%d %H%M%S') < THIS_TIME < datetime.strptime(today + " 151600", '%Y%m%d %H%M%S'):
|
||||
|
||||
@@ -167,37 +167,38 @@ class HTS_etf (HTS):
|
||||
|
||||
type_stock = {'day':1, 'week':10, 'month':100}
|
||||
if short:
|
||||
if slow_k > p_slow_k:
|
||||
if slow_k < 10: type_stock['day'] = 10
|
||||
if 10 < slow_k < 20: type_stock['day'] = 7.5
|
||||
if 20 < slow_k < 30: type_stock['day'] = 5
|
||||
if 30 < slow_k < 40: type_stock['day'] = 2.5
|
||||
if slow_k_week > p_slow_k_week:
|
||||
if slow_k_week < 10: type_stock['week'] = 100
|
||||
if 10 < slow_k_week < 20: type_stock['week'] = 75
|
||||
if 20 < slow_k_week < 30: type_stock['week'] = 50
|
||||
if 30 < slow_k_week < 40: type_stock['week'] = 25
|
||||
if slow_k_month > p_slow_k_month:
|
||||
if slow_k_month < 10: type_stock['month'] = 1000
|
||||
if 10 < slow_k_month < 20: type_stock['month'] = 750
|
||||
if 20 < slow_k_month < 30: type_stock['month'] = 500
|
||||
if 30 < slow_k_month < 40: type_stock['month'] = 250
|
||||
|
||||
if slow_k < 10: type_stock['day'] = 10
|
||||
if 10 < slow_k < 20: type_stock['day'] = 7.5
|
||||
if 20 < slow_k < 30: type_stock['day'] = 5
|
||||
if 30 < slow_k < 40: type_stock['day'] = 2.5
|
||||
|
||||
if slow_k_week < 10: type_stock['week'] = 100
|
||||
if 10 < slow_k_week < 20: type_stock['week'] = 75
|
||||
if 20 < slow_k_week < 30: type_stock['week'] = 50
|
||||
if 30 < slow_k_week < 40: type_stock['week'] = 25
|
||||
|
||||
if slow_k_month < 10: type_stock['month'] = 1000
|
||||
if 10 < slow_k_month < 20: type_stock['month'] = 750
|
||||
if 20 < slow_k_month < 30: type_stock['month'] = 500
|
||||
if 30 < slow_k_month < 40: type_stock['month'] = 250
|
||||
else:
|
||||
if slow_k < p_slow_k:
|
||||
if slow_k > 90: type_stock['day'] = 10
|
||||
if 80 < slow_k < 90: type_stock['day'] = 7.5
|
||||
if 70 < slow_k < 80: type_stock['day'] = 5
|
||||
if 60 < slow_k < 70: type_stock['day'] = 2.5
|
||||
if slow_k_week > p_slow_k_week:
|
||||
if slow_k_week > 90: type_stock['week'] = 100
|
||||
if 80 < slow_k_week < 90: type_stock['week'] = 75
|
||||
if 70 < slow_k_week < 80: type_stock['week'] = 50
|
||||
if 60 < slow_k_week < 70: type_stock['week'] = 25
|
||||
if slow_k_month > p_slow_k_month:
|
||||
if slow_k_month > 90: type_stock['month'] = 1000
|
||||
if 80 < slow_k_month < 90: type_stock['month'] = 750
|
||||
if 70 < slow_k_month < 80: type_stock['month'] = 500
|
||||
if 60 < slow_k_month < 70: type_stock['month'] = 250
|
||||
|
||||
if slow_k > 90: type_stock['day'] = 10
|
||||
if 80 < slow_k < 90: type_stock['day'] = 7.5
|
||||
if 70 < slow_k < 80: type_stock['day'] = 5
|
||||
if 60 < slow_k < 70: type_stock['day'] = 2.5
|
||||
|
||||
if slow_k_week > 90: type_stock['week'] = 100
|
||||
if 80 < slow_k_week < 90: type_stock['week'] = 75
|
||||
if 70 < slow_k_week < 80: type_stock['week'] = 50
|
||||
if 60 < slow_k_week < 70: type_stock['week'] = 25
|
||||
|
||||
if slow_k_month > 90: type_stock['month'] = 1000
|
||||
if 80 < slow_k_month < 90: type_stock['month'] = 750
|
||||
if 70 < slow_k_month < 80: type_stock['month'] = 500
|
||||
if 60 < slow_k_month < 70: type_stock['month'] = 250
|
||||
|
||||
return type_stock
|
||||
|
||||
def getBuyCount(self, bs_buy_price, kospi_type, stock_type):
|
||||
@@ -291,15 +292,15 @@ class HTS_etf (HTS):
|
||||
self.orderChecker.buy(today, "A" + stock['stock_code'], buy_count, bs_buy_price, orderNum)
|
||||
|
||||
# slackbot에 메시지를 보냄
|
||||
self.slackBot.post_to_slack(stock['stock_code'], stock['stock_name'], "BUY", bsLine['buy'][len(bsLine['buy']) - 1], buy_count)
|
||||
self.slackBot.post_to_slack(stock['stock_code'], stock['stock_name'], "BUY", bs_buy_price, buy_count)
|
||||
|
||||
# 로그 출력
|
||||
print("BUY", THIS_TIME.strftime('%Y%m%d %H%M%S'), orderNum, stock['stock_code'], stock['stock_name'], bs_buy_price, buy_count)
|
||||
|
||||
# 로그 출력
|
||||
print("TIMECHECK: %s, code: %s, name: %s, buy: %d, sell: %d, avg5: %.2f, avg30: %.2f, open: %d, high: %d, low: %d, slow_k: %.2f, slow_k_5: %.2f, slow_k_30: %.2f" %
|
||||
(str(THIS_TIME), stock['stock_code'], stock['stock_name'], bs_buy_price, bs_sell_price, data["avg5"][0], data["avg30"][0],
|
||||
data["open"][0], data["high"][0], data["low"][0], data["slow_k"][0], data_5["slow_k"][0], data_30["slow_k"][0]))
|
||||
print("TIMECHECK: %s, code: %s, name: %s, buy: %d, avg5: %.2f, avg30: %.2f, open: %d, high: %d, low: %d, slow_k: %.2f" %
|
||||
(str(THIS_TIME), stock['stock_code'], stock['stock_name'], bs_buy_price, data["avg5"][0], data["avg30"][0],
|
||||
data["open"][0], data["high"][0], data["low"][0], data["slow_k"][0]))
|
||||
|
||||
"""
|
||||
elif datetime.strptime(today + " 151530", '%Y%m%d %H%M%S') < THIS_TIME < datetime.strptime(today + " 151600", '%Y%m%d %H%M%S'):
|
||||
|
||||
Reference in New Issue
Block a user