Documentation
¶
Overview ¶
Package hyperliquid provides a Go client library for the Hyperliquid exchange API. It includes support for both REST API and WebSocket connections, allowing users to access market data, manage orders, and handle user account operations.
Index ¶
- Constants
- func FloatToUsdInt(value float64) int
- func GetTimestampMs() int64
- type APIError
- type APIResponse
- type AgentApprovalResponse
- type ApprovalResponse
- type ApproveAgentAction
- type ApproveBuilderFeeAction
- type AssetInfo
- type AssetPosition
- type BatchModifyAction
- type BuilderInfo
- type BulkCancelResponse
- type BulkOrderResponse
- type CancelAction
- type CancelByCloidAction
- type CancelByCloidRequest
- type CancelByCloidWire
- type CancelOrderRequest
- type CancelOrderRequestByCloid
- type CancelOrderResponse
- type CancelOrderWire
- type CancelRequest
- type CancelResponse
- type Candle
- type Client
- type Cloid
- type ConvertToMultiSigUserAction
- type CreateOrderRequest
- type CreateSubAccountAction
- type CreateSubAccountResponse
- type EvmContract
- type Exchange
- func (e *Exchange) ApproveAgent(name *string) (*AgentApprovalResponse, string, error)
- func (e *Exchange) ApproveBuilderFee(builder string, maxFeeRate string) (*ApprovalResponse, error)
- func (e *Exchange) BulkCancel(requests []CancelOrderRequest) (res *APIResponse[CancelOrderResponse], err error)
- func (e *Exchange) BulkCancelByCloids(requests []CancelOrderRequestByCloid) (res *APIResponse[CancelOrderResponse], err error)
- func (e *Exchange) BulkModifyOrders(modifyRequests []ModifyOrderRequest) ([]OrderStatus, error)
- func (e *Exchange) BulkOrders(orders []CreateOrderRequest, builder *BuilderInfo) (result *APIResponse[OrderResponse], err error)
- func (e *Exchange) CSignerInner(innerAction map[string]any) (*ValidatorResponse, error)
- func (e *Exchange) CSignerJailSelf() (*ValidatorResponse, error)
- func (e *Exchange) CSignerUnjailSelf() (*ValidatorResponse, error)
- func (e *Exchange) CValidatorChangeProfile(newProfile map[string]any) (*ValidatorResponse, error)
- func (e *Exchange) CValidatorRegister(validatorProfile map[string]any) (*ValidatorResponse, error)
- func (e *Exchange) CValidatorUnregister() (*ValidatorResponse, error)
- func (e *Exchange) Cancel(coin string, oid int64) (res *APIResponse[CancelOrderResponse], err error)
- func (e *Exchange) CancelByCloid(coin, cloid string) (res *APIResponse[CancelOrderResponse], err error)
- func (e *Exchange) ConvertToMultiSigUser(authorizedUsers []string, threshold int) (*MultiSigConversionResponse, error)
- func (e *Exchange) CreateSubAccount(name string) (*CreateSubAccountResponse, error)
- func (e *Exchange) MarketClose(coin string, sz *float64, px *float64, slippage float64, cloid *string, ...) (OrderStatus, error)
- func (e *Exchange) MarketOpen(name string, isBuy bool, sz float64, px *float64, slippage float64, ...) (res OrderStatus, err error)
- func (e *Exchange) ModifyOrder(req ModifyOrderRequest) (result OrderStatus, err error)
- func (e *Exchange) MultiSig(action map[string]any, signers []string, signatures []string) (*MultiSigResponse, error)
- func (e *Exchange) Order(req CreateOrderRequest, builder *BuilderInfo) (result OrderStatus, err error)
- func (e *Exchange) PerpDeployRegisterAsset(asset string, perpDexInput PerpDexSchemaInput) (*PerpDeployResponse, error)
- func (e *Exchange) PerpDeploySetOracle(asset string, oracleAddress string) (*SpotDeployResponse, error)
- func (e *Exchange) PerpDexClassTransfer(dex, token string, amount float64, toPerp bool) (*TransferResponse, error)
- func (e *Exchange) ScheduleCancel(scheduleTime *int64) (*ScheduleCancelResponse, error)
- func (e *Exchange) SetExpiresAfter(expiresAfter *int64)
- func (e *Exchange) SetReferrer(code string) (*SetReferrerResponse, error)
- func (e *Exchange) SlippagePrice(name string, isBuy bool, slippage float64, px *float64) (float64, error)
- func (e *Exchange) SpotDeployEnableFreezePrivilege() (*SpotDeployResponse, error)
- func (e *Exchange) SpotDeployFreezeUser(userAddress string) (*SpotDeployResponse, error)
- func (e *Exchange) SpotDeployGenesis(deployer string, dexName string) (*SpotDeployResponse, error)
- func (e *Exchange) SpotDeployRegisterHyperliquidity(name string, tokens []string) (*SpotDeployResponse, error)
- func (e *Exchange) SpotDeployRegisterSpot(baseToken string, quoteToken string) (*SpotDeployResponse, error)
- func (e *Exchange) SpotDeployRegisterToken(tokenName string, szDecimals int, weiDecimals int, maxGas int, fullName string) (*SpotDeployResponse, error)
- func (e *Exchange) SpotDeployRevokeFreezePrivilege() (*SpotDeployResponse, error)
- func (e *Exchange) SpotDeploySetDeployerTradingFeeShare(feeShare float64) (*SpotDeployResponse, error)
- func (e *Exchange) SpotDeployUserGenesis(balances map[string]float64) (*SpotDeployResponse, error)
- func (e *Exchange) SpotTransfer(amount float64, destination, token string) (*TransferResponse, error)
- func (e *Exchange) SubAccountSpotTransfer(subAccountUser string, isDeposit bool, token string, amount float64) (*TransferResponse, error)
- func (e *Exchange) SubAccountTransfer(subAccountUser string, isDeposit bool, usd int) (*TransferResponse, error)
- func (e *Exchange) TokenDelegate(validator string, wei int, isUndelegate bool) (*TransferResponse, error)
- func (e *Exchange) UpdateIsolatedMargin(amount float64, name string) (*UserState, error)
- func (e *Exchange) UpdateLeverage(leverage int, name string, isCross bool) (*UserState, error)
- func (e *Exchange) UsdClassTransfer(amount float64, toPerp bool) (*TransferResponse, error)
- func (e *Exchange) UsdTransfer(amount float64, destination string) (*TransferResponse, error)
- func (e *Exchange) UseBigBlocks(enable bool) (*ApprovalResponse, error)
- func (e *Exchange) VaultUsdTransfer(vaultAddress string, isDeposit bool, usd int) (*TransferResponse, error)
- func (e *Exchange) WithdrawFromBridge(amount float64, destination string) (*TransferResponse, error)
- type FeeSchedule
- type Fill
- type FundingHistory
- type Grouping
- 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) PerpDexs() ([]string, error)
- func (i *Info) QueryOrderByCloid(user, 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 MixedArray
- type MixedValue
- func (mv *MixedValue) Array() ([]json.RawMessage, bool)
- func (mv MixedValue) MarshalJSON() ([]byte, error)
- func (mv *MixedValue) Object() (map[string]any, bool)
- func (mv *MixedValue) Parse(v any) error
- func (mv *MixedValue) String() (string, bool)
- func (mv *MixedValue) Type() string
- func (mv *MixedValue) UnmarshalJSON(data []byte) error
- type ModifyAction
- type ModifyOrderRequest
- type ModifyResponse
- type MultiSigAction
- type MultiSigConversionResponse
- type MultiSigResponse
- type MultiSigSigner
- type OpenOrder
- type OrderAction
- type OrderResponse
- type OrderStatus
- type OrderStatusFilled
- type OrderStatusResting
- type OrderType
- type OrderWire
- type PerpDeployResponse
- type PerpDexClassTransferAction
- type PerpDexSchemaInput
- type Position
- type ReferralState
- type ScheduleCancelAction
- type ScheduleCancelResponse
- type SetReferrerAction
- type SetReferrerResponse
- type Side
- type SignatureResult
- func SignAgent(privateKey *ecdsa.PrivateKey, agentAddress, agentName string, timestamp int64, ...) (SignatureResult, error)
- func SignApproveBuilderFee(privateKey *ecdsa.PrivateKey, builderAddress string, maxFeeRate float64, ...) (SignatureResult, error)
- func SignConvertToMultiSigUserAction(privateKey *ecdsa.PrivateKey, signers []string, threshold int, timestamp int64, ...) (SignatureResult, error)
- func SignL1Action(privateKey *ecdsa.PrivateKey, action any, vaultAddress string, timestamp int64, ...) (SignatureResult, error)
- func SignMultiSigAction(privateKey *ecdsa.PrivateKey, innerAction map[string]any, signers []string, ...) (SignatureResult, error)
- func SignPerpDexClassTransferAction(privateKey *ecdsa.PrivateKey, dex, token string, amount float64, toPerp bool, ...) (SignatureResult, error)
- func SignSpotTransferAction(privateKey *ecdsa.PrivateKey, amount float64, destination, token string, ...) (SignatureResult, error)
- func SignTokenDelegateAction(privateKey *ecdsa.PrivateKey, token string, amount float64, ...) (SignatureResult, error)
- func SignUsdClassTransferAction(privateKey *ecdsa.PrivateKey, amount float64, toPerp bool, timestamp int64, ...) (SignatureResult, error)
- func SignUsdTransferAction(privateKey *ecdsa.PrivateKey, amount float64, destination string, ...) (SignatureResult, error)
- func SignWithdrawFromBridgeAction(privateKey *ecdsa.PrivateKey, destination string, amount, fee float64, ...) (SignatureResult, error)
- type SpotAssetCtx
- type SpotAssetInfo
- type SpotDeployResponse
- type SpotMeta
- type SpotTokenInfo
- type SpotTransferAction
- type StakingDelegation
- type StakingReward
- type StakingSummary
- type SubAccount
- type SubAccountSpotTransferAction
- type SubAccountTransferAction
- type Subscription
- type Tiers
- type TokenDelegateAction
- type Trade
- type TransferResponse
- type TriggerOrderType
- type TxStatus
- type UpdateIsolatedMarginAction
- type UpdateLeverageAction
- type UsdClassTransferAction
- type UsdTransferAction
- type UseBigBlocksAction
- type UserFees
- type UserFundingHistory
- type UserState
- type UserVolume
- type VIPTier
- type ValidationError
- type ValidatorResponse
- type VaultUsdTransferAction
- 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) SubscribeToActiveAssetCtx(coin string, callback func(WSMessage)) (int, error)
- func (w *WebsocketClient) SubscribeToAllMids(callback func(WSMessage)) (int, error)
- func (w *WebsocketClient) SubscribeToBBO(coin string, callback func(WSMessage)) (int, error)
- func (w *WebsocketClient) SubscribeToCandles(coin, interval string, callback func(WSMessage)) (int, error)
- func (w *WebsocketClient) SubscribeToOrderUpdates(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) SubscribeToUserEvents(user string, callback func(WSMessage)) (int, error)
- func (w *WebsocketClient) SubscribeToUserFills(user string, callback func(WSMessage)) (int, error)
- func (w *WebsocketClient) SubscribeToUserFundings(user string, callback func(WSMessage)) (int, error)
- func (w *WebsocketClient) SubscribeToUserNonFundingLedgerUpdates(user string, callback func(WSMessage)) (int, error)
- func (w *WebsocketClient) SubscribeToWebData2(user string, callback func(WSMessage)) (int, error)
- func (w *WebsocketClient) Unsubscribe(sub Subscription, id int) error
- type WithdrawFromBridgeAction
- type WsCommand
- type WsMsg
Constants ¶
const ( MainnetAPIURL = "https://api.hyperliquid.xyz" TestnetAPIURL = "https://api.hyperliquid-testnet.xyz" LocalAPIURL = "http://localhost:3001" )
const ( TifAlo = "Alo" // Add Liquidity Only TifIoc = "Ioc" // Immediate or Cancel TifGtc = "Gtc" // Good Till Cancel )
Order Time-in-Force constants
const (
DefaultSlippage = 0.05 // 5%
)
Constants for default values
Variables ¶
This section is empty.
Functions ¶
func FloatToUsdInt ¶ added in v0.4.0
Utility function to convert float to USD integer representation
func GetTimestampMs ¶ added in v0.4.0
func GetTimestampMs() int64
GetTimestampMs returns current timestamp in milliseconds
Types ¶
type APIError ¶
type APIResponse ¶ added in v0.4.2
func (*APIResponse[T]) UnmarshalJSON ¶ added in v0.4.2
func (r *APIResponse[T]) UnmarshalJSON(data []byte) error
type AgentApprovalResponse ¶ added in v0.4.1
type ApprovalResponse ¶ added in v0.4.1
type ApproveAgentAction ¶ added in v0.4.5
type ApproveAgentAction struct {
Type string `json:"type" msgpack:"type"`
AgentAddress string `json:"agentAddress" msgpack:"agentAddress"`
AgentName *string `json:"agentName,omitempty" msgpack:"agentName,omitempty"`
Nonce int64 `json:"nonce" msgpack:"nonce"`
}
ApproveAgentAction represents approve agent action
type ApproveBuilderFeeAction ¶ added in v0.4.5
type ApproveBuilderFeeAction struct {
Type string `json:"type" msgpack:"type"`
Builder string `json:"builder" msgpack:"builder"`
MaxFeeRate string `json:"maxFeeRate" msgpack:"maxFeeRate"`
Nonce int64 `json:"nonce" msgpack:"nonce"`
}
ApproveBuilderFeeAction represents approve builder fee action
type AssetPosition ¶
type BatchModifyAction ¶ added in v0.4.5
type BatchModifyAction struct {
Type string `json:"type" msgpack:"type"`
Modifies []ModifyAction `json:"modifies" msgpack:"modifies"`
}
BatchModifyAction represents multiple order modifications
type BuilderInfo ¶
type BulkCancelResponse ¶ added in v0.4.1
type BulkOrderResponse ¶ added in v0.4.1
type BulkOrderResponse struct {
Status string `json:"status"`
Data []OrderStatus `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
type CancelAction ¶ added in v0.4.5
type CancelAction struct {
Type string `json:"type" msgpack:"type"`
Cancels []CancelOrderWire `json:"cancels" msgpack:"cancels"`
}
CancelAction represents the cancel action
type CancelByCloidAction ¶ added in v0.4.5
type CancelByCloidAction struct {
Type string `json:"type" msgpack:"type"`
Cancels []CancelByCloidWire `json:"cancels" msgpack:"cancels"`
}
CancelByCloidAction represents the cancel by cloid action
type CancelByCloidRequest ¶ added in v0.4.0
type CancelByCloidWire ¶ added in v0.4.5
type CancelByCloidWire struct {
Asset int `json:"a" msgpack:"a"`
OrderID string `json:"cloid" msgpack:"cloid"`
}
CancelByCloidWire represents cancel by cloid item wire format
type CancelOrderRequest ¶ added in v0.4.3
type CancelOrderRequestByCloid ¶ added in v0.4.3
type CancelOrderResponse ¶ added in v0.4.2
type CancelOrderResponse struct {
Statuses MixedArray
}
type CancelOrderWire ¶ added in v0.4.5
type CancelOrderWire struct {
Asset int `json:"a" msgpack:"a"`
OrderID string `json:"o" msgpack:"o"`
}
CancelOrderWire represents cancel order item wire format
type CancelRequest ¶ added in v0.4.0
type CancelResponse ¶ added in v0.4.1
type ConvertToMultiSigUserAction ¶ added in v0.4.5
type ConvertToMultiSigUserAction struct {
Type string `json:"type" msgpack:"type"`
Signers string `json:"signers" msgpack:"signers"`
Nonce int64 `json:"nonce" msgpack:"nonce"`
}
ConvertToMultiSigUserAction represents convert to multi-sig user action
type CreateOrderRequest ¶ added in v0.4.2
type CreateSubAccountAction ¶ added in v0.4.5
type CreateSubAccountAction struct {
Type string `json:"type" msgpack:"type"`
Name string `json:"name" msgpack:"name"`
}
CreateSubAccountAction represents create sub-account action
type CreateSubAccountResponse ¶ added in v0.4.1
type CreateSubAccountResponse struct {
Status string `json:"status"`
Data *SubAccount `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
type EvmContract ¶ added in v0.2.0
type Exchange ¶
type Exchange struct {
// contains filtered or unexported fields
}
func NewExchange ¶
func (*Exchange) ApproveAgent ¶ added in v0.4.0
func (e *Exchange) ApproveAgent(name *string) (*AgentApprovalResponse, string, error)
ApproveAgent approves an agent to trade on behalf of the user Returns the result and the generated agent private key
func (*Exchange) ApproveBuilderFee ¶ added in v0.4.0
func (e *Exchange) ApproveBuilderFee(builder string, maxFeeRate string) (*ApprovalResponse, error)
ApproveBuilderFee approves builder fee payment
func (*Exchange) BulkCancel ¶ added in v0.4.0
func (e *Exchange) BulkCancel( requests []CancelOrderRequest, ) (res *APIResponse[CancelOrderResponse], err error)
func (*Exchange) BulkCancelByCloids ¶ added in v0.4.3
func (e *Exchange) BulkCancelByCloids( requests []CancelOrderRequestByCloid, ) (res *APIResponse[CancelOrderResponse], err error)
func (*Exchange) BulkModifyOrders ¶ added in v0.4.0
func (e *Exchange) BulkModifyOrders( modifyRequests []ModifyOrderRequest, ) ([]OrderStatus, error)
BulkModifyOrders modifies multiple orders
func (*Exchange) BulkOrders ¶
func (e *Exchange) BulkOrders( orders []CreateOrderRequest, builder *BuilderInfo, ) (result *APIResponse[OrderResponse], err error)
func (*Exchange) CSignerInner ¶ added in v0.4.0
func (e *Exchange) CSignerInner(innerAction map[string]any) (*ValidatorResponse, error)
CSignerInner executes inner consensus signer action
func (*Exchange) CSignerJailSelf ¶ added in v0.4.0
func (e *Exchange) CSignerJailSelf() (*ValidatorResponse, error)
CSignerJailSelf jails self as consensus signer
func (*Exchange) CSignerUnjailSelf ¶ added in v0.4.0
func (e *Exchange) CSignerUnjailSelf() (*ValidatorResponse, error)
CSignerUnjailSelf unjails self as consensus signer
func (*Exchange) CValidatorChangeProfile ¶ added in v0.4.0
func (e *Exchange) CValidatorChangeProfile(newProfile map[string]any) (*ValidatorResponse, error)
CValidatorChangeProfile changes validator profile
func (*Exchange) CValidatorRegister ¶ added in v0.4.0
func (e *Exchange) CValidatorRegister(validatorProfile map[string]any) (*ValidatorResponse, error)
CValidatorRegister registers as consensus validator
func (*Exchange) CValidatorUnregister ¶ added in v0.4.0
func (e *Exchange) CValidatorUnregister() (*ValidatorResponse, error)
CValidatorUnregister unregisters as consensus validator
func (*Exchange) Cancel ¶
func (e *Exchange) Cancel( coin string, oid int64, ) (res *APIResponse[CancelOrderResponse], err error)
func (*Exchange) CancelByCloid ¶
func (e *Exchange) CancelByCloid( coin, cloid string, ) (res *APIResponse[CancelOrderResponse], err error)
func (*Exchange) ConvertToMultiSigUser ¶ added in v0.4.0
func (e *Exchange) ConvertToMultiSigUser( authorizedUsers []string, threshold int, ) (*MultiSigConversionResponse, error)
ConvertToMultiSigUser converts account to multi-signature user
func (*Exchange) CreateSubAccount ¶ added in v0.4.0
func (e *Exchange) CreateSubAccount(name string) (*CreateSubAccountResponse, error)
CreateSubAccount creates a new sub-account
func (*Exchange) MarketClose ¶ added in v0.4.0
func (e *Exchange) MarketClose( coin string, sz *float64, px *float64, slippage float64, cloid *string, builder *BuilderInfo, ) (OrderStatus, error)
MarketClose closes a position
func (*Exchange) MarketOpen ¶ added in v0.4.0
func (e *Exchange) MarketOpen( name string, isBuy bool, sz float64, px *float64, slippage float64, cloid *string, builder *BuilderInfo, ) (res OrderStatus, err error)
MarketOpen opens a market position
func (*Exchange) ModifyOrder ¶ added in v0.4.0
func (e *Exchange) ModifyOrder( req ModifyOrderRequest, ) (result OrderStatus, err error)
ModifyOrder modifies an existing order
func (*Exchange) Order ¶
func (e *Exchange) Order( req CreateOrderRequest, builder *BuilderInfo, ) (result OrderStatus, err error)
func (*Exchange) PerpDeployRegisterAsset ¶ added in v0.4.0
func (e *Exchange) PerpDeployRegisterAsset( asset string, perpDexInput PerpDexSchemaInput, ) (*PerpDeployResponse, error)
PerpDeployRegisterAsset registers a new perpetual asset
func (*Exchange) PerpDeploySetOracle ¶ added in v0.4.0
func (e *Exchange) PerpDeploySetOracle( asset string, oracleAddress string, ) (*SpotDeployResponse, error)
PerpDeploySetOracle sets oracle for perpetual asset
func (*Exchange) PerpDexClassTransfer ¶ added in v0.4.0
func (e *Exchange) PerpDexClassTransfer( dex, token string, amount float64, toPerp bool, ) (*TransferResponse, error)
PerpDexClassTransfer transfers tokens between perp dex classes
func (*Exchange) ScheduleCancel ¶ added in v0.4.0
func (e *Exchange) ScheduleCancel(scheduleTime *int64) (*ScheduleCancelResponse, error)
ScheduleCancel schedules cancellation of all open orders
func (*Exchange) SetExpiresAfter ¶ added in v0.4.0
SetExpiresAfter sets the expiration time for actions If expiresAfter is nil, actions will not have an expiration time If expiresAfter is set, actions will include this expiration timestamp
func (*Exchange) SetReferrer ¶ added in v0.4.0
func (e *Exchange) SetReferrer(code string) (*SetReferrerResponse, error)
SetReferrer sets a referral code
func (*Exchange) SlippagePrice ¶ added in v0.4.0
func (e *Exchange) SlippagePrice( name string, isBuy bool, slippage float64, px *float64, ) (float64, error)
SlippagePrice calculates the slippage price for market orders
func (*Exchange) SpotDeployEnableFreezePrivilege ¶ added in v0.4.0
func (e *Exchange) SpotDeployEnableFreezePrivilege() (*SpotDeployResponse, error)
SpotDeployEnableFreezePrivilege enables freeze privilege for spot deployer
func (*Exchange) SpotDeployFreezeUser ¶ added in v0.4.0
func (e *Exchange) SpotDeployFreezeUser(userAddress string) (*SpotDeployResponse, error)
SpotDeployFreezeUser freezes a user in spot trading
func (*Exchange) SpotDeployGenesis ¶ added in v0.4.0
func (e *Exchange) SpotDeployGenesis(deployer string, dexName string) (*SpotDeployResponse, error)
SpotDeployGenesis initializes spot genesis
func (*Exchange) SpotDeployRegisterHyperliquidity ¶ added in v0.4.0
func (e *Exchange) SpotDeployRegisterHyperliquidity( name string, tokens []string, ) (*SpotDeployResponse, error)
SpotDeployRegisterHyperliquidity registers hyperliquidity spot
func (*Exchange) SpotDeployRegisterSpot ¶ added in v0.4.0
func (e *Exchange) SpotDeployRegisterSpot( baseToken string, quoteToken string, ) (*SpotDeployResponse, error)
SpotDeployRegisterSpot registers spot market
func (*Exchange) SpotDeployRegisterToken ¶ added in v0.4.0
func (e *Exchange) SpotDeployRegisterToken( tokenName string, szDecimals int, weiDecimals int, maxGas int, fullName string, ) (*SpotDeployResponse, error)
SpotDeployRegisterToken registers a new spot token
func (*Exchange) SpotDeployRevokeFreezePrivilege ¶ added in v0.4.0
func (e *Exchange) SpotDeployRevokeFreezePrivilege() (*SpotDeployResponse, error)
SpotDeployRevokeFreezePrivilege revokes freeze privilege for spot deployer
func (*Exchange) SpotDeploySetDeployerTradingFeeShare ¶ added in v0.4.0
func (e *Exchange) SpotDeploySetDeployerTradingFeeShare( feeShare float64, ) (*SpotDeployResponse, error)
SpotDeploySetDeployerTradingFeeShare sets deployer trading fee share
func (*Exchange) SpotDeployUserGenesis ¶ added in v0.4.0
func (e *Exchange) SpotDeployUserGenesis(balances map[string]float64) (*SpotDeployResponse, error)
SpotDeployUserGenesis initializes user genesis for spot trading
func (*Exchange) SpotTransfer ¶ added in v0.4.0
func (e *Exchange) SpotTransfer( amount float64, destination, token string, ) (*TransferResponse, error)
SpotTransfer transfers spot tokens to another address
func (*Exchange) SubAccountSpotTransfer ¶ added in v0.4.0
func (e *Exchange) SubAccountSpotTransfer( subAccountUser string, isDeposit bool, token string, amount float64, ) (*TransferResponse, error)
SubAccountSpotTransfer transfers spot tokens to/from sub-account
func (*Exchange) SubAccountTransfer ¶ added in v0.4.0
func (e *Exchange) SubAccountTransfer( subAccountUser string, isDeposit bool, usd int, ) (*TransferResponse, error)
SubAccountTransfer transfers funds to/from sub-account
func (*Exchange) TokenDelegate ¶ added in v0.4.0
func (e *Exchange) TokenDelegate( validator string, wei int, isUndelegate bool, ) (*TransferResponse, error)
TokenDelegate delegates tokens for staking
func (*Exchange) UpdateIsolatedMargin ¶
func (*Exchange) UpdateLeverage ¶
func (*Exchange) UsdClassTransfer ¶ added in v0.4.0
func (e *Exchange) UsdClassTransfer(amount float64, toPerp bool) (*TransferResponse, error)
UsdClassTransfer transfers between USD classes
func (*Exchange) UsdTransfer ¶ added in v0.4.0
func (e *Exchange) UsdTransfer(amount float64, destination string) (*TransferResponse, error)
UsdTransfer transfers USD to another address
func (*Exchange) UseBigBlocks ¶ added in v0.4.0
func (e *Exchange) UseBigBlocks(enable bool) (*ApprovalResponse, error)
UseBigBlocks enables or disables big blocks
func (*Exchange) VaultUsdTransfer ¶ added in v0.4.0
func (e *Exchange) VaultUsdTransfer( vaultAddress string, isDeposit bool, usd int, ) (*TransferResponse, error)
VaultUsdTransfer transfers to/from vault
func (*Exchange) WithdrawFromBridge ¶ added in v0.4.0
func (e *Exchange) WithdrawFromBridge( amount float64, destination string, ) (*TransferResponse, error)
WithdrawFromBridge withdraws tokens from bridge
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"` // TifAlo, TifIoc, TifGtc
}
type MarginSummary ¶
type MixedArray ¶ added in v0.4.2
type MixedArray []MixedValue
func (*MixedArray) UnmarshalJSON ¶ added in v0.4.2
func (ma *MixedArray) UnmarshalJSON(data []byte) error
type MixedValue ¶ added in v0.4.2
type MixedValue json.RawMessage
func (*MixedValue) Array ¶ added in v0.4.2
func (mv *MixedValue) Array() ([]json.RawMessage, bool)
func (MixedValue) MarshalJSON ¶ added in v0.4.2
func (mv MixedValue) MarshalJSON() ([]byte, error)
func (*MixedValue) Parse ¶ added in v0.4.2
func (mv *MixedValue) Parse(v any) error
func (*MixedValue) String ¶ added in v0.4.2
func (mv *MixedValue) String() (string, bool)
func (*MixedValue) Type ¶ added in v0.4.2
func (mv *MixedValue) Type() string
func (*MixedValue) UnmarshalJSON ¶ added in v0.4.2
func (mv *MixedValue) UnmarshalJSON(data []byte) error
type ModifyAction ¶ added in v0.4.5
type ModifyAction struct {
Type string `json:"type" msgpack:"type"`
Oid any `json:"oid" msgpack:"oid"`
Order OrderWire `json:"order" msgpack:"order"`
}
ModifyAction represents a single order modification
type ModifyOrderRequest ¶ added in v0.4.2
type ModifyOrderRequest struct {
Oid any // can be int64 or Cloid
Order CreateOrderRequest
}
type ModifyResponse ¶ added in v0.4.1
type ModifyResponse struct {
Status string `json:"status"`
Data []OrderStatus `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
type MultiSigAction ¶ added in v0.4.5
type MultiSigAction struct {
Type string `json:"type" msgpack:"type"`
Action map[string]any `json:"action" msgpack:"action"`
Signers []string `json:"signers" msgpack:"signers"`
Signatures []string `json:"signatures" msgpack:"signatures"`
}
MultiSigAction represents multi-signature action
type MultiSigConversionResponse ¶ added in v0.4.1
type MultiSigResponse ¶ added in v0.4.1
type MultiSigSigner ¶
type OrderAction ¶ added in v0.4.5
type OrderAction struct {
Type string `json:"type" msgpack:"type"`
Orders []OrderWire `json:"orders" msgpack:"orders"`
Grouping string `json:"grouping" msgpack:"grouping"`
Builder *BuilderInfo `json:"builder,omitempty" msgpack:"builder,omitempty"`
}
OrderAction represents the order action with deterministic field ordering
type OrderResponse ¶ added in v0.4.1
type OrderResponse struct {
Statuses []OrderStatus
}
type OrderStatus ¶ added in v0.4.0
type OrderStatus struct {
Resting *OrderStatusResting `json:"resting,omitempty"`
Filled *OrderStatusFilled `json:"filled,omitempty"`
Error *string `json:"error,omitempty"`
}
func (*OrderStatus) String ¶ added in v0.4.7
func (s *OrderStatus) String() string
type OrderStatusFilled ¶ added in v0.4.2
type OrderStatusResting ¶ added in v0.4.2
type OrderType ¶
type OrderType struct {
Limit *LimitOrderType `json:"limit,omitempty"`
Trigger *TriggerOrderType `json:"trigger,omitempty"`
}
type OrderWire ¶
type OrderWire struct {
Asset int `json:"a" msgpack:"a"`
IsBuy bool `json:"b" msgpack:"b"`
LimitPx string `json:"p" msgpack:"p"`
Size string `json:"s" msgpack:"s"`
ReduceOnly bool `json:"r" msgpack:"r"`
OrderType map[string]any `json:"t" msgpack:"t"`
Cloid *string `json:"c,omitempty" msgpack:"c,omitempty"`
}
OrderWire represents the wire format for orders with deterministic field ordering
type PerpDeployResponse ¶ added in v0.4.1
type PerpDexClassTransferAction ¶ added in v0.4.5
type PerpDexClassTransferAction struct {
Type string `json:"type" msgpack:"type"`
Dex string `json:"dex" msgpack:"dex"`
Token string `json:"token" msgpack:"token"`
Amount float64 `json:"amount" msgpack:"amount"`
ToPerp bool `json:"toPerp" msgpack:"toPerp"`
}
PerpDexClassTransferAction represents perp dex class transfer
type PerpDexSchemaInput ¶ added in v0.4.0
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 ScheduleCancelAction ¶ added in v0.4.0
type ScheduleCancelAction struct {
Type string `json:"type" msgpack:"type"`
Time *int64 `json:"time,omitempty" msgpack:"time,omitempty"`
}
ScheduleCancelAction represents schedule cancel action
type ScheduleCancelResponse ¶ added in v0.4.1
type SetReferrerAction ¶ added in v0.4.5
type SetReferrerAction struct {
Type string `json:"type" msgpack:"type"`
Code string `json:"code" msgpack:"code"`
}
SetReferrerAction represents set referrer action
type SetReferrerResponse ¶ added in v0.4.1
type SignatureResult ¶ added in v0.4.2
SignatureResult represents the structured signature result
func SignAgent ¶ added in v0.4.0
func SignAgent( privateKey *ecdsa.PrivateKey, agentAddress, agentName string, timestamp int64, isMainnet bool, ) (SignatureResult, error)
SignAgent signs agent approval action
func SignApproveBuilderFee ¶ added in v0.4.0
func SignApproveBuilderFee( privateKey *ecdsa.PrivateKey, builderAddress string, maxFeeRate float64, timestamp int64, isMainnet bool, ) (SignatureResult, error)
SignApproveBuilderFee signs approve builder fee action
func SignConvertToMultiSigUserAction ¶ added in v0.4.0
func SignConvertToMultiSigUserAction( privateKey *ecdsa.PrivateKey, signers []string, threshold int, timestamp int64, isMainnet bool, ) (SignatureResult, error)
SignConvertToMultiSigUserAction signs convert to multi-sig user action
func SignL1Action ¶
func SignL1Action( privateKey *ecdsa.PrivateKey, action any, vaultAddress string, timestamp int64, expiresAfter *int64, isMainnet bool, ) (SignatureResult, error)
SignL1Action implements the same logic as Python's sign_l1_action
func SignMultiSigAction ¶ added in v0.4.0
func SignMultiSigAction( privateKey *ecdsa.PrivateKey, innerAction map[string]any, signers []string, signatures []string, timestamp int64, isMainnet bool, ) (SignatureResult, error)
SignMultiSigAction signs multi-signature action
func SignPerpDexClassTransferAction ¶ added in v0.4.0
func SignPerpDexClassTransferAction( privateKey *ecdsa.PrivateKey, dex, token string, amount float64, toPerp bool, timestamp int64, isMainnet bool, ) (SignatureResult, error)
SignPerpDexClassTransferAction signs perp dex class transfer action
func SignSpotTransferAction ¶ added in v0.4.0
func SignSpotTransferAction( privateKey *ecdsa.PrivateKey, amount float64, destination, token string, timestamp int64, isMainnet bool, ) (SignatureResult, error)
SignSpotTransferAction signs spot transfer action
func SignTokenDelegateAction ¶ added in v0.4.0
func SignTokenDelegateAction( privateKey *ecdsa.PrivateKey, token string, amount float64, validatorAddress string, timestamp int64, isMainnet bool, ) (SignatureResult, error)
SignTokenDelegateAction signs token delegate action
func SignUsdClassTransferAction ¶ added in v0.4.0
func SignUsdClassTransferAction( privateKey *ecdsa.PrivateKey, amount float64, toPerp bool, timestamp int64, isMainnet bool, ) (SignatureResult, error)
SignUsdClassTransferAction signs USD class transfer action
func SignUsdTransferAction ¶ added in v0.4.0
func SignUsdTransferAction( privateKey *ecdsa.PrivateKey, amount float64, destination string, timestamp int64, isMainnet bool, ) (SignatureResult, error)
SignUsdTransferAction signs USD transfer action
func SignWithdrawFromBridgeAction ¶ added in v0.4.0
func SignWithdrawFromBridgeAction( privateKey *ecdsa.PrivateKey, destination string, amount, fee float64, timestamp int64, isMainnet bool, ) (SignatureResult, error)
SignWithdrawFromBridgeAction signs withdraw from bridge action
type SpotAssetCtx ¶
type SpotAssetInfo ¶
type SpotDeployResponse ¶ added in v0.4.1
type SpotMeta ¶
type SpotMeta struct {
Universe []SpotAssetInfo `json:"universe"`
Tokens []SpotTokenInfo `json:"tokens"`
}
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"`
}
type SpotTransferAction ¶ added in v0.4.5
type SpotTransferAction struct {
Type string `json:"type" msgpack:"type"`
Destination string `json:"destination" msgpack:"destination"`
Amount string `json:"amount" msgpack:"amount"`
Token string `json:"token" msgpack:"token"`
Time int64 `json:"time" msgpack:"time"`
}
SpotTransferAction represents spot transfer
type StakingDelegation ¶
type StakingReward ¶
type StakingSummary ¶
type SubAccount ¶
type SubAccountSpotTransferAction ¶ added in v0.4.5
type SubAccountSpotTransferAction struct {
Type string `json:"type" msgpack:"type"`
SubAccountUser string `json:"subAccountUser" msgpack:"subAccountUser"`
IsDeposit bool `json:"isDeposit" msgpack:"isDeposit"`
Token string `json:"token" msgpack:"token"`
Amount float64 `json:"amount" msgpack:"amount"`
}
SubAccountSpotTransferAction represents sub-account spot transfer
type SubAccountTransferAction ¶ added in v0.4.5
type SubAccountTransferAction struct {
Type string `json:"type" msgpack:"type"`
SubAccountUser string `json:"subAccountUser" msgpack:"subAccountUser"`
IsDeposit bool `json:"isDeposit" msgpack:"isDeposit"`
Usd int `json:"usd" msgpack:"usd"`
}
SubAccountTransferAction represents sub-account transfer
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 TokenDelegateAction ¶ added in v0.4.5
type TokenDelegateAction struct {
Type string `json:"type" msgpack:"type"`
Validator string `json:"validator" msgpack:"validator"`
Wei int `json:"wei" msgpack:"wei"`
IsUndelegate bool `json:"isUndelegate" msgpack:"isUndelegate"`
Nonce int64 `json:"nonce" msgpack:"nonce"`
}
TokenDelegateAction represents token delegate action
type TransferResponse ¶ added in v0.4.1
type TriggerOrderType ¶
type UpdateIsolatedMarginAction ¶ added in v0.4.5
type UpdateIsolatedMarginAction struct {
Type string `json:"type" msgpack:"type"`
Asset int `json:"asset" msgpack:"asset"`
IsBuy bool `json:"isBuy" msgpack:"isBuy"`
Ntli float64 `json:"ntli" msgpack:"ntli"`
}
UpdateIsolatedMarginAction represents isolated margin update
type UpdateLeverageAction ¶ added in v0.4.5
type UpdateLeverageAction struct {
Type string `json:"type" msgpack:"type"`
Asset int `json:"asset" msgpack:"asset"`
Leverage map[string]any `json:"leverage" msgpack:"leverage"`
}
UpdateLeverageAction represents leverage update
type UsdClassTransferAction ¶ added in v0.4.5
type UsdClassTransferAction struct {
Type string `json:"type" msgpack:"type"`
Amount string `json:"amount" msgpack:"amount"`
ToPerp bool `json:"toPerp" msgpack:"toPerp"`
Nonce int64 `json:"nonce" msgpack:"nonce"`
}
UsdClassTransferAction represents USD class transfer
type UsdTransferAction ¶ added in v0.4.5
type UsdTransferAction struct {
Type string `json:"type" msgpack:"type"`
Destination string `json:"destination" msgpack:"destination"`
Amount string `json:"amount" msgpack:"amount"`
Time int64 `json:"time" msgpack:"time"`
}
UsdTransferAction represents USD transfer
type UseBigBlocksAction ¶ added in v0.4.5
type UseBigBlocksAction struct {
Type string `json:"type" msgpack:"type"`
UsingBigBlocks bool `json:"usingBigBlocks" msgpack:"usingBigBlocks"`
}
UseBigBlocksAction represents use big blocks action
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 ValidatorResponse ¶ added in v0.4.1
type VaultUsdTransferAction ¶ added in v0.4.5
type VaultUsdTransferAction struct {
Type string `json:"type" msgpack:"type"`
VaultAddress string `json:"vaultAddress" msgpack:"vaultAddress"`
IsDeposit bool `json:"isDeposit" msgpack:"isDeposit"`
Usd int `json:"usd" msgpack:"usd"`
}
VaultUsdTransferAction represents vault USD transfer
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) SubscribeToActiveAssetCtx ¶ added in v0.4.0
func (w *WebsocketClient) SubscribeToActiveAssetCtx( coin string, callback func(WSMessage), ) (int, error)
SubscribeToActiveAssetCtx subscribes to active asset context
func (*WebsocketClient) SubscribeToAllMids ¶ added in v0.4.0
func (w *WebsocketClient) SubscribeToAllMids(callback func(WSMessage)) (int, error)
SubscribeToAllMids subscribes to all mid prices
func (*WebsocketClient) SubscribeToBBO ¶ added in v0.4.0
func (w *WebsocketClient) SubscribeToBBO(coin string, callback func(WSMessage)) (int, error)
SubscribeToBBO subscribes to best bid/offer data
func (*WebsocketClient) SubscribeToCandles ¶ added in v0.4.0
func (w *WebsocketClient) SubscribeToCandles( coin, interval string, callback func(WSMessage), ) (int, error)
SubscribeToCandles subscribes to candle data
func (*WebsocketClient) SubscribeToOrderUpdates ¶ added in v0.4.0
func (w *WebsocketClient) SubscribeToOrderUpdates(callback func(WSMessage)) (int, error)
SubscribeToOrderUpdates subscribes to order updates
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) SubscribeToUserEvents ¶ added in v0.4.0
func (w *WebsocketClient) SubscribeToUserEvents( user string, callback func(WSMessage), ) (int, error)
SubscribeToUserEvents subscribes to user events
func (*WebsocketClient) SubscribeToUserFills ¶ added in v0.4.0
func (w *WebsocketClient) SubscribeToUserFills(user string, callback func(WSMessage)) (int, error)
SubscribeToUserFills subscribes to user fills
func (*WebsocketClient) SubscribeToUserFundings ¶ added in v0.4.0
func (w *WebsocketClient) SubscribeToUserFundings( user string, callback func(WSMessage), ) (int, error)
SubscribeToUserFundings subscribes to user funding updates
func (*WebsocketClient) SubscribeToUserNonFundingLedgerUpdates ¶ added in v0.4.0
func (w *WebsocketClient) SubscribeToUserNonFundingLedgerUpdates( user string, callback func(WSMessage), ) (int, error)
SubscribeToUserNonFundingLedgerUpdates subscribes to user non-funding ledger updates
func (*WebsocketClient) SubscribeToWebData2 ¶ added in v0.4.0
func (w *WebsocketClient) SubscribeToWebData2(user string, callback func(WSMessage)) (int, error)
SubscribeToWebData2 subscribes to web data v2
func (*WebsocketClient) Unsubscribe ¶
func (w *WebsocketClient) Unsubscribe(sub Subscription, id int) error
type WithdrawFromBridgeAction ¶ added in v0.4.5
type WithdrawFromBridgeAction struct {
Type string `json:"type" msgpack:"type"`
Destination string `json:"destination" msgpack:"destination"`
Amount string `json:"amount" msgpack:"amount"`
Time int64 `json:"time" msgpack:"time"`
}
WithdrawFromBridgeAction represents withdraw from bridge action
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