import requests import json BASE_URL = "https://api.hyperliquid.xyz" def post_info(payload): resp = requests.post( f"{BASE_URL}/info", json=payload, headers={"Content-Type": "application/json"}, ) resp.raise_for_status() return resp.json() print("=" * 60) print("Searching for WTIOIL/USDC pair on Hyperliquid") print("=" * 60) # 1. List all XYZ DEX pairs print("\n1. All XYZ DEX pairs (from allMids with dex='xyz'):") mids_xyz = post_info({"type": "allMids", "dex": "xyz"}) for k in sorted(mids_xyz.keys()): print(f" {k}: {mids_xyz[k]}") # 2. Check perpDexs print("\n2. Fetching perpDexs...") perp_dexs = post_info({"type": "perpDexs"}) print(f" Perp DEXs: {json.dumps(perp_dexs, indent=2)}") # 3. Try allMids with different dex values print("\n3. Trying allMids with different dex values...") for dex in ["", "xyz", "X", "X:CLUSD"]: mids = post_info({"type": "allMids", "dex": dex}) clusd_keys = [k for k in mids if "CLUSD" in k.upper() or "WTI" in k.upper() or "OIL" in k.upper()] if clusd_keys: print(f" dex='{dex}': Found {clusd_keys}") for k in clusd_keys: print(f" {k}: {mids[k]}") else: print(f" dex='{dex}': No CLUSD/WTI/OIL pairs found (total keys: {len(mids)})") # 4. Try l2Book with all XYZ pairs to see which ones return data print("\n4. Testing l2Book for all XYZ pairs...") for k in sorted(mids_xyz.keys()): book = post_info({"type": "l2Book", "coin": k}) if book is not None and "levels" in book: print(f" {k}: OK (bids={len(book['levels'][0])}, asks={len(book['levels'][1])})") else: print(f" {k}: null response") # 5. Check if xyz:CL exists and has data print("\n5. Checking xyz:CL specifically...") book_cl = post_info({"type": "l2Book", "coin": "xyz:CL"}) if book_cl: print(f" xyz:CL book: {json.dumps(book_cl, indent=2)[:500]}") else: print(f" xyz:CL: null") # 6. Try candleSnapshot for xyz:CL print("\n6. Trying candleSnapshot for xyz:CL...") candles = post_info({ "type": "candleSnapshot", "req": { "coin": "xyz:CL", "interval": "1h", "startTime": 1754300000000, "endTime": 1754400000000, } }) print(f" xyz:CL candles: {json.dumps(candles, indent=2)[:500]}") print("\n" + "=" * 60) print("Done.")