spot

package
v0.2.17 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 4 Imported by: 0 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 added in v0.2.9

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 added in v0.2.9

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 added in v0.2.9

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

func (*Client) PlaceOrder added in v0.2.9

func (c *Client) PlaceOrder(ctx context.Context, req PlaceOrderRequest) (*OrderStatus, 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 added in v0.2.9

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

type OrderFilled added in v0.2.9

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

type OrderResting added in v0.2.9

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

type OrderStatus added in v0.2.9

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 added in v0.2.9

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

func (c *WebsocketClient) CancelOrder(ctx context.Context, req CancelOrderRequest) (chan hyperliquid.PostResult, error)

CancelOrder via WS

func (*WebsocketClient) ModifyOrder

func (c *WebsocketClient) ModifyOrder(ctx context.Context, req ModifyOrderRequest) (chan hyperliquid.PostResult, error)

ModifyOrder via WS

func (*WebsocketClient) PlaceOrder

func (c *WebsocketClient) PlaceOrder(ctx context.Context, req PlaceOrderRequest) (chan hyperliquid.PostResult, error)

PlaceOrder via WS

func (*WebsocketClient) SubscribeBbo

func (c *WebsocketClient) SubscribeBbo(coin string, handler func(hyperliquid.WsBbo)) 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) 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