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 EvmContract
- 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 ¶
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 AssetInfo ¶
func (AssetInfo) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (AssetInfo) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*AssetInfo) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*AssetInfo) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
type AssetPosition ¶
func (AssetPosition) MarshalEasyJSON ¶ added in v0.2.0
func (v AssetPosition) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (AssetPosition) MarshalJSON ¶ added in v0.2.0
func (v AssetPosition) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*AssetPosition) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *AssetPosition) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*AssetPosition) UnmarshalJSON ¶ added in v0.2.0
func (v *AssetPosition) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type BuilderInfo ¶
func (BuilderInfo) MarshalEasyJSON ¶ added in v0.2.0
func (v BuilderInfo) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (BuilderInfo) MarshalJSON ¶ added in v0.2.0
func (v BuilderInfo) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*BuilderInfo) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *BuilderInfo) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*BuilderInfo) UnmarshalJSON ¶ added in v0.2.0
func (v *BuilderInfo) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Candle ¶
type Candle struct {
Timestamp int64 `json:"T"`
Close string `json:"c"`
High string `json:"h"`
Interval string `json:"i"`
Low string `json:"l"`
Number int `json:"n"`
Open string `json:"o"`
Symbol string `json:"s"`
Time int64 `json:"t"`
Volume string `json:"v"`
}
func (Candle) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (Candle) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*Candle) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Candle) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
type EvmContract ¶ added in v0.2.0
type EvmContract struct {
Address string `json:"address"`
EvmExtraWeiDecimals int `json:"evm_extra_wei_decimals"`
}
func (EvmContract) MarshalEasyJSON ¶ added in v0.2.0
func (v EvmContract) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (EvmContract) MarshalJSON ¶ added in v0.2.0
func (v EvmContract) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*EvmContract) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *EvmContract) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*EvmContract) UnmarshalJSON ¶ added in v0.2.0
func (v *EvmContract) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
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 FeeSchedule struct {
Add string `json:"add"`
Cross string `json:"cross"`
ReferralDiscount string `json:"referralDiscount"`
Tiers Tiers `json:"tiers"`
}
func (FeeSchedule) MarshalEasyJSON ¶ added in v0.2.0
func (v FeeSchedule) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (FeeSchedule) MarshalJSON ¶ added in v0.2.0
func (v FeeSchedule) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*FeeSchedule) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *FeeSchedule) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*FeeSchedule) UnmarshalJSON ¶ added in v0.2.0
func (v *FeeSchedule) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
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"`
}
func (Fill) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (Fill) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*Fill) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Fill) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
type FundingHistory ¶
type FundingHistory struct {
Coin string `json:"coin"`
FundingRate string `json:"fundingRate"`
Premium string `json:"premium"`
Time int64 `json:"time"`
}
func (FundingHistory) MarshalEasyJSON ¶ added in v0.2.0
func (v FundingHistory) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (FundingHistory) MarshalJSON ¶ added in v0.2.0
func (v FundingHistory) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*FundingHistory) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *FundingHistory) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*FundingHistory) UnmarshalJSON ¶ added in v0.2.0
func (v *FundingHistory) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
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 L2Book ¶
type L2Book struct {
Coin string `json:"coin"`
Levels [][]Level `json:"levels"`
Time int64 `json:"time"`
}
func (L2Book) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (L2Book) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*L2Book) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*L2Book) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
type Level ¶
func (Level) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (Level) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*Level) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Level) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
type Leverage ¶
type Leverage struct {
Type string `json:"type"`
Value int `json:"value"`
RawUsd *string `json:"rawUsd,omitempty"`
}
func (Leverage) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (Leverage) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*Leverage) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Leverage) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
type LimitOrderType ¶
type LimitOrderType struct {
Tif string `json:"tif"` // "Alo", "Ioc", "Gtc"
}
func (LimitOrderType) MarshalEasyJSON ¶ added in v0.2.0
func (v LimitOrderType) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (LimitOrderType) MarshalJSON ¶ added in v0.2.0
func (v LimitOrderType) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*LimitOrderType) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *LimitOrderType) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*LimitOrderType) UnmarshalJSON ¶ added in v0.2.0
func (v *LimitOrderType) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type MMTier ¶
type MMTier struct {
Add string `json:"add"`
MakerFractionCutoff string `json:"makerFractionCutoff"`
}
func (MMTier) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (MMTier) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*MMTier) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*MMTier) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
type MarginSummary ¶
type MarginSummary struct {
AccountValue string `json:"accountValue"`
TotalMarginUsed string `json:"totalMarginUsed"`
TotalNtlPos string `json:"totalNtlPos"`
TotalRawUsd string `json:"totalRawUsd"`
}
func (MarginSummary) MarshalEasyJSON ¶ added in v0.2.0
func (v MarginSummary) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (MarginSummary) MarshalJSON ¶ added in v0.2.0
func (v MarginSummary) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*MarginSummary) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *MarginSummary) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*MarginSummary) UnmarshalJSON ¶ added in v0.2.0
func (v *MarginSummary) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Meta ¶
type Meta struct {
Universe []AssetInfo `json:"universe"`
}
func (Meta) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (Meta) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*Meta) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Meta) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
type MultiSigSigner ¶
func (MultiSigSigner) MarshalEasyJSON ¶ added in v0.2.0
func (v MultiSigSigner) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (MultiSigSigner) MarshalJSON ¶ added in v0.2.0
func (v MultiSigSigner) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*MultiSigSigner) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *MultiSigSigner) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*MultiSigSigner) UnmarshalJSON ¶ added in v0.2.0
func (v *MultiSigSigner) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type OpenOrder ¶
type OpenOrder struct {
Coin string `json:"coin"`
LimitPx float64 `json:"limitPx,string"`
Oid int64 `json:"oid"`
Side string `json:"side"`
Size float64 `json:"sz,string"`
Timestamp int64 `json:"timestamp"`
}
func (OpenOrder) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (OpenOrder) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*OpenOrder) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*OpenOrder) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
type OrderRequest ¶
type OrderRequest struct {
Coin string `json:"coin"`
IsBuy bool `json:"is_buy"`
Size float64 `json:"sz"`
LimitPx float64 `json:"limit_px"`
OrderType OrderType `json:"order_type"`
ReduceOnly bool `json:"reduce_only"`
Cloid *string `json:"cloid,omitempty"`
}
func (OrderRequest) MarshalEasyJSON ¶ added in v0.2.0
func (v OrderRequest) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (OrderRequest) MarshalJSON ¶ added in v0.2.0
func (v OrderRequest) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*OrderRequest) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *OrderRequest) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*OrderRequest) UnmarshalJSON ¶ added in v0.2.0
func (v *OrderRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type OrderType ¶
type OrderType struct {
Limit *LimitOrderType `json:"limit,omitempty"`
Trigger *TriggerOrderType `json:"trigger,omitempty"`
}
func (OrderType) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (OrderType) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*OrderType) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*OrderType) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
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
func (OrderWire) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (OrderWire) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*OrderWire) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*OrderWire) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
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"`
}
func (Position) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (Position) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*Position) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Position) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
type ReferralState ¶
type ReferralState struct {
ReferralCode string `json:"referralCode"`
Referrer string `json:"referrer"`
Referred []string `json:"referred"`
}
func (ReferralState) MarshalEasyJSON ¶ added in v0.2.0
func (v ReferralState) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ReferralState) MarshalJSON ¶ added in v0.2.0
func (v ReferralState) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ReferralState) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *ReferralState) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ReferralState) UnmarshalJSON ¶ added in v0.2.0
func (v *ReferralState) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type SpotAssetCtx ¶
type SpotAssetCtx struct {
DayNtlVlm string `json:"dayNtlVlm"`
MarkPx string `json:"markPx"`
MidPx *string `json:"midPx"`
PrevDayPx string `json:"prevDayPx"`
CirculatingSupply string `json:"circulatingSupply"`
Coin string `json:"coin"`
}
func (SpotAssetCtx) MarshalEasyJSON ¶ added in v0.2.0
func (v SpotAssetCtx) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (SpotAssetCtx) MarshalJSON ¶ added in v0.2.0
func (v SpotAssetCtx) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*SpotAssetCtx) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *SpotAssetCtx) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SpotAssetCtx) UnmarshalJSON ¶ added in v0.2.0
func (v *SpotAssetCtx) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type SpotAssetInfo ¶
type SpotAssetInfo struct {
Name string `json:"name"`
Tokens []int `json:"tokens"`
Index int `json:"index"`
IsCanonical bool `json:"isCanonical"`
}
func (SpotAssetInfo) MarshalEasyJSON ¶ added in v0.2.0
func (v SpotAssetInfo) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (SpotAssetInfo) MarshalJSON ¶ added in v0.2.0
func (v SpotAssetInfo) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*SpotAssetInfo) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *SpotAssetInfo) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SpotAssetInfo) UnmarshalJSON ¶ added in v0.2.0
func (v *SpotAssetInfo) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type SpotMeta ¶
type SpotMeta struct {
Universe []SpotAssetInfo `json:"universe"`
Tokens []SpotTokenInfo `json:"tokens"`
}
func (SpotMeta) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (SpotMeta) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*SpotMeta) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SpotMeta) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
type SpotTokenInfo ¶
type SpotTokenInfo 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"`
EvmContract *EvmContract `json:"evmContract"`
FullName *string `json:"fullName"`
}
func (SpotTokenInfo) MarshalEasyJSON ¶ added in v0.2.0
func (v SpotTokenInfo) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (SpotTokenInfo) MarshalJSON ¶ added in v0.2.0
func (v SpotTokenInfo) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*SpotTokenInfo) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *SpotTokenInfo) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SpotTokenInfo) UnmarshalJSON ¶ added in v0.2.0
func (v *SpotTokenInfo) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type StakingDelegation ¶
type StakingDelegation struct {
Validator string `json:"validator"`
Amount string `json:"amount"`
LockedUntilTimestamp int64 `json:"lockedUntilTimestamp"`
}
func (StakingDelegation) MarshalEasyJSON ¶ added in v0.2.0
func (v StakingDelegation) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (StakingDelegation) MarshalJSON ¶ added in v0.2.0
func (v StakingDelegation) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*StakingDelegation) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *StakingDelegation) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*StakingDelegation) UnmarshalJSON ¶ added in v0.2.0
func (v *StakingDelegation) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type StakingReward ¶
type StakingReward struct {
Time int64 `json:"time"`
Source string `json:"source"`
TotalAmount string `json:"totalAmount"`
}
func (StakingReward) MarshalEasyJSON ¶ added in v0.2.0
func (v StakingReward) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (StakingReward) MarshalJSON ¶ added in v0.2.0
func (v StakingReward) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*StakingReward) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *StakingReward) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*StakingReward) UnmarshalJSON ¶ added in v0.2.0
func (v *StakingReward) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type StakingSummary ¶
type StakingSummary struct {
Delegated string `json:"delegated"`
Undelegated string `json:"undelegated"`
TotalPendingWithdrawal string `json:"totalPendingWithdrawal"`
NPendingWithdrawals int `json:"nPendingWithdrawals"`
}
func (StakingSummary) MarshalEasyJSON ¶ added in v0.2.0
func (v StakingSummary) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (StakingSummary) MarshalJSON ¶ added in v0.2.0
func (v StakingSummary) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*StakingSummary) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *StakingSummary) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*StakingSummary) UnmarshalJSON ¶ added in v0.2.0
func (v *StakingSummary) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type SubAccount ¶
type SubAccount struct {
Name string `json:"name"`
User string `json:"user"`
Permissions []string `json:"permissions"`
}
func (SubAccount) MarshalEasyJSON ¶ added in v0.2.0
func (v SubAccount) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (SubAccount) MarshalJSON ¶ added in v0.2.0
func (v SubAccount) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*SubAccount) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *SubAccount) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*SubAccount) UnmarshalJSON ¶ added in v0.2.0
func (v *SubAccount) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Subscription ¶
type Subscription struct {
Type string `json:"type"`
Coin string `json:"coin,omitempty"`
User string `json:"user,omitempty"`
Interval string `json:"interval,omitempty"`
}
func (Subscription) MarshalEasyJSON ¶ added in v0.2.0
func (v Subscription) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (Subscription) MarshalJSON ¶ added in v0.2.0
func (v Subscription) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*Subscription) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *Subscription) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Subscription) UnmarshalJSON ¶ added in v0.2.0
func (v *Subscription) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Tiers ¶
func (Tiers) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (Tiers) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*Tiers) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Tiers) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
type Trade ¶
type Trade struct {
Coin string `json:"coin"`
Side string `json:"side"`
Px string `json:"px"`
Sz string `json:"sz"`
Time int64 `json:"time"`
Hash string `json:"hash"`
Tid int64 `json:"tid"`
Users []string `json:"users"`
}
func (Trade) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (Trade) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*Trade) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Trade) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
type TriggerOrderType ¶
type TriggerOrderType struct {
TriggerPx float64 `json:"triggerPx"`
IsMarket bool `json:"isMarket"`
Tpsl string `json:"tpsl"` // "tp" or "sl"
}
func (TriggerOrderType) MarshalEasyJSON ¶ added in v0.2.0
func (v TriggerOrderType) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (TriggerOrderType) MarshalJSON ¶ added in v0.2.0
func (v TriggerOrderType) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*TriggerOrderType) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *TriggerOrderType) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*TriggerOrderType) UnmarshalJSON ¶ added in v0.2.0
func (v *TriggerOrderType) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
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"`
}
func (UserFees) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (UserFees) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*UserFees) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*UserFees) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
type UserFundingHistory ¶
type UserFundingHistory struct {
User string `json:"user"`
Type string `json:"type"`
StartTime int64 `json:"startTime"`
EndTime int64 `json:"endTime"`
}
func (UserFundingHistory) MarshalEasyJSON ¶ added in v0.2.0
func (v UserFundingHistory) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (UserFundingHistory) MarshalJSON ¶ added in v0.2.0
func (v UserFundingHistory) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*UserFundingHistory) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *UserFundingHistory) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*UserFundingHistory) UnmarshalJSON ¶ added in v0.2.0
func (v *UserFundingHistory) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type UserState ¶
type UserState struct {
AssetPositions []AssetPosition `json:"assetPositions"`
CrossMarginSummary MarginSummary `json:"crossMarginSummary"`
MarginSummary MarginSummary `json:"marginSummary"`
Withdrawable string `json:"withdrawable"`
}
func (UserState) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (UserState) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*UserState) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*UserState) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
type UserVolume ¶
type UserVolume struct {
Date string `json:"date"`
Exchange string `json:"exchange"`
UserAdd string `json:"userAdd"`
UserCross string `json:"userCross"`
}
func (UserVolume) MarshalEasyJSON ¶ added in v0.2.0
func (v UserVolume) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (UserVolume) MarshalJSON ¶ added in v0.2.0
func (v UserVolume) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*UserVolume) UnmarshalEasyJSON ¶ added in v0.2.0
func (v *UserVolume) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*UserVolume) UnmarshalJSON ¶ added in v0.2.0
func (v *UserVolume) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type VIPTier ¶
type VIPTier struct {
Add string `json:"add"`
Cross string `json:"cross"`
NtlCutoff string `json:"ntlCutoff"`
}
func (VIPTier) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (VIPTier) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*VIPTier) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*VIPTier) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
type ValidationError ¶
func (ValidationError) Error ¶
func (e ValidationError) Error() string
type WSMessage ¶
type WSMessage struct {
Channel string `json:"channel"`
Data json.RawMessage `json:"data"`
}
func (WSMessage) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (WSMessage) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*WSMessage) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*WSMessage) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
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"`
}
func (WsCommand) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (WsCommand) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*WsCommand) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*WsCommand) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface
type WsMsg ¶
WebSocket message types
func (WsMsg) MarshalEasyJSON ¶ added in v0.2.0
MarshalEasyJSON supports easyjson.Marshaler interface
func (WsMsg) MarshalJSON ¶ added in v0.2.0
MarshalJSON supports json.Marshaler interface
func (*WsMsg) UnmarshalEasyJSON ¶ added in v0.2.0
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*WsMsg) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON supports json.Unmarshaler interface