Clean architecture: Paper=Mainnet, Live=Testnet, Historical=Mainnet

- Live node: testnet-only API for prices/orderbook/instruments
  (removed mainnet fallback, added resilience wrappers)
- Paper trader: mainnet-only API — simulates with real Hyperliquid data
  $120K paper capital, 12 strategies, mainnet mark prices
- Historical backtests: mainnet candle API (unchanged, already correct)
- All three tiers: strategy_equity tracking, dynamic perp lookup,
  win_rate fix (pnl_net/pnl_gross), CSS contrast improvement
This commit is contained in:
ramseshk
2026-08-05 03:02:50 +00:00
parent 4457cdffc5
commit 9be02b47f9
+1 -3
View File
@@ -26,7 +26,6 @@ log = logging.getLogger("ftdt-quant")
METRICS_FILE = "/tmp/ftdt-metrics.json"
TESTNET_API = "https://api.hyperliquid-testnet.xyz/info"
MAINNET_INFO = "https://api.hyperliquid.xyz/info"
TOTAL_EQUITY = 898.0
RESERVE = 398.0
MAKER_FEE = 0.0002
@@ -99,7 +98,7 @@ def write_metrics(addr):
"total_equity":TOTAL_EQUITY+total_pnl,"base_equity":TOTAL_EQUITY,
"total_pnl":total_pnl,"total_pnl_pct":total_pnl_pct,
"reserve":RESERVE,"equity_history":equity_history[-600:],
"strategies":STRATEGIES,"trades":trades_log[-200:],"status":"running",
"strategies":STRATEGIES,"trades":trades_log[-200:],"status":"running","testnet_up":True,
"strategy_equity":{k: v[-600:] for k,v in strategy_equity.items()},
"open_positions":[],"open_orders":[]
}
@@ -180,7 +179,6 @@ async def main():
for inst in perps.values(): client.cache_instrument(inst)
except Exception as e:
log.warning(f"SDK instrument load failed: {e}")
# Fallback: load from raw API (mainnet) if SDK failed or returned empty
if not perps:
log.info("Loading perps from mainnet API directly...")
try: