Documentation
¶
Index ¶
- Constants
- func GetWSCredentials() (string, string, string)
- func NewCoinbaseClient(cfg *config.Config) (*client, error)
- func ParseResponse(message []byte) (interface{}, error)
- type Auth
- type HeartbeatResponse
- type OrderResponse
- type Response
- type ResponseType
- type Subscribe
- type SubscribeHeartbeat
- type TickerResponse
Constants ¶
View Source
const (
ErrRequireConfigParameters = "not correct input parameters"
)
Variables ¶
This section is empty.
Functions ¶
func GetWSCredentials ¶
func NewCoinbaseClient ¶
NewCoinbaseClient init client for Coinbase
func ParseResponse ¶
Types ¶
type HeartbeatResponse ¶
type HeartbeatResponse struct { Type string `json:"type"` Sequence int64 `json:"sequence"` LastTradeID int64 `json:"last_trade_id"` ProductID string `json:"product_id"` Time time.Time `json:"time"` }
func (*HeartbeatResponse) ToHeartbeat ¶
func (r *HeartbeatResponse) ToHeartbeat() (*entity.Heartbeat, error)
type OrderResponse ¶
type OrderResponse struct { Response Time time.Time `json:"time"` Sequence int `json:"sequence"` OrderID string `json:"order_id"` Size string `json:"size,omitempty"` // Only for limit orders Price string `json:"price,omitempty"` // Only for limit orders Funds string `json:"funds,omitempty"` // Only for market orders Side string `json:"side"` OrderType string `json:"order_type"` ClientOID string `json:"client-oid"` // Note the hyphen in the JSON tag RemainingSize string `json:"remaining_size,omitempty"` Reason string `json:"reason,omitempty"` TradeID int64 `json:"trade_id,omitempty"` // Only for match MakerOrderID string `json:"maker_order_id,omitempty"` // Only for match TakerOrderID string `json:"taker_order_id,omitempty"` // Only for match }
OrderResponse to handler all order data (received, open, done, match, etc.)
func (*OrderResponse) ToOrderResponse ¶
func (r *OrderResponse) ToOrderResponse() (*entity.Order, error)
Update the ToOrderResponse method to handle string conversions
type Response ¶
type Response struct { Type string `json:"type"` Message string `json:"message,omitempty"` Reason string `json:"reason,omitempty"` ProductID string `json:"product_id"` }
Base Response struct
type ResponseType ¶
type ResponseType int
const ( Error ResponseType = iota Subscriptions Unsubscribe Heartbeat Ticker Level2 Received Open Done Match Change )
func (ResponseType) String ¶
func (r ResponseType) String() string
func (*ResponseType) UnmarshalJSON ¶
func (r *ResponseType) UnmarshalJSON(v []byte) error
type SubscribeHeartbeat ¶
Click to show internal directories.
Click to hide internal directories.