diff --git a/hyperliquid/info_test.go b/hyperliquid/info_test.go index bd84b95..52ce96c 100644 --- a/hyperliquid/info_test.go +++ b/hyperliquid/info_test.go @@ -11,6 +11,9 @@ func GetInfoAPI() *InfoAPI { api.SetDebugActive() } TEST_ADDRESS := os.Getenv("TEST_ADDRESS") + if TEST_ADDRESS == "" { + panic("Set TEST_ADDRESS in .env file") + } api.SetAccountAddress(TEST_ADDRESS) return api } @@ -61,6 +64,17 @@ func TestInfoAPI_GetAccountFills(t *testing.T) { if len(*res) == 0 { t.Errorf("GetAccountFills() len = %v, want > %v", res, 0) } + res0 := (*res)[0] + t.Logf("res0 = %+v", res0) + if res0.Px == 0 { + t.Errorf("res0.Px = %v, want > %v", res0.Px, 0) + } + if res0.Sz == 0 { + t.Errorf("res0.Sz = %v, want > %v", res0.Sz, 0) + } + if res0.Fee == 0 { + t.Errorf("res0.Fee = %v, want > %v", res0.Fee, 0) + } t.Logf("GetAccountFills() = %v", res) } diff --git a/hyperliquid/info_types.go b/hyperliquid/info_types.go index 9f836ff..082d133 100644 --- a/hyperliquid/info_types.go +++ b/hyperliquid/info_types.go @@ -91,18 +91,18 @@ type Meta struct { type OrderFill struct { Cloid string `json:"cloid"` - ClosedPnl string `json:"closedPnl"` + ClosedPnl float64 `json:"closedPnl,string"` Coin string `json:"coin"` Crossed bool `json:"crossed"` Dir string `json:"dir"` - Fee string `json:"fee"` + Fee float64 `json:"fee,string"` FeeToken string `json:"feeToken"` Hash string `json:"hash"` Oid int `json:"oid"` - Px string `json:"px"` + Px float64 `json:"px,string"` Side string `json:"side"` StartPosition string `json:"startPosition"` - Sz string `json:"sz"` + Sz float64 `json:"sz,string"` Tid int64 `json:"tid"` Time int64 `json:"time"` Liquidation *Liquidation `json:"liquidation"`