diff --git a/config.json b/config.json index b44f0ee..810986d 100644 --- a/config.json +++ b/config.json @@ -1,10 +1,10 @@ { "test_mode": false, "trade_enabled": true, - "arb_threshold": 0.03, + "arb_threshold": 0.02, "scan_interval_ms": 200, - "trade_threshold": 0.10, - "trade_amount_usd": 10, + "trade_threshold": 0.05, + "trade_amount_usd": 20, "trade_cooldown_ms": 30000, "alert_cooldown_sec": 300, "mock_slippage_pct": 0.05, diff --git a/exchange/hyperliquid_trade.go b/exchange/hyperliquid_trade.go index 1ba9f30..37c285d 100644 --- a/exchange/hyperliquid_trade.go +++ b/exchange/hyperliquid_trade.go @@ -121,9 +121,11 @@ func (h *HyperLiquidTrade) PlaceMarketOrder(coin, side, sz string) (string, erro return string(respJSON), nil } -// GetTradeFee parses the MarketOpen JSON response to extract filled size and -// estimates the actual fee from the exchange taker rate. -func (h *HyperLiquidTrade) GetTradeFee(orderResponseJSON string, takerFeePct float64) (feeUSD float64, err error) { +// EstimateFeeFromResponse calculates the fee using the response's filled size × price +// × configured taker rate. This is NOT an actual fee from HL — HL does not return +// fee amounts in the order response. The result is equivalent to estimating from +// TradeAmountUSD, but more accurate for partial fills since it uses actual filled sz/px. +func (h *HyperLiquidTrade) EstimateFeeFromResponse(orderResponseJSON string, takerFeePct float64) (feeUSD float64, err error) { var resp struct { Statuses []struct { Filled *struct { diff --git a/trader.go b/trader.go index b810964..8d20e6d 100644 --- a/trader.go +++ b/trader.go @@ -1076,9 +1076,9 @@ func (t *Trader) placeOrder(leg *PositionLeg, side string, store *PriceStore) (s log.Printf("[ExRes] HL %s %s: size=%s", side, leg.Coin, size) // Estimate fee from filled response (HL doesn't return fee in order response) - fee, fetchErr := t.hyperliquid.GetTradeFee(resp, takerFees[ExHyperLiquid]) + fee, fetchErr := t.hyperliquid.EstimateFeeFromResponse(resp, takerFees[ExHyperLiquid]) if fetchErr != nil { - log.Printf("[Fee] HL GetTradeFee warning: %v", fetchErr) + log.Printf("[Fee] HL EstimateFeeFromResponse warning: %v", fetchErr) } else { log.Printf("[Fee] HL %s %s: actual fee=$%.6f", side, leg.Coin, fee) }