Spaces:
Running
Running
File size: 2,416 Bytes
da0ce7b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
from aureon_baton_link import link_system as _baton_link; _baton_link(__name__)
import os
import asyncio
try:
from dotenv import load_dotenv
except ImportError: # Fallback when python-dotenv is not installed
def load_dotenv(*args, **kwargs): # type: ignore[unused-arg]
return None
# Load env vars
load_dotenv()
async def check_balances():
print("๐ VERIFYING REAL BALANCES FROM EXCHANGES...")
# Check Alpaca
try:
from alpaca_client import AlpacaClient
alpaca = AlpacaClient()
acct = alpaca.get_account()
print(f"\n๐ฆ ALPACA ACCOUNT ({'PAPER' if alpaca.use_paper else 'LIVE'}):")
if isinstance(acct, dict) and 'equity' in acct:
print(f" Status: {acct.get('status', 'Unknown')}")
print(f" Equity: ${float(acct.get('equity', 0)):,.2f}")
print(f" Cash: ${float(acct.get('cash', 0)):,.2f}")
print(f" Buying Power: ${float(acct.get('buying_power', 0)):,.2f}")
else:
print(f" โ ๏ธ Unexpected response: {acct}")
except Exception as e:
print(f"\n๐ฆ Alpaca Error: {e}")
# Check Kraken
try:
from kraken_client import KrakenClient, get_kraken_client
kraken = get_kraken_client()
bal = kraken.get_account_balance()
print(f"\n๐ KRAKEN BALANCES:")
if bal:
for asset, amount in bal.items():
if float(amount) > 0:
print(f" {asset}: {amount}")
else:
print(" No balances found or error.")
except Exception as e:
print(f"\n๐ Kraken Error: {e}")
# Check Binance
try:
from binance_client import BinanceClient
binance = get_binance_client()
# Use simple account() method
info = binance.account()
print(f"\n๐ก BINANCE BALANCES:")
if info and 'balances' in info:
for b in info['balances']:
free = float(b['free'])
locked = float(b['locked'])
if free + locked > 0:
print(f" {b['asset']}: {free} (Locked: {locked})")
else:
print(" No balances found or error.")
except Exception as e:
print(f"\n๐ก Binance Error: {e}")
if __name__ == "__main__":
asyncio.run(check_balances())
|