Documentation
¶
Overview ¶
Code generated by go generate; DO NOT EDIT. generated on 2025-03-10 16:00:56.10256 +0000 UTC
Index ¶
- Constants
- func FNV64a(text string) uint64
- type ActivateMessage
- type AuctionMessage
- type BalanceMessage
- type ChangeMessage
- type DoneMessage
- type ErrorMessage
- type Exchange
- func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) error
- func (e *Exchange) CancelOrdersBySymbol(ctx context.Context, symbol string) ([]types.Order, error)
- func (e *Exchange) Client() *api.RestAPIClient
- func (e *Exchange) IsSupportedInterval(interval types.Interval) bool
- func (e *Exchange) Name() types.ExchangeName
- func (e *Exchange) NewStream() types.Stream
- func (e *Exchange) PlatformFeeCurrency() string
- func (e *Exchange) QueryAccount(ctx context.Context) (*types.Account, error)
- func (e *Exchange) QueryAccountBalances(ctx context.Context) (types.BalanceMap, error)
- func (e *Exchange) QueryKLines(ctx context.Context, symbol string, interval types.Interval, ...) ([]types.KLine, error)
- func (e *Exchange) QueryMarkets(ctx context.Context) (types.MarketMap, error)
- func (e *Exchange) QueryOpenOrders(ctx context.Context, symbol string) ([]types.Order, error)
- func (e *Exchange) QueryOrder(ctx context.Context, q types.OrderQuery) (*types.Order, error)
- func (e *Exchange) QueryOrderTrades(ctx context.Context, q types.OrderQuery) ([]types.Trade, error)
- func (e *Exchange) QueryTicker(ctx context.Context, symbol string) (*types.Ticker, error)
- func (e *Exchange) QueryTickers(ctx context.Context, symbol ...string) (map[string]types.Ticker, error)
- func (e *Exchange) SubmitOrder(ctx context.Context, order types.SubmitOrder) (createdOrder *types.Order, err error)
- func (e *Exchange) SupportedInterval() map[types.Interval]int
- type HeartbeatMessage
- type MatchMessage
- type MessageType
- type OpenMessage
- type OrderBookSnapshotMessage
- type OrderBookUpdateMessage
- type ReceivedMessage
- type RfqMessage
- type SequenceNumberType
- type StatusMessage
- type Stream
- func (s *Stream) EmitActivateMessage(m *ActivateMessage)
- func (s *Stream) EmitAuctionMessage(m *AuctionMessage)
- func (s *Stream) EmitBalanceMessage(m *BalanceMessage)
- func (s *Stream) EmitChangeMessage(m *ChangeMessage)
- func (s *Stream) EmitDoneMessage(m *DoneMessage)
- func (s *Stream) EmitErrorMessage(m *ErrorMessage)
- func (s *Stream) EmitMatchMessage(m *MatchMessage)
- func (s *Stream) EmitOpenMessage(m *OpenMessage)
- func (s *Stream) EmitOrderbookSnapshotMessage(m *OrderBookSnapshotMessage)
- func (s *Stream) EmitOrderbookUpdateMessage(m *OrderBookUpdateMessage)
- func (s *Stream) EmitReceivedMessage(m *ReceivedMessage)
- func (s *Stream) EmitRfqMessage(m *RfqMessage)
- func (s *Stream) EmitStatusMessage(m *StatusMessage)
- func (s *Stream) EmitSubscriptions(m *SubscriptionsMessage)
- func (s *Stream) EmitTickerMessage(m *TickerMessage)
- func (s *Stream) OnActivateMessage(cb func(m *ActivateMessage))
- func (s *Stream) OnAuctionMessage(cb func(m *AuctionMessage))
- func (s *Stream) OnBalanceMessage(cb func(m *BalanceMessage))
- func (s *Stream) OnChangeMessage(cb func(m *ChangeMessage))
- func (s *Stream) OnDoneMessage(cb func(m *DoneMessage))
- func (s *Stream) OnErrorMessage(cb func(m *ErrorMessage))
- func (s *Stream) OnMatchMessage(cb func(m *MatchMessage))
- func (s *Stream) OnOpenMessage(cb func(m *OpenMessage))
- func (s *Stream) OnOrderbookSnapshotMessage(cb func(m *OrderBookSnapshotMessage))
- func (s *Stream) OnOrderbookUpdateMessage(cb func(m *OrderBookUpdateMessage))
- func (s *Stream) OnReceivedMessage(cb func(m *ReceivedMessage))
- func (s *Stream) OnRfqMessage(cb func(m *RfqMessage))
- func (s *Stream) OnStatusMessage(cb func(m *StatusMessage))
- func (s *Stream) OnSubscriptions(cb func(m *SubscriptionsMessage))
- func (s *Stream) OnTickerMessage(cb func(m *TickerMessage))
- type SubscriptionsMessage
- type TickerMessage
Constants ¶
View Source
const ( ID = "coinbase" PlatformToken = "COIN" PaginationLimit = 100 DefaultKLineLimit = 300 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ActivateMessage ¶
type ActivateMessage struct {
ProductID string `json:"product_id"`
Timestamp string `json:"timestamp"` // ex: "1483736448.299000"
UserID string `json:"user_id"`
ProfileID string `json:"profile_id"`
OrderID string `json:"order_id"`
StopType string `json:"stop_type"`
Side api.SideType `json:"side"`
StopPrice fixedpoint.Value `json:"stop_price"`
Size fixedpoint.Value `json:"size"`
Funds fixedpoint.Value `json:"funds"`
Private bool `json:"private"`
// contains filtered or unexported fields
}
type AuctionMessage ¶
type AuctionMessage struct {
AuctionState string `json:"auction_state"`
BestBidPrice fixedpoint.Value `json:"best_bid_price"` // ex: 333.98
BestBidSize fixedpoint.Value `json:"best_bid_size"` // ex: 4.39088265
BestAskPrice fixedpoint.Value `json:"best_ask_price"`
BestAskSize fixedpoint.Value `json:"best_ask_size"`
OpenPrice fixedpoint.Value `json:"open_price"`
OpenSize fixedpoint.Value `json:"open_size"`
CanOpen string `json:"can_open"`
Timestamp time.Time `json:"timestamp"` // ex: "2015-11-14T20:46:03.511254Z"
// contains filtered or unexported fields
}
auction channel
func (*AuctionMessage) QuoteCurrency ¶
func (s *AuctionMessage) QuoteCurrency() string
type BalanceMessage ¶
type BalanceMessage struct {
AccountID string `json:"account_id"`
Currency string `json:"currency"`
Holds fixedpoint.Value `json:"holds"`
Available fixedpoint.Value `json:"available"`
Updated types.Time `json:"updated"`
Timestamp types.Time `json:"timestamp"`
// contains filtered or unexported fields
}
balance channel
type ChangeMessage ¶
type ChangeMessage struct {
Reason string `json:"reason"` // "STP" or "modify_order"
Time time.Time `json:"time"`
OrderID string `json:"order_id"`
Side api.SideType `json:"side"`
OldSize fixedpoint.Value `json:"old_size"`
NewSize fixedpoint.Value `json:"new_size"`
// STP fields
Price fixedpoint.Value `json:"price,omitempty"`
// modify_order fields
OldPrice fixedpoint.Value `json:"old_price,omitempty"`
NewPrice fixedpoint.Value `json:"new_price,omitempty"`
// contains filtered or unexported fields
}
func (*ChangeMessage) IsModifyOrder ¶
func (m *ChangeMessage) IsModifyOrder() bool
func (*ChangeMessage) IsStp ¶
func (m *ChangeMessage) IsStp() bool
func (*ChangeMessage) QuoteCurrency ¶
func (s *ChangeMessage) QuoteCurrency() string
type DoneMessage ¶
type DoneMessage struct {
Time time.Time `json:"time"`
Price fixedpoint.Value `json:"price"`
OrderID string `json:"order_id"`
Reason string `json:"reason"` // filled, canceled
Side api.SideType `json:"side"`
RemainingSize fixedpoint.Value `json:"remaining_size"`
CancelReason string `json:"cancel_reason,omitempty"` // non-empty if reason is canceled
// contains filtered or unexported fields
}
func (*DoneMessage) QuoteCurrency ¶
func (s *DoneMessage) QuoteCurrency() string
type ErrorMessage ¶
type ErrorMessage struct {
Reason string `json:"reason"`
// contains filtered or unexported fields
}
type Exchange ¶
type Exchange struct {
// contains filtered or unexported fields
}
func (*Exchange) CancelOrders ¶
func (*Exchange) CancelOrdersBySymbol ¶
tradingutil.CancelAllOrdersBySymbolService
func (*Exchange) Client ¶
func (e *Exchange) Client() *api.RestAPIClient
func (*Exchange) IsSupportedInterval ¶
func (*Exchange) PlatformFeeCurrency ¶
func (*Exchange) QueryAccount ¶
ExchangeAccountService
func (*Exchange) QueryAccountBalances ¶
func (*Exchange) QueryKLines ¶
func (*Exchange) QueryMarkets ¶
func (*Exchange) QueryOpenOrders ¶
func (*Exchange) QueryOrder ¶
ExchangeOrderQueryService
func (*Exchange) QueryOrderTrades ¶
func (*Exchange) QueryTicker ¶
func (*Exchange) QueryTickers ¶
func (*Exchange) SubmitOrder ¶
func (e *Exchange) SubmitOrder(ctx context.Context, order types.SubmitOrder) (createdOrder *types.Order, err error)
ExchangeTradeService For the stop-limit order, we only support the long position For the market order, though Coinbase supports both funds and size, we only support size in order to simplify the stream handler logic We do not support limit order with funds.
type HeartbeatMessage ¶
type HeartbeatMessage struct {
LastTradeID int `json:"last_trade_id"`
Time time.Time `json:"time"`
// contains filtered or unexported fields
}
heartbeat channel
func (*HeartbeatMessage) QuoteCurrency ¶
func (s *HeartbeatMessage) QuoteCurrency() string
type MatchMessage ¶
type MatchMessage struct {
TradeID int `json:"trade_id"`
MakerOrderID string `json:"maker_order_id"`
TakerOrderID string `json:"taker_order_id"`
Time time.Time `json:"time"`
Size fixedpoint.Value `json:"size"`
Price fixedpoint.Value `json:"price"`
Side api.SideType `json:"side"`
UserID string `json:"user_id"`
ProfileID string `json:"profile_id"`
// extra fields for taker
TakerUserID string `json:"taker_user_id,omitempty"`
TakerProfileID string `json:"taker_profile_id,omitempty"`
TakerFeeRate fixedpoint.Value `json:"taker_fee_rate,omitempty"`
// extra fields for maker
MakerUserID string `json:"maker_user_id,omitempty"`
MakerProfileID string `json:"maker_profile_id,omitempty"`
MakerFeeRate fixedpoint.Value `json:"maker_fee_rate,omitempty"`
// contains filtered or unexported fields
}
func (*MatchMessage) FeeRate ¶
func (m *MatchMessage) FeeRate() fixedpoint.Value
https://help.coinbase.com/en/exchange/trading-and-funding/exchange-fees
func (*MatchMessage) IsAuthMaker ¶
func (m *MatchMessage) IsAuthMaker() bool
func (*MatchMessage) QuoteCurrency ¶
func (s *MatchMessage) QuoteCurrency() string
func (*MatchMessage) Trade ¶
func (msg *MatchMessage) Trade() types.Trade
type MessageType ¶
type MessageType string
type OpenMessage ¶
type OpenMessage struct {
Time time.Time `json:"time"`
OrderID string `json:"order_id"`
Price fixedpoint.Value `json:"price"`
RemainingSize fixedpoint.Value `json:"remaining_size"`
Side api.SideType `json:"side"`
// contains filtered or unexported fields
}
func (*OpenMessage) QuoteCurrency ¶
func (s *OpenMessage) QuoteCurrency() string
type OrderBookSnapshotMessage ¶
type OrderBookSnapshotMessage struct {
ProductID string `json:"product_id"`
Bids [][]fixedpoint.Value `json:"bids"` // [["price", "size"], ...]
Asks [][]fixedpoint.Value `json:"asks"` // [["price", "size"], ...]
// contains filtered or unexported fields
}
level2 channel
type OrderBookUpdateMessage ¶
type ReceivedMessage ¶
type ReceivedMessage struct {
ClientOid string `json:"client-oid"`
OrderID string `json:"order_id"`
OrderType string `json:"order_type"`
Side api.SideType `json:"side"`
Time time.Time `json:"time"`
// limit order fields
Size fixedpoint.Value `json:"size,omitempty"`
Price fixedpoint.Value `json:"price,omitempty"`
// market order fields
Funds fixedpoint.Value `json:"funds,omitempty"`
// contains filtered or unexported fields
}
full channel
func (*ReceivedMessage) IsMarketOrder ¶
func (m *ReceivedMessage) IsMarketOrder() bool
func (*ReceivedMessage) QuoteCurrency ¶
func (s *ReceivedMessage) QuoteCurrency() string
func (*ReceivedMessage) ToGlobalOrder ¶
func (m *ReceivedMessage) ToGlobalOrder() types.Order
type RfqMessage ¶
type RfqMessage struct {
MakerOrderID string `json:"maker_order_id"`
TakerOrderID string `json:"taker_order_id"`
Time time.Time `json:"time"`
TradeID int `json:"trade_id"`
ProductID string `json:"product_id"`
Size fixedpoint.Value `json:"size"`
Price fixedpoint.Value `json:"price"`
Side api.SideType `json:"side"`
// contains filtered or unexported fields
}
rfq_matches channel
type SequenceNumberType ¶
type SequenceNumberType uint64
type StatusMessage ¶
type StatusMessage struct {
Products []struct {
ID string `json:"id"`
BaseCurrency string `json:"base_currency"`
QuoteCurrency string `json:"quote_currency"`
BaseIncrement fixedpoint.Value `json:"base_increment"` // ex: 0.00000001
QuoteIncrement fixedpoint.Value `json:"quote_increment"` // ex: 0.01
DisplayName string `json:"display_name"`
Status string `json:"status"`
StatusMessage any `json:"status_message"`
MinMarketFunds fixedpoint.Value `json:"min_market_funds"` // ex: 10
PostOnly bool `json:"post_only"`
LimitOnly bool `json:"limit_only"`
CancelOnly bool `json:"cancel_only"`
FxStablecoin bool `json:"fx_stablecoin"`
} `json:"products"`
Currencies []struct {
ID string `json:"id"`
Name string `json:"name"`
DisplayName string `json:"display_name"`
MinSize fixedpoint.Value `json:"min_size"` // ex: 0.01
Status string `json:"status"`
StatusMessage any `json:"status_message"`
MaxPrecision fixedpoint.Value `json:"max_precision"` // ex: 0.01
ConvertibleTo []string `json:"convertible_to"`
Details struct {
} `json:"details"`
DefaultNetwork string `json:"default_network"`
SupportedNetworks []struct {
ID string `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
ContractAddress string `json:"contract_address"`
CryptoTransactionLink string `json:"crypto_transaction_link"`
MinWithdrawalAmount fixedpoint.Value `json:"min_withdrawal_amount"` // ex: 0.001
MaxWithdrawalAmount fixedpoint.Value `json:"max_withdrawal_amount"` // ex: 300000000
NetworkConfirmations int `json:"network_confirmations"` // ex: 14
ProcessingTimeSeconds int `json:"processing_time_seconds"` // ex: 0
DestinationTagRegex string `json:"destination_tag_regex"`
} `json:"supported_networks"`
} `json:"currencies"`
// contains filtered or unexported fields
}
status channel
type Stream ¶
type Stream struct {
types.StandardStream
// contains filtered or unexported fields
}
func (*Stream) EmitActivateMessage ¶
func (s *Stream) EmitActivateMessage(m *ActivateMessage)
func (*Stream) EmitAuctionMessage ¶
func (s *Stream) EmitAuctionMessage(m *AuctionMessage)
func (*Stream) EmitBalanceMessage ¶
func (s *Stream) EmitBalanceMessage(m *BalanceMessage)
func (*Stream) EmitChangeMessage ¶
func (s *Stream) EmitChangeMessage(m *ChangeMessage)
func (*Stream) EmitDoneMessage ¶
func (s *Stream) EmitDoneMessage(m *DoneMessage)
func (*Stream) EmitErrorMessage ¶
func (s *Stream) EmitErrorMessage(m *ErrorMessage)
func (*Stream) EmitMatchMessage ¶
func (s *Stream) EmitMatchMessage(m *MatchMessage)
func (*Stream) EmitOpenMessage ¶
func (s *Stream) EmitOpenMessage(m *OpenMessage)
func (*Stream) EmitOrderbookSnapshotMessage ¶
func (s *Stream) EmitOrderbookSnapshotMessage(m *OrderBookSnapshotMessage)
func (*Stream) EmitOrderbookUpdateMessage ¶
func (s *Stream) EmitOrderbookUpdateMessage(m *OrderBookUpdateMessage)
func (*Stream) EmitReceivedMessage ¶
func (s *Stream) EmitReceivedMessage(m *ReceivedMessage)
func (*Stream) EmitRfqMessage ¶
func (s *Stream) EmitRfqMessage(m *RfqMessage)
func (*Stream) EmitStatusMessage ¶
func (s *Stream) EmitStatusMessage(m *StatusMessage)
func (*Stream) EmitSubscriptions ¶
func (s *Stream) EmitSubscriptions(m *SubscriptionsMessage)
func (*Stream) EmitTickerMessage ¶
func (s *Stream) EmitTickerMessage(m *TickerMessage)
func (*Stream) OnActivateMessage ¶
func (s *Stream) OnActivateMessage(cb func(m *ActivateMessage))
func (*Stream) OnAuctionMessage ¶
func (s *Stream) OnAuctionMessage(cb func(m *AuctionMessage))
func (*Stream) OnBalanceMessage ¶
func (s *Stream) OnBalanceMessage(cb func(m *BalanceMessage))
func (*Stream) OnChangeMessage ¶
func (s *Stream) OnChangeMessage(cb func(m *ChangeMessage))
func (*Stream) OnDoneMessage ¶
func (s *Stream) OnDoneMessage(cb func(m *DoneMessage))
func (*Stream) OnErrorMessage ¶
func (s *Stream) OnErrorMessage(cb func(m *ErrorMessage))
func (*Stream) OnMatchMessage ¶
func (s *Stream) OnMatchMessage(cb func(m *MatchMessage))
func (*Stream) OnOpenMessage ¶
func (s *Stream) OnOpenMessage(cb func(m *OpenMessage))
func (*Stream) OnOrderbookSnapshotMessage ¶
func (s *Stream) OnOrderbookSnapshotMessage(cb func(m *OrderBookSnapshotMessage))
func (*Stream) OnOrderbookUpdateMessage ¶
func (s *Stream) OnOrderbookUpdateMessage(cb func(m *OrderBookUpdateMessage))
func (*Stream) OnReceivedMessage ¶
func (s *Stream) OnReceivedMessage(cb func(m *ReceivedMessage))
func (*Stream) OnRfqMessage ¶
func (s *Stream) OnRfqMessage(cb func(m *RfqMessage))
func (*Stream) OnStatusMessage ¶
func (s *Stream) OnStatusMessage(cb func(m *StatusMessage))
func (*Stream) OnSubscriptions ¶
func (s *Stream) OnSubscriptions(cb func(m *SubscriptionsMessage))
func (*Stream) OnTickerMessage ¶
func (s *Stream) OnTickerMessage(cb func(m *TickerMessage))
type SubscriptionsMessage ¶
type SubscriptionsMessage struct {
Channels []channelType `json:"channels"`
// contains filtered or unexported fields
}
Websocket message types
type TickerMessage ¶
type TickerMessage struct {
Price fixedpoint.Value `json:"price"`
Open24H fixedpoint.Value `json:"open_24h"` // ex: 1310.79
Volume24H fixedpoint.Value `json:"volume_24h"`
Low24H fixedpoint.Value `json:"low_24h"`
High24H fixedpoint.Value `json:"high_24h"`
Volume30D fixedpoint.Value `json:"volume_30d"`
BestBid fixedpoint.Value `json:"best_bid"`
BestBidSize fixedpoint.Value `json:"best_bid_size"`
BestAsk fixedpoint.Value `json:"best_ask"`
BestAskSize fixedpoint.Value `json:"best_ask_size"`
Side api.SideType `json:"side"`
Time time.Time `json:"time"`
TradeID int `json:"trade_id"`
LastSize fixedpoint.Value `json:"last_size"`
// contains filtered or unexported fields
}
ticker channel
func (*TickerMessage) QuoteCurrency ¶
func (s *TickerMessage) QuoteCurrency() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.