Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
sol
Browse files Browse the repository at this point in the history
  • Loading branch information
qus0in committed Mar 16, 2024
1 parent 1334dd9 commit 08d448d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand All @@ -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)}')
Expand Down
2 changes: 1 addition & 1 deletion src/finance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 08d448d

Please sign in to comment.