Spaces:
Runtime error
Runtime error
File size: 8,697 Bytes
56c0d82 | 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | #!/usr/bin/env python3
"""
π― QUICK SNIPER - FAST PROFIT EXECUTION
No overthinking, just profit!
"""
from aureon_baton_link import link_system as _baton_link; _baton_link(__name__)
import sys
import os
# Windows UTF-8 fix
if sys.platform == 'win32':
os.environ['PYTHONIOENCODING'] = 'utf-8'
try:
import io
if hasattr(sys.stdout, 'buffer'):
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace', line_buffering=True)
# Skip stderr wrapping - causes Windows exit errors
except Exception:
pass
import time
import json
from datetime import datetime
# Load Kraken client
from kraken_client import KrakenClient
def load_kraken():
"""Load Kraken with API keys."""
from dotenv import load_dotenv
load_dotenv()
return KrakenClient() # Loads keys from env automatically
def get_best_breakout(kraken):
"""Find the BEST breakout opportunity RIGHT NOW."""
print("\nπ SCANNING FOR BREAKOUTS...")
tickers = kraken.get_24h_tickers()
if not tickers:
print("β No ticker data")
return None
# Convert list to dict if needed
if isinstance(tickers, list):
tickers_dict = {}
for t in tickers:
if isinstance(t, dict) and 'symbol' in t:
tickers_dict[t['symbol']] = t
tickers = tickers_dict
# Find best opportunities
opportunities = []
for symbol, data in tickers.items():
# Skip non-USD pairs
if not symbol.endswith('USD') and not symbol.endswith('USDC'):
continue
# Skip stablecoins
base = symbol.replace('USDC', '').replace('USD', '')
if base in ['USDT', 'USDC', 'DAI', 'TUSD', 'ZUSD', 'PAX', 'BUSD']:
continue
try:
change = float(data.get('priceChangePercent', 0))
volume = float(data.get('quoteVolume', 0))
price = float(data.get('lastPrice', 0))
# Looking for:
# 1. Strong upward momentum (+5% to +50%)
# 2. Good volume (> $10k)
# 3. Not too expensive (< $100 so we can get decent qty)
if 5 < change < 50 and volume > 10000 and 0.0001 < price < 100:
score = change * (volume / 100000) # Simple momentum * volume score
opportunities.append({
'symbol': symbol,
'base': base,
'price': price,
'change': change,
'volume': volume,
'score': score
})
except:
continue
# Sort by score
opportunities.sort(key=lambda x: x['score'], reverse=True)
print(f"\nπ― TOP BREAKOUTS:")
for i, opp in enumerate(opportunities[:10]):
print(f" {i+1}. {opp['symbol']:12} +{opp['change']:.1f}% | Vol: ${opp['volume']:,.0f} | Price: ${opp['price']:.4f}")
return opportunities[:10] if opportunities else None
def execute_buy(kraken, symbol, quote_amount):
"""Execute a BUY order."""
print(f"\nπ EXECUTING BUY: {symbol} with ${quote_amount:.2f}")
try:
result = kraken.place_market_order(symbol, 'buy', quote_qty=quote_amount)
print(f"β
ORDER RESULT: {result}")
return result
except Exception as e:
print(f"β Order failed: {e}")
return None
def main():
print("=" * 60)
print("π― QUICK SNIPER - PULL THIS OFF NOW!")
print("=" * 60)
kraken = load_kraken()
# Get balances
balances = kraken.get_account_balance()
print(f"\nπ° KRAKEN BALANCES:")
usdc_balance = 0
tusd_balance = 0
melania_balance = 0
for asset, amount in balances.items():
if float(amount) > 0.01:
print(f" {asset}: {float(amount):.4f}")
if asset == 'USDC':
usdc_balance = float(amount)
elif asset == 'TUSD':
tusd_balance = float(amount)
elif asset == 'MELANIA':
melania_balance = float(amount)
# Check MELANIA position first
tickers = kraken.get_24h_tickers()
# Convert list to dict if needed
if isinstance(tickers, list):
tickers_dict = {}
for t in tickers:
if isinstance(t, dict) and 'symbol' in t:
tickers_dict[t['symbol']] = t
tickers = tickers_dict
melania_ticker = tickers.get('MELANIAUSDC') or tickers.get('MELANIAUSD')
if melania_ticker and melania_balance > 0:
current_price = float(melania_ticker.get('lastPrice', 0))
entry_price = 0.1515 # Your entry
pnl_pct = ((current_price - entry_price) / entry_price) * 100
value = melania_balance * current_price
print(f"\nπ MELANIA POSITION:")
print(f" Amount: {melania_balance:.2f}")
print(f" Entry: ${entry_price:.4f}")
print(f" Current: ${current_price:.4f}")
print(f" PnL: {pnl_pct:+.2f}%")
print(f" Value: ${value:.2f}")
# If profitable, SELL IT!
if pnl_pct >= 0.5: # 0.5% profit target (lower for speed)
print(f"\nπ―π° PROFIT TARGET HIT! SELLING MELANIA...")
try:
# Try USDC pair first
result = kraken.place_market_order('MELANIAUSDC', 'sell', base_qty=melania_balance)
print(f"β
SOLD: {result}")
# Refresh balances
time.sleep(2)
balances = kraken.get_account_balance()
usdc_balance = float(balances.get('USDC', 0))
print(f"β
New USDC balance: ${usdc_balance:.2f}")
except Exception as e:
print(f"β Sell failed: {e}")
# Now find next opportunity
print("\n" + "=" * 60)
print("π HUNTING NEXT OPPORTUNITY...")
print("=" * 60)
opportunities = get_best_breakout(kraken)
if not opportunities:
print("β No good opportunities found")
return
# Available to trade
available = usdc_balance
if tusd_balance > 1:
# Convert TUSD to USDC first
print(f"\nπ± Converting TUSD (${tusd_balance:.2f}) to USDC...")
try:
result = kraken.place_market_order('TUSDUSD', 'sell', base_qty=tusd_balance)
print(f"β
Converted: {result}")
time.sleep(2)
balances = kraken.get_account_balance()
available = float(balances.get('USDC', 0)) + float(balances.get('USD', 0))
except Exception as e:
print(f"β οΈ TUSD conversion failed: {e}")
print(f"\nπ΅ AVAILABLE TO TRADE: ${available:.2f}")
if available < 1:
print("β Not enough funds to trade")
return
# Execute on TOP opportunity
for opp in opportunities:
symbol = opp['symbol']
# Use 90% of available (keep some buffer)
trade_amount = available * 0.9
print(f"\nπ― TARGETING: {symbol}")
print(f" 24h Change: +{opp['change']:.1f}%")
print(f" Volume: ${opp['volume']:,.0f}")
print(f" Trade Amount: ${trade_amount:.2f}")
# Try to execute
try:
# Determine quote currency
if symbol.endswith('USDC'):
result = kraken.place_market_order(symbol, 'buy', quote_qty=trade_amount)
else:
result = kraken.place_market_order(symbol, 'buy', quote_qty=trade_amount)
if result and 'error' not in str(result).lower():
print(f"\nβ
β
β
EXECUTED! {result}")
# Save position
position = {
'symbol': symbol,
'side': 'buy',
'entry_time': datetime.now().isoformat(),
'amount_usd': trade_amount,
'entry_price': opp['price'],
'change_at_entry': opp['change']
}
with open('quick_sniper_position.json', 'w') as f:
json.dump(position, f, indent=2)
print(f"πΎ Position saved to quick_sniper_position.json")
return
else:
print(f"β οΈ Order issue: {result}")
continue
except Exception as e:
print(f"β οΈ Failed on {symbol}: {e}")
continue
print("\nβ Could not execute on any opportunity")
if __name__ == '__main__':
main()
|