fix: 修正注释位置 && 清理废弃的 GetHLSize

This commit is contained in:
jackyu66git
2026-05-04 22:52:45 +08:00
parent 9d942e9dee
commit c04d8ca0da
+1 -31
View File
@@ -126,11 +126,11 @@ func (h *HyperLiquidTrade) GetSize(coin string, amountUSD, price float64) string
}
}
// PlaceMarketOrder places a market order and returns the raw JSON response.
func (h *HyperLiquidTrade) IsConfigured() bool {
return h.configured
}
// PlaceMarketOrder places a market order and returns the raw JSON response.
func (h *HyperLiquidTrade) PlaceMarketOrder(coin, side, sz string) (string, error) {
if !h.configured {
return "", fmt.Errorf("HL not configured")
@@ -219,33 +219,3 @@ func (h *HyperLiquidTrade) GetBalance() (float64, error) {
}
return 0, fmt.Errorf("USDC balance not found in spot state")
}
func GetHLSize(coin string, amountUSD, price float64) string {
sz := amountUSD / price
switch coin {
// integer sizes (szDecimals=0)
case "DOGE", "ONDO", "WIF", "ALGO", "PYTH", "SAND", "ADA", "HBAR",
"IOTA", "FET", "JUP", "MOVE":
sz = math.Floor(sz)
if sz < 1 {
sz = 1
}
return fmt.Sprintf("%.0f", sz)
// 1 decimal (szDecimals=1)
case "OP", "ARB", "DYDX", "WLD", "SUI", "TIA", "NEAR", "FIL":
sz = math.Floor(sz*10) / 10
if sz < 0.1 {
sz = 0.1
}
return fmt.Sprintf("%.1f", sz)
// 2 decimals (szDecimals=2)
case "APT":
sz = math.Floor(sz*100) / 100
if sz < 0.01 {
sz = 0.01
}
return fmt.Sprintf("%.2f", sz)
default:
return fmt.Sprintf("%.4f", sz)
}
}