Skip to content

Commit 7045c3c

Browse files
Merge pull request #2 from Logarithm-Labs/fix-make-market-order-types
Fix FilledStatus types.
2 parents 783be2e + c5ea5c4 commit 7045c3c

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

hyperliquid/exchange_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package hyperliquid
22

33
import (
4+
"math"
45
"os"
56
"testing"
67
"time"
@@ -71,6 +72,14 @@ func TestExchangeAPI_MarketOpen(testing *testing.T) {
7172
testing.Errorf("MakeOpen() error = %v", err)
7273
}
7374
testing.Logf("MakeOpen() = %v", res)
75+
avgPrice := res.Response.Data.Statuses[0].Filled.AvgPx
76+
if avgPrice == 0 {
77+
testing.Errorf("res.Response.Data.Statuses[0].Filled.AvgPx = %v", avgPrice)
78+
}
79+
totalSize := res.Response.Data.Statuses[0].Filled.TotalSz
80+
if totalSize != math.Abs(size) {
81+
testing.Errorf("res.Response.Data.Statuses[0].Filled.TotalSz = %v", totalSize)
82+
}
7483
accountState, err := exchangeAPI.infoAPI.GetUserState(exchangeAPI.AccountAddress())
7584
if err != nil {
7685
testing.Errorf("GetAccountState() error = %v", err)

hyperliquid/exchange_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ type CloseRequest struct {
147147
}
148148

149149
type FilledStatus struct {
150-
OrderId int `json:"oid"`
151-
AvgPx string `json:"avgPx"`
152-
TotalSz string `json:"totalSz"`
150+
OrderId int `json:"oid"`
151+
AvgPx float64 `json:"avgPx,string"`
152+
TotalSz float64 `json:"totalSz,string"`
153153
}
154154

155155
type Liquidation struct {

0 commit comments

Comments
 (0)