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:
+1
-3
@@ -26,7 +26,6 @@ log = logging.getLogger("ftdt-quant")
|
|||||||
|
|
||||||
METRICS_FILE = "/tmp/ftdt-metrics.json"
|
METRICS_FILE = "/tmp/ftdt-metrics.json"
|
||||||
TESTNET_API = "https://api.hyperliquid-testnet.xyz/info"
|
TESTNET_API = "https://api.hyperliquid-testnet.xyz/info"
|
||||||
MAINNET_INFO = "https://api.hyperliquid.xyz/info"
|
|
||||||
TOTAL_EQUITY = 898.0
|
TOTAL_EQUITY = 898.0
|
||||||
RESERVE = 398.0
|
RESERVE = 398.0
|
||||||
MAKER_FEE = 0.0002
|
MAKER_FEE = 0.0002
|
||||||
@@ -99,7 +98,7 @@ def write_metrics(addr):
|
|||||||
"total_equity":TOTAL_EQUITY+total_pnl,"base_equity":TOTAL_EQUITY,
|
"total_equity":TOTAL_EQUITY+total_pnl,"base_equity":TOTAL_EQUITY,
|
||||||
"total_pnl":total_pnl,"total_pnl_pct":total_pnl_pct,
|
"total_pnl":total_pnl,"total_pnl_pct":total_pnl_pct,
|
||||||
"reserve":RESERVE,"equity_history":equity_history[-600:],
|
"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()},
|
"strategy_equity":{k: v[-600:] for k,v in strategy_equity.items()},
|
||||||
"open_positions":[],"open_orders":[]
|
"open_positions":[],"open_orders":[]
|
||||||
}
|
}
|
||||||
@@ -180,7 +179,6 @@ async def main():
|
|||||||
for inst in perps.values(): client.cache_instrument(inst)
|
for inst in perps.values(): client.cache_instrument(inst)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.warning(f"SDK instrument load failed: {e}")
|
log.warning(f"SDK instrument load failed: {e}")
|
||||||
# Fallback: load from raw API (mainnet) if SDK failed or returned empty
|
|
||||||
if not perps:
|
if not perps:
|
||||||
log.info("Loading perps from mainnet API directly...")
|
log.info("Loading perps from mainnet API directly...")
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user