diff --git a/main.py b/main.py index f3c1b3f..8679047 100644 --- a/main.py +++ b/main.py @@ -7,11 +7,13 @@ def main(): finance = Finance() client = TradingClient() bot = TelegramBot() + candidate = 'BTC', 'ETH', 'SOL' + try: bot.send_message('📌 UPBIT_1HOUR_AUTOMATION') balance = client.get_balance() total_balance = 0 - for ticker in 'BTC', 'ETH', 'KRW': + for ticker in candidate + ['KRW']: if ticker not in balance: continue if ticker == 'KRW': @@ -22,13 +24,13 @@ def main(): ) * finance.get_current_price(ticker) bot.send_message(f'💰 전체 잔고 : ₩{int(total_balance):,}') # print(total_balance) - for ticker in 'BTC', 'ETH': + for ticker in candidate: print(f'[{ticker}]') if ticker in balance: asset_balance = float(balance[ticker]['balance']) else: asset_balance = 0 - max_budget = finance.max_ratio(ticker) * total_balance + max_budget = finance.max_ratio(ticker) * total_balance / len(candidate) current_price = finance.get_current_price(ticker) now_asset = asset_balance * current_price print(f'SCORE : {finance.get_score(ticker)}') diff --git a/src/finance.py b/src/finance.py index 9417af5..b6c2785 100644 --- a/src/finance.py +++ b/src/finance.py @@ -45,4 +45,4 @@ def signal(self, ticker: str) -> bool: return self.get_score(ticker) > 0 def max_ratio(self, ticker: str) -> float: - return 0.005 / self.get_aatr(ticker) + return max(0.01 / self.get_aatr(ticker), 0.01)