diff --git a/Bithumb_minute.py b/Bithumb_minute.py index 4525959..ef63c05 100644 --- a/Bithumb_minute.py +++ b/Bithumb_minute.py @@ -579,6 +579,21 @@ class Bithumb_minute(HTS): return data + def getMaxPrice(self, price): + price = self.MAX_BUY_PRICE + first_digit = int(price / 100) + if first_digit < 3: + price = 20000 + elif 3 <= first_digit < 4: + price = 15000 + elif 4 <= first_digit < 5: + price = 10000 + elif 5 <= first_digit < 6: + price = 7000 + elif 6 <= first_digit: + price = 5000 + return price + def buyRealTime(self, ticker, analyzed_day=120, isRealTime=False): """ @@ -622,6 +637,9 @@ class Bithumb_minute(HTS): if isRealTime and not check_buy_history: # 매수 조건 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) balance = tmp[2] #count = round((balance * (bsLine['buy_weight'][len(bsLine['buy_weight']) - 1] / 100)) / bsLine['buy'][len(bsLine['buy']) - 1], 2)