spot

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balance

type Balance struct {
	Balances []struct {
		Coin     string `json:"coin"`
		Token    int64  `json:"token"`
		Hold     string `json:"hold"`
		Total    string `json:"total"`
		EntryNtl string `json:"entryNtl"`
	}
}

type CancelOrderRequest

type CancelOrderRequest struct {
	AssetID int
	OrderID int64
}

type CancelOrderResponse

type CancelOrderResponse struct {
	Statuses hyperliquid.MixedArray `json:"statuses"`
}

type Candle

type Candle struct {
	T      int64  `json:"t"` // Open time
	TClose int64  `json:"T"` // Close time
	S      string `json:"s"` // Symbol
	I      string `json:"i"` // Interval
	O      string `json:"o"` // Open
	C      string `json:"c"` // Close
	H      string `json:"h"` // High
	L      string `json:"l"` // Low
	V      string `json:"v"` // Volume
	N      int64  `json:"n"` // Number of trades
}

type CandleSnapshotRequest

type CandleSnapshotRequest struct {
	Coin      string `json:"coin"`
	Interval  string `json:"interval"`
	StartTime int64  `json:"startTime"`
	EndTime   int64  `json:"endTime"`
}

type Client

type Client struct {
	*hyperliquid.Client
}

func NewClient

func NewClient(base *hyperliquid.Client) *Client

func (*Client) AllMids

func (c *Client) AllMids(ctx context.Context) (map[string]string, error)

func (*Client) CancelOrder

func (c *Client) CancelOrder(ctx context.Context, req CancelOrderRequest) (*string, error)

func (*Client) CandleSnapshot

func (c *Client) CandleSnapshot(ctx context.Context, coin string, interval string, startTime, endTime int64) ([]Candle, error)

func (*Client) GetBalance

func (c *Client) GetBalance() (*Balance, error)

func (*Client) GetSpotMeta

func (c *Client) GetSpotMeta(ctx context.Context) (*SpotMeta, error)

func (*Client) L2Book

func (c *Client) L2Book(ctx context.Context, coin string) (*L2BookResponse, error)

func (*Client) ModifyOrder

func (c *Client) ModifyOrder(ctx context.Context, req ModifyOrderRequest) (*OrderStatus, error)

func (*Client) PlaceOrder

func (c *Client) PlaceOrder(ctx context.Context, req PlaceOrderRequest) (*OrderStatus, error)

func (*Client) UserOpenOrders

func (c *Client) UserOpenOrders(ctx context.Context, user string) ([]Order, error)

type L2BookResponse

type L2BookResponse struct {
	Coin   string      `json:"coin"`
	Levels [][]L2Level `json:"levels"`
	Time   int64       `json:"time"`
}

type L2Level

type L2Level struct {
	Px string `json:"px"`
	Sz string `json:"sz"`
	N  int    `json:"n"`
}

type ModifyOrderRequest

type ModifyOrderRequest struct {
	Oid   *int64
	Cloid *string
	Order PlaceOrderRequest
}

type ModifyOrderResponse

type ModifyOrderResponse struct {
	Statuses []OrderStatus `json:"statuses"`
}

type Order

type Order struct {
	Coin      string `json:"coin"`
	Side      string `json:"side"`
	LimitPx   string `json:"limitPx"`
	Sz        string `json:"sz"`
	Oid       int64  `json:"oid"`
	Timestamp int64  `json:"timestamp"`
	OrigSz    string `json:"origSz"`
}

type OrderFilled

type OrderFilled struct {
	TotalSz string `json:"totalSz"`
	AvgPx   string `json:"avgPx"`
	Oid     int    `json:"oid"`
}

type OrderResting

type OrderResting struct {
	Oid      int64   `json:"oid"`
	ClientID *string `json:"cloid"`
	Status   string  `json:"status"`
}

type OrderStatus

type OrderStatus struct {
	Resting *OrderResting `json:"resting,omitempty"`
	Filled  *OrderFilled  `json:"filled,omitempty"`
	Error   *string       `json:"error,omitempty"`
}

type OrderType

type OrderType struct {
	Limit   *OrderTypeLimit
	Trigger *OrderTypeTrigger
}

type OrderTypeLimit

type OrderTypeLimit struct {
	Tif hyperliquid.Tif
}

type OrderTypeTrigger

type OrderTypeTrigger struct {
	IsMarket  bool
	TriggerPx float64
	Tpsl      hyperliquid.Tpsl
}

type PlaceOrderRequest

type PlaceOrderRequest struct {
	AssetID       int
	IsBuy         bool
	Price         float64
	Size          float64
	OrderType     OrderType
	ClientOrderID *string
}

type PlaceOrderResponse

type PlaceOrderResponse struct {
	Statuses []OrderStatus `json:"statuses"`
}

type SpotMeta

type SpotMeta struct {
	Tokens []struct {
		Name        string `json:"name"`
		SzDecimals  int    `json:"szDecimals"`
		WeiDecimals int    `json:"weiDecimals"`
		Index       int    `json:"index"`
		TokenId     string `json:"tokenId"`
		IsCanonical bool   `json:"isCanonical"`
		FullName    string `json:"fullName,omitempty"`
	}
	Universe []struct {
		Name        string `json:"name"`
		Index       int    `json:"index"`
		Tokens      []int  `json:"tokens"`
		IsCanonical bool   `json:"isCanonical"`
	}
}

type WebsocketClient

type WebsocketClient struct {
	*hyperliquid.WebsocketClient
}

func NewWebsocketClient

func NewWebsocketClient(base *hyperliquid.WebsocketClient) *WebsocketClient

func (*WebsocketClient) CancelOrder

CancelOrder via WS

func (*WebsocketClient) ModifyOrder

ModifyOrder via WS

func (*WebsocketClient) PlaceOrder

PlaceOrder via WS

func (*WebsocketClient) SubscribeBbo

func (c *WebsocketClient) SubscribeBbo(coin string, handler func(hyperliquid.WsBbo)) error

func (*WebsocketClient) SubscribeCandle

func (c *WebsocketClient) SubscribeCandle(coin string, interval string, handler func(hyperliquid.WsCandle)) error

func (*WebsocketClient) SubscribeL2Book

func (c *WebsocketClient) SubscribeL2Book(coin string, handler func(hyperliquid.WsL2Book)) error

Helper to subscribe to L2Book

func (*WebsocketClient) SubscribeOrderUpdates

func (c *WebsocketClient) SubscribeOrderUpdates(user string, handler func([]hyperliquid.WsOrderUpdate)) error

SubscribeOrderUpdates

func (*WebsocketClient) SubscribeTrades

func (c *WebsocketClient) SubscribeTrades(coin string, handler func([]hyperliquid.WsTrade)) error

SubscribeTrades

func (*WebsocketClient) SubscribeUserEvents

func (c *WebsocketClient) SubscribeUserEvents(user string, handler func(hyperliquid.WsUserEvent)) error

SubscribeUserEvents

func (*WebsocketClient) SubscribeUserFills

func (c *WebsocketClient) SubscribeUserFills(user string, handler func(hyperliquid.WsUserFills)) error

SubscribeUserFills

func (*WebsocketClient) UnsubscribeBbo

func (c *WebsocketClient) UnsubscribeBbo(coin string) error

func (*WebsocketClient) UnsubscribeCandle

func (c *WebsocketClient) UnsubscribeCandle(coin string, interval string) error

func (*WebsocketClient) UnsubscribeL2Book

func (c *WebsocketClient) UnsubscribeL2Book(coin string) error

func (*WebsocketClient) UnsubscribeTrades

func (c *WebsocketClient) UnsubscribeTrades(coin string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL