Documentation
¶
Index ¶
- Constants
- func NormalizeOrderStatus(status string) exchanges.OrderStatus
- type Client
- func (c *Client) Close() error
- func (c *Client) Connect() error
- func (c *Client) Subscribe(topic string, handler func(MarketDepthMessage)) error
- func (c *Client) SubscribeOrderUpdates(userAddr string, handler func(OrderUpdateMessage)) error
- func (c *Client) SubscribeUserOrderHistory(userAddr string, handler func(UserOrderHistoryMessage)) error
- func (c *Client) SubscribeUserPositions(userAddr string, handler func(UserPositionsMessage)) error
- type DepthLevel
- type DepthUpdateType
- type MarketDepthMessage
- type OrderHistoryItem
- type OrderUpdateItem
- type OrderUpdateMessage
- type OrderUpdateRecord
- type Position
- type UserOrderHistoryMessage
- type UserPositionsMessage
Constants ¶
View Source
const ( MainnetWSURL = "wss://api.mainnet.aptoslabs.com/decibel/ws" TestnetWSURL = "wss://api.testnet.aptoslabs.com/decibel/ws" )
Variables ¶
This section is empty.
Functions ¶
func NormalizeOrderStatus ¶
func NormalizeOrderStatus(status string) exchanges.OrderStatus
Types ¶
type Client ¶
type Client struct {
URL string
Origin string
APIKey string
ReconnectWait time.Duration
PingInterval time.Duration
MaxReconnectAttempts int
StatusNormalizer func(string) exchanges.OrderStatus
// contains filtered or unexported fields
}
func (*Client) Subscribe ¶
func (c *Client) Subscribe(topic string, handler func(MarketDepthMessage)) error
func (*Client) SubscribeOrderUpdates ¶
func (c *Client) SubscribeOrderUpdates(userAddr string, handler func(OrderUpdateMessage)) error
func (*Client) SubscribeUserOrderHistory ¶
func (c *Client) SubscribeUserOrderHistory(userAddr string, handler func(UserOrderHistoryMessage)) error
func (*Client) SubscribeUserPositions ¶
func (c *Client) SubscribeUserPositions(userAddr string, handler func(UserPositionsMessage)) error
type DepthLevel ¶
type DepthUpdateType ¶
type DepthUpdateType string
const ( DepthUpdateSnapshot DepthUpdateType = "snapshot" DepthUpdateDelta DepthUpdateType = "delta" )
type MarketDepthMessage ¶
type MarketDepthMessage struct {
Topic string `json:"topic"`
Market string `json:"market"`
UpdateType DepthUpdateType `json:"update_type,omitempty"`
Bids []DepthLevel `json:"bids"`
Asks []DepthLevel `json:"asks"`
Timestamp int64 `json:"timestamp,omitempty"`
}
func (MarketDepthMessage) IsDelta ¶
func (m MarketDepthMessage) IsDelta() bool
type OrderHistoryItem ¶
type OrderHistoryItem struct {
OrderID string `json:"order_id,omitempty"`
ClientOrderID string `json:"client_order_id,omitempty"`
Status string `json:"status,omitempty"`
NormalizedStatus exchanges.OrderStatus `json:"-"`
OrderType string `json:"order_type,omitempty"`
Side string `json:"side,omitempty"`
Price decimal.Decimal `json:"price,omitempty"`
OrigSize decimal.Decimal `json:"orig_size,omitempty"`
RemainingSize decimal.Decimal `json:"remaining_size,omitempty"`
SizeDelta decimal.Decimal `json:"size_delta,omitempty"`
UnixMS int64 `json:"unix_ms,omitempty"`
}
type OrderUpdateItem ¶
type OrderUpdateItem struct {
ClientOrderID string `json:"client_order_id,omitempty"`
Market string `json:"market,omitempty"`
OrderID string `json:"order_id,omitempty"`
OrderType string `json:"order_type,omitempty"`
OrderDirection string `json:"order_direction,omitempty"`
Side string `json:"side,omitempty"`
IsBuy bool `json:"is_buy,omitempty"`
Status string `json:"status,omitempty"`
Details string `json:"details,omitempty"`
CancellationReason string `json:"cancellation_reason,omitempty"`
IsReduceOnly bool `json:"is_reduce_only,omitempty"`
UnixMS int64 `json:"unix_ms,omitempty"`
OrigSize decimal.Decimal `json:"orig_size,omitempty"`
Price decimal.Decimal `json:"price,omitempty"`
RemainingSize decimal.Decimal `json:"remaining_size,omitempty"`
SizeDelta decimal.Decimal `json:"size_delta,omitempty"`
}
type OrderUpdateMessage ¶
type OrderUpdateMessage struct {
Topic string `json:"topic"`
Order OrderUpdateRecord `json:"order"`
}
type OrderUpdateRecord ¶
type OrderUpdateRecord struct {
Status string `json:"status,omitempty"`
Details string `json:"details,omitempty"`
NormalizedStatus exchanges.OrderStatus `json:"-"`
Order OrderUpdateItem `json:"order"`
}
type UserOrderHistoryMessage ¶
type UserOrderHistoryMessage struct {
Topic string `json:"topic"`
Market string `json:"market,omitempty"`
Orders []OrderHistoryItem `json:"orders,omitempty"`
}
type UserPositionsMessage ¶
Click to show internal directories.
Click to hide internal directories.