init
This commit is contained in:
@@ -26,7 +26,6 @@ class Bithumb_minute(HTS):
|
|||||||
bithumb = None
|
bithumb = None
|
||||||
binance = None
|
binance = None
|
||||||
TODAY = None
|
TODAY = None
|
||||||
MAX_BUY_PRICE = None
|
|
||||||
slackBot = None
|
slackBot = None
|
||||||
stock_code = None
|
stock_code = None
|
||||||
|
|
||||||
@@ -47,7 +46,7 @@ class Bithumb_minute(HTS):
|
|||||||
self.bithumb = pybithumb.Bithumb(con_key, sec_key)
|
self.bithumb = pybithumb.Bithumb(con_key, sec_key)
|
||||||
self.binance = ccxt.binance()
|
self.binance = ccxt.binance()
|
||||||
self.TODAY = today
|
self.TODAY = today
|
||||||
self.MAX_BUY_PRICE = 10000
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def bull_market(self, df, ticker):
|
def bull_market(self, df, ticker):
|
||||||
@@ -579,20 +578,31 @@ class Bithumb_minute(HTS):
|
|||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def getMaxPrice(self, price):
|
def getCount(self, price):
|
||||||
price = self.MAX_BUY_PRICE
|
if 2000 < price: MAX_BUY_PRICE = 2500
|
||||||
first_digit = int(price / 100)
|
elif 1900 <= price < 2000: MAX_BUY_PRICE = 3500
|
||||||
if first_digit < 3:
|
elif 1800 <= price < 1900: MAX_BUY_PRICE = 5000
|
||||||
price = 70000
|
elif 1700 <= price < 1800: MAX_BUY_PRICE = 6500
|
||||||
elif 3 <= first_digit < 4:
|
elif 1600 <= price < 1700: MAX_BUY_PRICE = 8000
|
||||||
price = 50000
|
elif 1700 <= price < 1600: MAX_BUY_PRICE = 10000
|
||||||
elif 4 <= first_digit < 5:
|
elif 1400 <= price < 1500: MAX_BUY_PRICE = 12000
|
||||||
price = 20000
|
elif 1300 <= price < 1400: MAX_BUY_PRICE = 14000
|
||||||
elif 5 <= first_digit < 6:
|
elif 1200 <= price < 1300: MAX_BUY_PRICE = 16000
|
||||||
price = 10000
|
elif 1100 <= price < 1200: MAX_BUY_PRICE = 18500
|
||||||
elif 6 <= first_digit:
|
elif 1000 <= price < 1100: MAX_BUY_PRICE = 21000
|
||||||
price = 3000
|
elif 900 <= price < 1000: MAX_BUY_PRICE = 23500
|
||||||
return price
|
elif 800 <= price < 900: MAX_BUY_PRICE = 26500
|
||||||
|
elif 700 <= price < 800: MAX_BUY_PRICE = 30500
|
||||||
|
elif 600 <= price < 700: MAX_BUY_PRICE = 34000
|
||||||
|
elif 500 <= price < 600: MAX_BUY_PRICE = 37500
|
||||||
|
elif 400 <= price < 500: MAX_BUY_PRICE = 40000
|
||||||
|
elif 300 <= price < 400: MAX_BUY_PRICE = 45000
|
||||||
|
elif 200 <= price < 300: MAX_BUY_PRICE = 47500
|
||||||
|
elif 100 <= price < 200: MAX_BUY_PRICE = 50000
|
||||||
|
else: MAX_BUY_PRICE = 70000
|
||||||
|
|
||||||
|
count = int(MAX_BUY_PRICE / price)
|
||||||
|
return count
|
||||||
|
|
||||||
def buyRealTime(self, ticker, analyzed_day=120, isRealTime=False):
|
def buyRealTime(self, ticker, analyzed_day=120, isRealTime=False):
|
||||||
|
|
||||||
@@ -637,13 +647,11 @@ class Bithumb_minute(HTS):
|
|||||||
if isRealTime and not check_buy_history:
|
if isRealTime and not check_buy_history:
|
||||||
# 매수 조건
|
# 매수 조건
|
||||||
if max(bsLine['buy'][len(bsLine['buy']) - 2:]) > 100:
|
if max(bsLine['buy'][len(bsLine['buy']) - 2:]) > 100:
|
||||||
self.MAX_BUY_PRICE = self.getMaxPrice(bsLine['buy'][len(bsLine['buy']) - 1])
|
|
||||||
|
|
||||||
|
|
||||||
tmp = self.bithumb.get_balance(ticker)
|
tmp = self.bithumb.get_balance(ticker)
|
||||||
balance = tmp[2]
|
balance = tmp[2]
|
||||||
#count = round((balance * (bsLine['buy_weight'][len(bsLine['buy_weight']) - 1] / 100)) / bsLine['buy'][len(bsLine['buy']) - 1], 2)
|
#count = round((balance * (bsLine['buy_weight'][len(bsLine['buy_weight']) - 1] / 100)) / bsLine['buy'][len(bsLine['buy']) - 1], 2)
|
||||||
count = int(self.MAX_BUY_PRICE / bsLine['buy'][len(bsLine['buy']) - 1])
|
count = self.getCount(bsLine['buy'][len(bsLine['buy']) - 1])
|
||||||
|
|
||||||
# 매수를 요청한다.
|
# 매수를 요청한다.
|
||||||
order = self.bithumb.buy_limit_order(ticker, bsLine['buy'][len(bsLine['buy']) - 1], count)
|
order = self.bithumb.buy_limit_order(ticker, bsLine['buy'][len(bsLine['buy']) - 1], count)
|
||||||
|
|||||||
Reference in New Issue
Block a user