mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-14 16:26:57 +08:00
fix:完善aster账户净值和盈亏计算|Improve the calculation of the net value and profit/loss of the aster account (#695)
Co-authored-by: LindenWang <linden@Lindens-MacBookPro-2.local>
This commit is contained in:
@@ -175,10 +175,10 @@ func (t *HyperliquidTrader) GetBalance() (map[string]interface{}, error) {
|
||||
// 原因:Spot 和 Perpetuals 是独立帐户,需手动 ClassTransfer 才能转账
|
||||
totalWalletBalance := walletBalanceWithoutUnrealized + spotUSDCBalance
|
||||
|
||||
result["totalWalletBalance"] = totalWalletBalance // 总资产(Perp + Spot)
|
||||
result["availableBalance"] = availableBalance // 可用余额(仅 Perpetuals,不含 Spot)
|
||||
result["totalUnrealizedProfit"] = totalUnrealizedPnl // 未实现盈亏(仅来自 Perpetuals)
|
||||
result["spotBalance"] = spotUSDCBalance // Spot 现货余额(单独返回)
|
||||
result["totalWalletBalance"] = totalWalletBalance // 总资产(Perp + Spot)
|
||||
result["availableBalance"] = availableBalance // 可用余额(仅 Perpetuals,不含 Spot)
|
||||
result["totalUnrealizedProfit"] = totalUnrealizedPnl // 未实现盈亏(仅来自 Perpetuals)
|
||||
result["spotBalance"] = spotUSDCBalance // Spot 现货余额(单独返回)
|
||||
|
||||
log.Printf("✓ Hyperliquid 完整账户:")
|
||||
log.Printf(" • Spot 现货余额: %.2f USDC (需手动转账到 Perpetuals 才能开仓)", spotUSDCBalance)
|
||||
@@ -551,7 +551,6 @@ func (t *HyperliquidTrader) CloseShort(symbol string, quantity float64) (map[str
|
||||
|
||||
// CancelStopOrders 取消该币种的止盈/止
|
||||
|
||||
|
||||
// CancelStopLossOrders 仅取消止损单(Hyperliquid 暂无法区分止损和止盈,取消所有)
|
||||
func (t *HyperliquidTrader) CancelStopLossOrders(symbol string) error {
|
||||
// Hyperliquid SDK 的 OpenOrder 结构不暴露 trigger 字段
|
||||
|
||||
Reference in New Issue
Block a user