Documentation
¶
Index ¶
- Constants
- func SignL1Action(privateKey *ecdsa.PrivateKey, action any, vaultAddress string, timestamp int64, ...) (string, error)
- type APIError
- type AssetInfo
- type AssetPosition
- type BuilderInfo
- type Candle
- type Client
- type Exchange
- func (e *Exchange) BulkOrders(orders []OrderRequest, builder *BuilderInfo) ([]OpenOrder, error)
- func (e *Exchange) Cancel(coin string, oid int64) (*OpenOrder, error)
- func (e *Exchange) CancelAll(coin string) ([]OpenOrder, error)
- func (e *Exchange) CancelByCloid(coin string, cloid string) (*OpenOrder, error)
- func (e *Exchange) Order(req OrderRequest, builder *BuilderInfo) (*OpenOrder, error)
- func (e *Exchange) Transfer(amount float64, destination string) (*UserState, error)
- func (e *Exchange) UpdateIsolatedMargin(coin string, margin float64) (*UserState, error)
- func (e *Exchange) UpdateLeverage(coin string, leverage int) (*UserState, error)
- func (e *Exchange) WithdrawEth(amount float64, destination string) (*UserState, error)
- func (e *Exchange) WithdrawUsdc(amount float64, destination string) (*UserState, error)
- type FeeSchedule
- type Fill
- type FundingHistory
- type Info
- func (i *Info) AllMids() (map[string]string, error)
- func (i *Info) CandlesSnapshot(name, interval string, startTime, endTime int64) ([]Candle, error)
- func (i *Info) FrontendOpenOrders(address string) ([]OpenOrder, error)
- func (i *Info) FundingHistory(name string, startTime int64, endTime *int64) ([]FundingHistory, error)
- func (i *Info) L2Snapshot(name string) (*L2Book, error)
- func (i *Info) Meta() (*Meta, error)
- func (i *Info) MetaAndAssetCtxs() (map[string]any, error)
- func (i *Info) NameToAsset(name string) int
- func (i *Info) OpenOrders(address string) ([]OpenOrder, error)
- func (i *Info) QueryOrderByCloid(user string, cloid string) (*OpenOrder, error)
- func (i *Info) QueryOrderByOid(user string, oid int64) (*OpenOrder, error)
- func (i *Info) QueryReferralState(user string) (*ReferralState, error)
- func (i *Info) QuerySubAccounts(user string) ([]SubAccount, error)
- func (i *Info) QueryUserToMultiSigSigners(multiSigUser string) ([]MultiSigSigner, error)
- func (i *Info) SpotMeta() (*SpotMeta, error)
- func (i *Info) SpotMetaAndAssetCtxs() (map[string]any, error)
- func (i *Info) SpotUserState(address string) (*UserState, error)
- func (i *Info) UserFees(address string) (*UserFees, error)
- func (i *Info) UserFills(address string) ([]Fill, error)
- func (i *Info) UserFillsByTime(address string, startTime int64, endTime *int64) ([]Fill, error)
- func (i *Info) UserFundingHistory(user string, startTime int64, endTime *int64) ([]UserFundingHistory, error)
- func (i *Info) UserStakingDelegations(address string) ([]StakingDelegation, error)
- func (i *Info) UserStakingRewards(address string) ([]StakingReward, error)
- func (i *Info) UserStakingSummary(address string) (*StakingSummary, error)
- func (i *Info) UserState(address string) (*UserState, error)
- type L2Book
- type Level
- type Leverage
- type LimitOrderType
- type MMTier
- type MarginSummary
- type Meta
- type MultiSigSigner
- type OpenOrder
- type OrderRequest
- type OrderType
- type OrderWire
- type Position
- type ReferralState
- type Side
- type SpotAssetCtx
- type SpotAssetInfo
- type SpotMeta
- type SpotTokenInfo
- type StakingDelegation
- type StakingReward
- type StakingSummary
- type SubAccount
- type Subscription
- type Tiers
- type Trade
- type TriggerOrderType
- type UserFees
- type UserFundingHistory
- type UserState
- type UserVolume
- type VIPTier
- type ValidationError
- type WSMessage
- type WebsocketClient
- func (w *WebsocketClient) Close() error
- func (w *WebsocketClient) Connect(ctx context.Context) error
- func (w *WebsocketClient) Subscribe(sub Subscription, callback func(WSMessage)) (int, error)
- func (w *WebsocketClient) SubscribeToOrderbook(coin string, callback func(WSMessage)) (int, error)
- func (w *WebsocketClient) SubscribeToTrades(coin string, callback func(WSMessage)) (int, error)
- func (w *WebsocketClient) Unsubscribe(sub Subscription, id int) error
- type WsCommand
- type WsMsg
Constants ¶
View Source
const ( MainnetAPIURL = "https://api.hyperliquid.xyz" TestnetAPIURL = "https://api.hyperliquid-testnet.xyz" LocalAPIURL = "http://localhost:3001" )
Variables ¶
This section is empty.
Functions ¶
func SignL1Action ¶
Types ¶
type APIError ¶
type AssetPosition ¶
type BuilderInfo ¶
type Exchange ¶
type Exchange struct {
// contains filtered or unexported fields
}
func NewExchange ¶
func (*Exchange) BulkOrders ¶
func (e *Exchange) BulkOrders(orders []OrderRequest, builder *BuilderInfo) ([]OpenOrder, error)
func (*Exchange) CancelByCloid ¶
func (*Exchange) Order ¶
func (e *Exchange) Order(req OrderRequest, builder *BuilderInfo) (*OpenOrder, error)
func (*Exchange) UpdateIsolatedMargin ¶
func (*Exchange) UpdateLeverage ¶
func (*Exchange) WithdrawEth ¶
type FeeSchedule ¶
type Fill ¶
type Fill struct { ClosedPnl string `json:"closedPnl"` Coin string `json:"coin"` Crossed bool `json:"crossed"` Dir string `json:"dir"` Hash string `json:"hash"` Oid int64 `json:"oid"` Price string `json:"px"` Side string `json:"side"` StartPosition string `json:"startPosition"` Size string `json:"sz"` Time int64 `json:"time"` }
type FundingHistory ¶
type Info ¶
type Info struct {
// contains filtered or unexported fields
}
func (*Info) CandlesSnapshot ¶
func (*Info) FrontendOpenOrders ¶
func (*Info) FundingHistory ¶
func (*Info) NameToAsset ¶
func (*Info) QueryOrderByCloid ¶
func (*Info) QueryOrderByOid ¶
func (*Info) QueryReferralState ¶
func (i *Info) QueryReferralState(user string) (*ReferralState, error)
func (*Info) QuerySubAccounts ¶
func (i *Info) QuerySubAccounts(user string) ([]SubAccount, error)
func (*Info) QueryUserToMultiSigSigners ¶
func (i *Info) QueryUserToMultiSigSigners(multiSigUser string) ([]MultiSigSigner, error)
func (*Info) UserFillsByTime ¶
func (*Info) UserFundingHistory ¶
func (*Info) UserStakingDelegations ¶
func (i *Info) UserStakingDelegations(address string) ([]StakingDelegation, error)
func (*Info) UserStakingRewards ¶
func (i *Info) UserStakingRewards(address string) ([]StakingReward, error)
func (*Info) UserStakingSummary ¶
func (i *Info) UserStakingSummary(address string) (*StakingSummary, error)
type LimitOrderType ¶
type LimitOrderType struct {
Tif string `json:"tif"` // "Alo", "Ioc", "Gtc"
}
type MarginSummary ¶
type MultiSigSigner ¶
type OrderRequest ¶
type OrderType ¶
type OrderType struct { Limit *LimitOrderType `json:"limit,omitempty"` Trigger *TriggerOrderType `json:"trigger,omitempty"` }
type OrderWire ¶
type OrderWire struct { Asset int `json:"a"` IsBuy bool `json:"b"` OrderType string `json:"t,omitempty"` LimitPx float64 `json:"p"` Size float64 `json:"s"` ReduceOnly bool `json:"r"` TriggerPx float64 `json:"tp,omitempty"` IsMarket bool `json:"im,omitempty"` Tpsl string `json:"tpsl,omitempty"` Tif string `json:"tif,omitempty"` Cloid string `json:"c,omitempty"` }
func OrderRequestToWire ¶
func OrderRequestToWire(req OrderRequest, asset int) OrderWire
type Position ¶
type Position struct { Coin string `json:"coin"` EntryPx *string `json:"entryPx"` Leverage Leverage `json:"leverage"` LiquidationPx *string `json:"liquidationPx"` MarginUsed string `json:"marginUsed"` PositionValue string `json:"positionValue"` ReturnOnEquity string `json:"returnOnEquity"` Szi string `json:"szi"` UnrealizedPnl string `json:"unrealizedPnl"` }
type ReferralState ¶
type SpotAssetCtx ¶
type SpotAssetInfo ¶
type SpotMeta ¶
type SpotMeta struct { Universe []SpotAssetInfo `json:"universe"` Tokens []SpotTokenInfo `json:"tokens"` }
type SpotTokenInfo ¶
type StakingDelegation ¶
type StakingReward ¶
type StakingSummary ¶
type SubAccount ¶
type Subscription ¶
type TriggerOrderType ¶
type UserFees ¶
type UserFees struct { ActiveReferralDiscount string `json:"activeReferralDiscount"` DailyUserVolume []UserVolume `json:"dailyUserVlm"` FeeSchedule FeeSchedule `json:"feeSchedule"` UserAddRate string `json:"userAddRate"` UserCrossRate string `json:"userCrossRate"` }
type UserFundingHistory ¶
type UserState ¶
type UserState struct { AssetPositions []AssetPosition `json:"assetPositions"` CrossMarginSummary MarginSummary `json:"crossMarginSummary"` MarginSummary MarginSummary `json:"marginSummary"` Withdrawable string `json:"withdrawable"` }
type UserVolume ¶
type ValidationError ¶
func (ValidationError) Error ¶
func (e ValidationError) Error() string
type WSMessage ¶
type WSMessage struct { Channel string `json:"channel"` Data json.RawMessage `json:"data"` }
type WebsocketClient ¶
type WebsocketClient struct {
// contains filtered or unexported fields
}
func NewWebsocketClient ¶
func NewWebsocketClient(baseURL string) *WebsocketClient
func (*WebsocketClient) Close ¶
func (w *WebsocketClient) Close() error
func (*WebsocketClient) Subscribe ¶
func (w *WebsocketClient) Subscribe(sub Subscription, callback func(WSMessage)) (int, error)
func (*WebsocketClient) SubscribeToOrderbook ¶
func (w *WebsocketClient) SubscribeToOrderbook(coin string, callback func(WSMessage)) (int, error)
func (*WebsocketClient) SubscribeToTrades ¶
func (w *WebsocketClient) SubscribeToTrades(coin string, callback func(WSMessage)) (int, error)
func (*WebsocketClient) Unsubscribe ¶
func (w *WebsocketClient) Unsubscribe(sub Subscription, id int) error
type WsCommand ¶ added in v0.1.2
type WsCommand struct { Method string `json:"method"` Subscription *Subscription `json:"subscription,omitempty"` }
Click to show internal directories.
Click to hide internal directories.