Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions hyperliquid/info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
}

Expand Down
8 changes: 4 additions & 4 deletions hyperliquid/info_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down