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
9 changes: 9 additions & 0 deletions hyperliquid/exchange_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package hyperliquid

import (
"math"
"os"
"testing"
"time"
Expand Down Expand Up @@ -71,6 +72,14 @@ func TestExchangeAPI_MarketOpen(testing *testing.T) {
testing.Errorf("MakeOpen() error = %v", err)
}
testing.Logf("MakeOpen() = %v", res)
avgPrice := res.Response.Data.Statuses[0].Filled.AvgPx
if avgPrice == 0 {
testing.Errorf("res.Response.Data.Statuses[0].Filled.AvgPx = %v", avgPrice)
}
totalSize := res.Response.Data.Statuses[0].Filled.TotalSz
if totalSize != math.Abs(size) {
testing.Errorf("res.Response.Data.Statuses[0].Filled.TotalSz = %v", totalSize)
}
accountState, err := exchangeAPI.infoAPI.GetUserState(exchangeAPI.AccountAddress())
if err != nil {
testing.Errorf("GetAccountState() error = %v", err)
Expand Down
6 changes: 3 additions & 3 deletions hyperliquid/exchange_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ type CloseRequest struct {
}

type FilledStatus struct {
OrderId int `json:"oid"`
AvgPx string `json:"avgPx"`
TotalSz string `json:"totalSz"`
OrderId int `json:"oid"`
AvgPx float64 `json:"avgPx,string"`
TotalSz float64 `json:"totalSz,string"`
}

type Liquidation struct {
Expand Down