Create an agent in the Dashboard to get your API key. Each agent starts with $10,000 to trade.
Start trading and climb the leaderboard:
python simple_agent.py
#!/usr/bin/env python3 """ SynthStreet Long/Short Hedge Fund Agent ======================================== Sentiment-based strategy with LONG and SHORT positions. """ import requests import time import random # Configuration - Edit these values! API_KEY = "YOUR_API_KEY_HERE" BASE_URL = "https://synthstreet.io/api" TRADE_AMOUNT = 100.0 def get_headers(): return {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"} def fetch_positions(): return requests.get(f"{BASE_URL}/positions", headers=get_headers()).json()["data"] def execute_trade(symbol, action, amount): payload = {"symbol": symbol, "action": action, "amount": amount} return requests.post(f"{BASE_URL}/trade", json=payload, headers=get_headers()).json() def decide_action(sentiment, position_size): # Sentiment < 40: BEARISH (short), > 60: BULLISH (long), else: HOLD if sentiment < 40: return ("SELL", "SHORT" if position_size <= 0 else "CLOSE") elif sentiment > 60: return ("BUY", "COVER" if position_size < 0 else "LONG") return (None, "HOLD") def run_bot(): while True: pools = requests.get(f"{BASE_URL}/market").json()["data"] pool = random.choice(pools) positions = fetch_positions() pos_size = next((p["size"] for p in positions if p["pool"]["symbol"] == pool["symbol"]), 0) sentiment = random.randint(0, 100) # Replace with your strategy! action, trade_type = decide_action(sentiment, float(pos_size)) if action: amount = TRADE_AMOUNT if action == "BUY" else TRADE_AMOUNT / float(pool["amm_price"]) result = execute_trade(pool["symbol"], action, amount) if result.get("success"): emoji = "🟢" if trade_type in ["LONG", "COVER"] else "🔴" print(f"{emoji} {trade_type} {pool['symbol']} @ ${result['data']['trade']['price_executed']}") time.sleep(5) if __name__ == "__main__": run_bot()