Documentation ¶
Index ¶
- Constants
- func AcctTypeStrings() []string
- func FuturesPositionStrings() []string
- func MarginTypeStrings() []string
- func OrderPlacementSrcStrings() []string
- func OrderTypeStrings() []string
- func PortfolioTypeStrings() []string
- func ProductTypeStrings() []string
- func RejectReasonStrings() []string
- func SideStrings() []string
- func StatusStrings() []string
- func StopDirectionStrings() []string
- func TIFStrings() []string
- func TriggerStatusStrings() []string
- type Account
- type AcctType
- type Balance
- type BidAsk
- type Book
- type BookEntry
- type Client
- func (c *Client) BidAsk(ctx context.Context, pairs ...string) ([]BidAsk, error)
- func (c *Client) CancelOrders(ctx context.Context, ids ...string) error
- func (c *Client) CreateOrder(ctx context.Context, newOrder *CreateOrderArgs) (*CreateOrderResp, error)
- func (c *Client) CreateProfileTransfer(ctx context.Context, newTransfer *ProfileTransfer) error
- func (c *Client) CreateReport(ctx context.Context, newReport *Report) (Report, error)
- func (c *Client) GetAccount(ctx context.Context, id uuid.UUID) (*Account, error)
- func (c *Client) GetBook(ctx context.Context, product string, level int) (Book, error)
- func (c *Client) GetHistoricRates(ctx context.Context, product string, p ...GetHistoricRatesParams) ([]HistoricRate, error)
- func (c *Client) GetOrder(ctx context.Context, id uuid.UUID) (*Order, error)
- func (c *Client) GetPortfolio(ctx context.Context, id uuid.UUID) (*Portfolio, error)
- func (c *Client) GetProducts(ctx context.Context) ([]Product, error)
- func (c *Client) GetProfile(ctx context.Context, id string) (Profile, error)
- func (c *Client) GetProfiles(ctx context.Context) ([]Profile, error)
- func (c *Client) GetReportStatus(ctx context.Context, id string) (Report, error)
- func (c *Client) GetStats(ctx context.Context, product string) (Stats, error)
- func (c *Client) GetTicker(ctx context.Context, product string) (Ticker, error)
- func (c *Client) GetTime(ctx context.Context) (ServerTime, error)
- func (c *Client) ListAccounts(ctx context.Context) ([]Account, error)
- func (c *Client) ListFills(p ListFillsParams) *Cursor
- func (c *Client) ListOrders(ctx context.Context) (*ListOrdersResp, error)
- func (c *Client) ListPortfolios(ctx context.Context) ([]PortfolioView, error)
- func (c *Client) ListTrades(ctx context.Context, product string, p ...ListTradesParams) *Cursor
- type CreateOrderArgs
- type CreateOrderResp
- type CreateReportParams
- type Currency
- type Cursor
- type EditHistory
- type Error
- type Fill
- type FuturePosition
- type FuturesPosition
- type GetHistoricRatesParams
- type HistoricRate
- type LimitOrderFOK
- type LimitOrderGTC
- type LimitOrderGTD
- type LimitOrderIOC
- type ListFillsParams
- type ListOrdersParams
- type ListOrdersResp
- type ListTradesParams
- type MarginType
- type MarketOrder
- type Order
- type OrderBookEntry
- type OrderConfig
- type OrderPlacementSrc
- type OrderType
- type PaginationParams
- type PerpetualPosition
- type Portfolio
- type PortfolioType
- type PortfolioView
- type Product
- type ProductType
- type Profile
- type ProfileTransfer
- type RejectReason
- type Report
- type ReportParams
- type ServerTime
- type Side
- type SpotPosition
- type Stats
- type Status
- type StopDirection
- type StopLimitOrderGTC
- type StopLimitOrderGTD
- type TIF
- type Ticker
- type Time
- type TotalBalances
- type Trade
- type TriggerBracketOrderGTC
- type TriggerBracketOrderGTD
- type TriggerStatus
- type UnmarshalErr
Constants ¶
const DefaultProdURL = "https://api.coinbase.com/api/v3/brokerage"
const DefaultSandboxURL = "https://api.sandbox.coinbase.com"
Variables ¶
This section is empty.
Functions ¶
func AcctTypeStrings ¶
func AcctTypeStrings() []string
AcctTypeStrings returns a slice of all String values of the enum
func FuturesPositionStrings ¶
func FuturesPositionStrings() []string
FuturesPositionStrings returns a slice of all String values of the enum
func MarginTypeStrings ¶
func MarginTypeStrings() []string
MarginTypeStrings returns a slice of all String values of the enum
func OrderPlacementSrcStrings ¶
func OrderPlacementSrcStrings() []string
OrderPlacementSrcStrings returns a slice of all String values of the enum
func OrderTypeStrings ¶
func OrderTypeStrings() []string
OrderTypeStrings returns a slice of all String values of the enum
func PortfolioTypeStrings ¶
func PortfolioTypeStrings() []string
PortfolioTypeStrings returns a slice of all String values of the enum
func ProductTypeStrings ¶
func ProductTypeStrings() []string
ProductTypeStrings returns a slice of all String values of the enum
func RejectReasonStrings ¶
func RejectReasonStrings() []string
RejectReasonStrings returns a slice of all String values of the enum
func SideStrings ¶
func SideStrings() []string
SideStrings returns a slice of all String values of the enum
func StatusStrings ¶
func StatusStrings() []string
StatusStrings returns a slice of all String values of the enum
func StopDirectionStrings ¶
func StopDirectionStrings() []string
StopDirectionStrings returns a slice of all String values of the enum
func TIFStrings ¶
func TIFStrings() []string
TIFStrings returns a slice of all String values of the enum
func TriggerStatusStrings ¶
func TriggerStatusStrings() []string
TriggerStatusStrings returns a slice of all String values of the enum
Types ¶
type Account ¶
type Account struct { ID uuid.UUID `json:"uuid"` Name string `json:"name"` Currency string `json:"currency"` AvailableBalance Balance `json:"available_balance"` Default bool `json:"default"` Active bool `json:"active"` Created time.Time `json:"created_at"` Updated time.Time `json:"updated_at"` Deleted time.Time `json:"deleted_at"` Type AcctType `json:"type"` Ready bool `json:"ready"` Hold Balance `json:"hold"` RetailPortfolioID string `json:"retail_portfolio_id"` }
type AcctType ¶
type AcctType byte
func AcctTypeString ¶
AcctTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func AcctTypeValues ¶
func AcctTypeValues() []AcctType
AcctTypeValues returns all values of the enum
func (AcctType) IsAAcctType ¶
IsAAcctType returns "true" if the value is listed in the enum definition. "false" otherwise
func (AcctType) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for AcctType
func (*AcctType) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for AcctType
type BidAsk ¶
type BidAsk struct { ProductID string `json:"product_id"` Time time.Time `json:"time"` Bids []OrderBookEntry `json:"bids"` Asks []OrderBookEntry `json:"asks"` }
type BookEntry ¶
func (*BookEntry) UnmarshalJSON ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithPrivateKey ¶
func (*Client) CancelOrders ¶
func (*Client) CreateOrder ¶
func (c *Client) CreateOrder(ctx context.Context, newOrder *CreateOrderArgs) (*CreateOrderResp, error)
func (*Client) CreateProfileTransfer ¶
func (c *Client) CreateProfileTransfer(ctx context.Context, newTransfer *ProfileTransfer) error
CreateProfileTransfer transfers a currency amount from one profile to another
func (*Client) CreateReport ¶
func (*Client) GetAccount ¶
func (*Client) GetHistoricRates ¶
func (c *Client) GetHistoricRates(ctx context.Context, product string, p ...GetHistoricRatesParams) ([]HistoricRate, error)
func (*Client) GetPortfolio ¶
func (*Client) GetProfile ¶
GetProfile retrieves a single profile
func (*Client) GetProfiles ¶
GetProfiles retrieves a list of profiles
func (*Client) GetReportStatus ¶
func (*Client) ListFills ¶
func (c *Client) ListFills(p ListFillsParams) *Cursor
func (*Client) ListOrders ¶
func (c *Client) ListOrders(ctx context.Context) (*ListOrdersResp, error)
func (*Client) ListPortfolios ¶
func (c *Client) ListPortfolios(ctx context.Context) ([]PortfolioView, error)
func (*Client) ListTrades ¶
type CreateOrderArgs ¶
type CreateOrderArgs struct { ID string `json:"client_order_id"` ProductID string `json:"product_id"` Side Side `json:"side"` Config OrderConfig `json:"order_configuration"` // Optional: empty string will omit leverage Leverage string `json:"leverage,omitempty"` // Optional: default value will not send MarginType MarginType `json:"margin_type,omitempty"` // Optional: empty string will omit RetailPortfolioID string `json:"retail_portfolio_id,omitempty"` // Optional: empty string will omit PreviewID string `json:"preview_id,omitempty"` }
type CreateOrderResp ¶
type Cursor ¶
type Cursor struct { Client *Client Pagination *PaginationParams Method string Params interface{} URL string HasMore bool }
func NewCursor ¶
func NewCursor(client *Client, method, url string, paginationParams *PaginationParams) *Cursor
type EditHistory ¶
type Error ¶
type Fill ¶
type Fill struct { TradeID int `json:"trade_id"` ProductID string `json:"product_id"` Price decimal.Decimal `json:"price"` Size string `json:"size"` FillID string `json:"order_id"` CreatedAt Time `json:"created_at"` Fee string `json:"fee"` Settled bool `json:"settled"` Side string `json:"side"` Liquidity string `json:"liquidity"` }
type FuturePosition ¶
type FuturePosition struct { ProductId string `json:"product_id"` ContractSize string `json:"contract_size"` Side string `json:"side"` Amount decimal.Decimal `json:"amount"` AvgEntryPrice decimal.Decimal `json:"avg_entry_price"` CurrentPrice decimal.Decimal `json:"current_price"` UnrealizedPnl string `json:"unrealized_pnl"` Expiry time.Time `json:"expiry"` UnderlyingAsset string `json:"underlying_asset"` AssetImgUrl string `json:"asset_img_url"` ProductName string `json:"product_name"` Venue string `json:"venue"` NotionalValue string `json:"notional_value"` }
type FuturesPosition ¶
type FuturesPosition byte
const ( FuturesPositionSideUnspecified FuturesPosition = iota FuturesPositionSideLong FuturesPositionSideShort )
func FuturesPositionString ¶
func FuturesPositionString(s string) (FuturesPosition, error)
FuturesPositionString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func FuturesPositionValues ¶
func FuturesPositionValues() []FuturesPosition
FuturesPositionValues returns all values of the enum
func (FuturesPosition) IsAFuturesPosition ¶
func (i FuturesPosition) IsAFuturesPosition() bool
IsAFuturesPosition returns "true" if the value is listed in the enum definition. "false" otherwise
func (FuturesPosition) MarshalJSON ¶
func (i FuturesPosition) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for FuturesPosition
func (FuturesPosition) String ¶
func (i FuturesPosition) String() string
func (*FuturesPosition) UnmarshalJSON ¶
func (i *FuturesPosition) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for FuturesPosition
type GetHistoricRatesParams ¶
type HistoricRate ¶
type HistoricRate struct { Time time.Time Low float64 High float64 Open float64 Close float64 Volume float64 }
func (*HistoricRate) UnmarshalJSON ¶
func (e *HistoricRate) UnmarshalJSON(data []byte) error
type LimitOrderFOK ¶
type LimitOrderFOK struct { // The amount of the first Asset in the Trading Pair. For example, on the // BTC-USD Order Book, BTC is the Base Asset. BaseSize decimal.Decimal `json:"base_size"` // The specified price, or better, that the Order should be executed at. A // Buy Order will execute at or lower than the limit price. A Sell Order // will execute at or higher than the limit price. LimitPrice decimal.Decimal `json:"limit_price"` }
func (*LimitOrderFOK) MarshalJSON ¶
func (l *LimitOrderFOK) MarshalJSON() ([]byte, error)
func (*LimitOrderFOK) OrderType ¶
func (l *LimitOrderFOK) OrderType() OrderType
func (*LimitOrderFOK) UnmarshalJSON ¶
func (l *LimitOrderFOK) UnmarshalJSON(b []byte) error
type LimitOrderGTC ¶
type LimitOrderGTC struct { // The amount of the first Asset in the Trading Pair. For example, on the // BTC-USD Order Book, BTC is the Base Asset. BaseSize decimal.Decimal // The specified price, or better, that the Order should be executed at. A // Buy Order will execute at or lower than the limit price. A Sell Order // will execute at or higher than the limit price. LimitPrice decimal.Decimal // Enable or disable Post-only Mode. When enabled, only Maker Orders will be // posted to the Order Book. Orders that will be posted as a Taker Order // will be rejected. PostOnly bool }
func (*LimitOrderGTC) MarshalJSON ¶
func (l *LimitOrderGTC) MarshalJSON() ([]byte, error)
func (*LimitOrderGTC) OrderType ¶
func (l *LimitOrderGTC) OrderType() OrderType
func (*LimitOrderGTC) UnmarshalJSON ¶
func (l *LimitOrderGTC) UnmarshalJSON(b []byte) error
type LimitOrderGTD ¶
type LimitOrderGTD struct { // The amount of the first Asset in the Trading Pair. For example, on the // BTC-USD Order Book, BTC is the Base Asset. BaseSize decimal.Decimal // The specified price, or better, that the Order should be executed at. A // Buy Order will execute at or lower than the limit price. A Sell Order // will execute at or higher than the limit price. LimitPrice decimal.Decimal EndTime time.Time // Enable or disable Post-only Mode. When enabled, only Maker Orders will be // posted to the Order Book. Orders that will be posted as a Taker Order // will be rejected. PostOnly bool }
func (*LimitOrderGTD) MarshalJSON ¶
func (l *LimitOrderGTD) MarshalJSON() ([]byte, error)
func (*LimitOrderGTD) OrderType ¶
func (l *LimitOrderGTD) OrderType() OrderType
func (*LimitOrderGTD) UnmarshalJSON ¶
func (l *LimitOrderGTD) UnmarshalJSON(b []byte) error
type LimitOrderIOC ¶
type LimitOrderIOC struct { // The amount of the first Asset in the Trading Pair. For example, on the // BTC-USD Order Book, BTC is the Base Asset. BaseSize decimal.Decimal // The specified price, or better, that the Order should be executed at. A // Buy Order will execute at or lower than the limit price. A Sell Order // will execute at or higher than the limit price. LimitPrice decimal.Decimal }
func (*LimitOrderIOC) MarshalJSON ¶
func (l *LimitOrderIOC) MarshalJSON() ([]byte, error)
func (*LimitOrderIOC) OrderType ¶
func (l *LimitOrderIOC) OrderType() OrderType
func (*LimitOrderIOC) UnmarshalJSON ¶
func (l *LimitOrderIOC) UnmarshalJSON(b []byte) error
type ListFillsParams ¶
type ListFillsParams struct { OrderID string ProductID string Pagination PaginationParams }
type ListOrdersParams ¶
type ListOrdersParams struct { Status string ProductID string Pagination PaginationParams }
type ListOrdersResp ¶
type ListTradesParams ¶
type ListTradesParams struct {
Pagination PaginationParams
}
type MarginType ¶
type MarginType byte
const ( UnknownMarginType MarginType = iota MarginTypeCross MarginTypeIsolated )
func MarginTypeString ¶
func MarginTypeString(s string) (MarginType, error)
MarginTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func MarginTypeValues ¶
func MarginTypeValues() []MarginType
MarginTypeValues returns all values of the enum
func (MarginType) IsAMarginType ¶
func (i MarginType) IsAMarginType() bool
IsAMarginType returns "true" if the value is listed in the enum definition. "false" otherwise
func (MarginType) MarshalJSON ¶
func (i MarginType) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for MarginType
func (MarginType) String ¶
func (i MarginType) String() string
func (*MarginType) UnmarshalJSON ¶
func (i *MarginType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for MarginType
type MarketOrder ¶
type MarketOrder struct { // The amount of the second Asset in the Trading Pair. For example, on the // BTC/USD Order Book, USD is the Quote Asset. QuoteSize decimal.Decimal // The amount of the first Asset in the Trading Pair. For example, on the // BTC-USD Order Book, BTC is the Base Asset. BaseSize decimal.Decimal }
func (*MarketOrder) MarshalJSON ¶
func (m *MarketOrder) MarshalJSON() ([]byte, error)
func (*MarketOrder) OrderType ¶
func (m *MarketOrder) OrderType() OrderType
func (*MarketOrder) UnmarshalJSON ¶
func (m *MarketOrder) UnmarshalJSON(b []byte) error
type Order ¶
type Order struct { ID uuid.UUID // Coinbase's ID IdemKey string // idempotency key you used to create it ProductID string User string Config OrderConfig Side Side Status Status TIF TIF // Time in force Created time.Time Completion string // amount of the order that's been filled FilledSize string AvgFillPrice string NumberOfFills string FilledValue string PendingCancel bool SizeInQuote bool TotalFees string SizeInclusiveOfFees bool TotalValueAfterFees string TriggerStatus TriggerStatus RejectReason RejectReason Settled bool ProductType ProductType RejectMsg string CancelMsg string OrderPlacementSrc OrderPlacementSrc OutstandingHoldAmount string Liquidation bool LastFillTime time.Time Edits []EditHistory Leverage string MarginType MarginType RetailPortfolioID string }
func (*Order) UnmarshalJSON ¶
type OrderBookEntry ¶
type OrderConfig ¶
type OrderConfig interface { json.Marshaler json.Unmarshaler OrderType() OrderType }
type OrderPlacementSrc ¶
type OrderPlacementSrc byte
const ( UnknownPlacementSource OrderPlacementSrc = iota OrderPlacementSrcRetailSimple OrderPlacementSrcRetailAdvanced )
func OrderPlacementSrcString ¶
func OrderPlacementSrcString(s string) (OrderPlacementSrc, error)
OrderPlacementSrcString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func OrderPlacementSrcValues ¶
func OrderPlacementSrcValues() []OrderPlacementSrc
OrderPlacementSrcValues returns all values of the enum
func (OrderPlacementSrc) IsAOrderPlacementSrc ¶
func (i OrderPlacementSrc) IsAOrderPlacementSrc() bool
IsAOrderPlacementSrc returns "true" if the value is listed in the enum definition. "false" otherwise
func (OrderPlacementSrc) MarshalJSON ¶
func (i OrderPlacementSrc) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for OrderPlacementSrc
func (OrderPlacementSrc) String ¶
func (i OrderPlacementSrc) String() string
func (*OrderPlacementSrc) UnmarshalJSON ¶
func (i *OrderPlacementSrc) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for OrderPlacementSrc
type OrderType ¶
type OrderType byte
const ( OrderTypeUnspecified OrderType = iota Market LimitIOC // Immediate or cancel (has to fill some part of the order immediately, if it fails, cancel the rest) LimitFOK // Fill or Kill LimitGTC // Good til Canceled LimitGTD // Good til date StopLimitGTC StopLimitGTD TriggerBracketGTC TriggerBracketGTD )
func OrderTypeString ¶
OrderTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func OrderTypeValues ¶
func OrderTypeValues() []OrderType
OrderTypeValues returns all values of the enum
func (OrderType) IsAOrderType ¶
IsAOrderType returns "true" if the value is listed in the enum definition. "false" otherwise
type PaginationParams ¶
func (*PaginationParams) AddExtraParam ¶
func (p *PaginationParams) AddExtraParam(key, value string)
func (*PaginationParams) Done ¶
func (p *PaginationParams) Done(direction string) bool
func (*PaginationParams) Encode ¶
func (p *PaginationParams) Encode(direction string) string
type PerpetualPosition ¶
type PerpetualPosition struct { ProductId string `json:"product_id"` ProductUuid string `json:"product_uuid"` Symbol string `json:"symbol"` AssetImageUrl string `json:"asset_image_url"` NetSize string `json:"net_size"` BuyOrderSize string `json:"buy_order_size"` SellOrderSize string `json:"sell_order_size"` IMContribution string `json:"im_contribution"` VWAP Currency `json:"vwap"` UnrealizedPNL Currency `json:"unrealized_pnl"` MarkPrice Currency `json:"mark_price"` LiquidationPrice Currency `json:"liquidation_price"` Leverage string `json:"leverage"` IMNotational Currency `json:"im_notional"` MMNotational Currency `json:"mm_notional"` PositionNotational Currency `json:"position_notional"` MarginType MarginType `json:"margin_type"` LiquidationBuffer string `json:"liquidation_buffer"` LiquidationPct string `json:"liquidation_percentage"` }
type Portfolio ¶
type Portfolio struct { PortfolioView PortfolioView Balances TotalBalances SpotPositions []SpotPosition Perpetuals []PerpetualPosition Futures []FuturePosition }
type PortfolioType ¶
type PortfolioType byte
const ( PortfolioTypeUndefined PortfolioType = iota PortfolioTypeDefault PortfolioTypeConsumer PortfolioTypeIntx )
func PortfolioTypeString ¶
func PortfolioTypeString(s string) (PortfolioType, error)
PortfolioTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func PortfolioTypeValues ¶
func PortfolioTypeValues() []PortfolioType
PortfolioTypeValues returns all values of the enum
func (PortfolioType) IsAPortfolioType ¶
func (i PortfolioType) IsAPortfolioType() bool
IsAPortfolioType returns "true" if the value is listed in the enum definition. "false" otherwise
func (PortfolioType) MarshalJSON ¶
func (i PortfolioType) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for PortfolioType
func (PortfolioType) String ¶
func (i PortfolioType) String() string
func (*PortfolioType) UnmarshalJSON ¶
func (i *PortfolioType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for PortfolioType
type PortfolioView ¶
type PortfolioView struct { Name string `json:"name"` UUID uuid.UUID `json:"uuid"` Type PortfolioType `json:"type"` Deleted bool `json:"deleted"` }
type Product ¶
type Product struct { ID string `json:"id"` BaseCurrency string `json:"base_currency"` QuoteCurrency string `json:"quote_currency"` BaseMinSize string `json:"base_min_size"` BaseMaxSize string `json:"base_max_size"` QuoteIncrement string `json:"quote_increment"` BaseIncrement string `json:"base_increment"` DisplayName string `json:"display_name"` MinMarketFunds string `json:"min_market_funds"` MaxMarketFunds string `json:"max_market_funds"` MarginEnabled bool `json:"margin_enabled"` PostOnly bool `json:"post_only"` LimitOnly bool `json:"limit_only"` CancelOnly bool `json:"cancel_only"` TradingDisabled bool `json:"trading_disabled"` Status string `json:"status"` StatusMessage string `json:"status_message"` }
type ProductType ¶
type ProductType byte
const ( UnknownProductType ProductType = iota ProductTypeSpot ProductTypeFuture )
func ProductTypeString ¶
func ProductTypeString(s string) (ProductType, error)
ProductTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func ProductTypeValues ¶
func ProductTypeValues() []ProductType
ProductTypeValues returns all values of the enum
func (ProductType) IsAProductType ¶
func (i ProductType) IsAProductType() bool
IsAProductType returns "true" if the value is listed in the enum definition. "false" otherwise
func (ProductType) MarshalJSON ¶
func (i ProductType) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for ProductType
func (ProductType) String ¶
func (i ProductType) String() string
func (*ProductType) UnmarshalJSON ¶
func (i *ProductType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for ProductType
type ProfileTransfer ¶
type RejectReason ¶
type RejectReason byte
const ( // These values vary wildly for some reason. The API in coinbase for this is // not consistent RejectReasonUnspecified RejectReason = iota HoldFailure TooManyOpenOrders RejectReasonInsufficientFunds RateLimitExceeded )
func RejectReasonString ¶
func RejectReasonString(s string) (RejectReason, error)
RejectReasonString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func RejectReasonValues ¶
func RejectReasonValues() []RejectReason
RejectReasonValues returns all values of the enum
func (RejectReason) IsARejectReason ¶
func (i RejectReason) IsARejectReason() bool
IsARejectReason returns "true" if the value is listed in the enum definition. "false" otherwise
func (RejectReason) MarshalJSON ¶
func (i RejectReason) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for RejectReason
func (RejectReason) String ¶
func (i RejectReason) String() string
func (*RejectReason) UnmarshalJSON ¶
func (i *RejectReason) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for RejectReason
type Report ¶
type Report struct { ID string `json:"id"` Type string `json:"type"` Status string `json:"status"` CreatedAt Time `json:"created_at,string"` CompletedAt Time `json:"completed_at,string,"` ExpiresAt Time `json:"expires_at,string"` FileURL string `json:"file_url"` Params ReportParams `json:"params"` StartDate time.Time EndDate time.Time }
type ServerTime ¶
type Side ¶
type Side byte
func SideString ¶
SideString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func (Side) IsASide ¶
IsASide returns "true" if the value is listed in the enum definition. "false" otherwise
func (Side) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for Side
func (*Side) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for Side
type SpotPosition ¶
type SpotPosition struct { Asset string `json:"asset"` AccountUUID string `json:"account_uuid"` TotalBalanceFiat float64 `json:"total_balance_fiat"` TotalBalanceCrypto float64 `json:"total_balance_crypto"` AvailableToTradeFiat float64 `json:"available_to_trade_fiat"` Allocation float64 `json:"allocation"` OneDayChange float64 `json:"one_day_change"` Cost_basis Balance `json:"cost_basis"` AssetImgUrl string `json:"asset_img_url"` IsCash bool `json:"is_cash"` }
type Status ¶
type Status byte
func StatusString ¶
StatusString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func (Status) IsAStatus ¶
IsAStatus returns "true" if the value is listed in the enum definition. "false" otherwise
func (Status) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for Status
func (*Status) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for Status
type StopDirection ¶
type StopDirection byte
const ( StopDirectionUnspecified StopDirection = iota StopDirectionStopUp // buy side StopDirectionStopDown // sell side )
func StopDirectionString ¶
func StopDirectionString(s string) (StopDirection, error)
StopDirectionString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func StopDirectionValues ¶
func StopDirectionValues() []StopDirection
StopDirectionValues returns all values of the enum
func (StopDirection) IsAStopDirection ¶
func (i StopDirection) IsAStopDirection() bool
IsAStopDirection returns "true" if the value is listed in the enum definition. "false" otherwise
func (StopDirection) MarshalJSON ¶
func (i StopDirection) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for StopDirection
func (StopDirection) String ¶
func (i StopDirection) String() string
func (*StopDirection) UnmarshalJSON ¶
func (i *StopDirection) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for StopDirection
type StopLimitOrderGTC ¶
type StopLimitOrderGTC struct { // The amount of the first Asset in the Trading Pair. For example, on the // BTC-USD Order Book, BTC is the Base Asset. BaseSize decimal.Decimal // The specified price, or better, that the Order should be executed at. A // Buy Order will execute at or lower than the limit price. A Sell Order // will execute at or higher than the limit price. LimitPrice decimal.Decimal Stop decimal.Decimal // on which side should the limit trigger. // if you specify Buy then the stop is triggered once the stop EXCEEDS. // if you specify Sell then the stop is triggered once the stop FALLS BELOW // If you don't specify one, the payload to coinbase will not have one, // and will result in an error Side Side }
func (*StopLimitOrderGTC) MarshalJSON ¶
func (s *StopLimitOrderGTC) MarshalJSON() ([]byte, error)
func (*StopLimitOrderGTC) OrderType ¶
func (s *StopLimitOrderGTC) OrderType() OrderType
func (*StopLimitOrderGTC) UnmarshalJSON ¶
func (s *StopLimitOrderGTC) UnmarshalJSON(buf []byte) error
type StopLimitOrderGTD ¶
type StopLimitOrderGTD struct { // The amount of the first Asset in the Trading Pair. For example, on the // BTC-USD Order Book, BTC is the Base Asset. BaseSize decimal.Decimal // The specified price, or better, that the Order should be executed at. A // Buy Order will execute at or lower than the limit price. A Sell Order // will execute at or higher than the limit price. LimitPrice decimal.Decimal Stop decimal.Decimal EndTime time.Time // on which side should the limit trigger. // if you specify Buy then the stop is triggered once the stop EXCEEDS. // if you specify Sell then the stop is triggered once the stop FALLS BELOW // If you don't specify one, the payload to coinbase will not have one, // and will result in an error Side Side }
func (*StopLimitOrderGTD) MarshalJSON ¶
func (s *StopLimitOrderGTD) MarshalJSON() ([]byte, error)
func (*StopLimitOrderGTD) OrderType ¶
func (s *StopLimitOrderGTD) OrderType() OrderType
func (*StopLimitOrderGTD) UnmarshalJSON ¶
func (s *StopLimitOrderGTD) UnmarshalJSON(buf []byte) error
type TIF ¶
type TIF byte
func TIFString ¶
TIFString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func (TIF) IsATIF ¶
IsATIF returns "true" if the value is listed in the enum definition. "false" otherwise
func (TIF) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for TIF
func (*TIF) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for TIF
type Time ¶
func (Time) MarshalJSON ¶
MarshalJSON marshal time back to time.Time for json encoding
func (*Time) UnmarshalJSON ¶
type TotalBalances ¶
type TotalBalances struct { TotalBalance Balance `json:"total_balance"` Futures Balance `json:"total_futures_balance"` CashEq Balance `json:"total_cash_equivalent_balance"` Crypto Balance `json:"total_crypto_balance"` FuturesUnrealized Balance `json:"futures_unrealized_pnl"` PerpUnrealized Balance `json:"perp_unrealized_pnl"` }
type TriggerBracketOrderGTC ¶
type TriggerBracketOrderGTC struct { // The amount of the first Asset in the Trading Pair. For example, on the // BTC-USD Order Book, BTC is the Base Asset. BaseSize decimal.Decimal `json:"base_size"` // The specified price, or better, that the Order should be executed at. A // Buy Order will execute at or lower than the limit price. A Sell Order // will execute at or higher than the limit price. LimitPrice decimal.Decimal `json:"limit_price"` // The price level (in quote currency) where the position will be exited. // When triggered, a stop limit order is automatically placed with a limit // price 5% higher for BUYS and 5% lower for SELLS. StopTriggerPrice decimal.Decimal `json:"stop_trigger_price"` }
func (*TriggerBracketOrderGTC) MarshalJSON ¶
func (t *TriggerBracketOrderGTC) MarshalJSON() ([]byte, error)
func (*TriggerBracketOrderGTC) OrderType ¶
func (t *TriggerBracketOrderGTC) OrderType() OrderType
func (*TriggerBracketOrderGTC) UnmarshalJSON ¶
func (t *TriggerBracketOrderGTC) UnmarshalJSON(b []byte) error
type TriggerBracketOrderGTD ¶
type TriggerBracketOrderGTD struct { // The amount of the first Asset in the Trading Pair. For example, on the // BTC-USD Order Book, BTC is the Base Asset. BaseSize decimal.Decimal `json:"base_size"` // The specified price, or better, that the Order should be executed at. A // Buy Order will execute at or lower than the limit price. A Sell Order // will execute at or higher than the limit price. LimitPrice decimal.Decimal `json:"limit_price"` EndTime time.Time `json:"end_time"` // The price level (in quote currency) where the position will be exited. // When triggered, a stop limit order is automatically placed with a limit // price 5% higher for BUYS and 5% lower for SELLS. StopTriggerPrice decimal.Decimal `json:"stop_trigger_price"` }
func (*TriggerBracketOrderGTD) MarshalJSON ¶
func (t *TriggerBracketOrderGTD) MarshalJSON() ([]byte, error)
func (*TriggerBracketOrderGTD) OrderType ¶
func (t *TriggerBracketOrderGTD) OrderType() OrderType
func (*TriggerBracketOrderGTD) UnmarshalJSON ¶
func (t *TriggerBracketOrderGTD) UnmarshalJSON(b []byte) error
type TriggerStatus ¶
type TriggerStatus byte
const ( UnknownTriggerStatus TriggerStatus = iota TriggerStatusInvalidOrderType TriggerStatusStopPending TriggerStatusStopTriggered )
func TriggerStatusString ¶
func TriggerStatusString(s string) (TriggerStatus, error)
TriggerStatusString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func TriggerStatusValues ¶
func TriggerStatusValues() []TriggerStatus
TriggerStatusValues returns all values of the enum
func (TriggerStatus) IsATriggerStatus ¶
func (i TriggerStatus) IsATriggerStatus() bool
IsATriggerStatus returns "true" if the value is listed in the enum definition. "false" otherwise
func (TriggerStatus) MarshalJSON ¶
func (i TriggerStatus) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for TriggerStatus
func (TriggerStatus) String ¶
func (i TriggerStatus) String() string
func (*TriggerStatus) UnmarshalJSON ¶
func (i *TriggerStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for TriggerStatus
type UnmarshalErr ¶
func (*UnmarshalErr) Error ¶
func (u *UnmarshalErr) Error() string
Source Files ¶
- account.go
- accttype_enumer.go
- auth.go
- bid_ask.go
- cancel_order.go
- client.go
- create_order.go
- cursor.go
- error.go
- fill.go
- futures.go
- futuresposition_enumer.go
- get_order.go
- limit_order_fok.go
- limit_order_gtc.go
- limit_order_gtd.go
- limit_order_ioc.go
- list_orders.go
- margintype_enumer.go
- market_order.go
- message.go
- order.go
- order_data.go
- orderplacementsrc_enumer.go
- ordertype_enumer.go
- pagination.go
- perpetuals.go
- portfolio.go
- portfoliotype_enumer.go
- product.go
- producttype_enumer.go
- profile.go
- rejectreason_enumer.go
- report.go
- side_enumer.go
- status_enumer.go
- stop_order_gtc.go
- stop_order_gtd.go
- stopdirection_enumer.go
- tif_enumer.go
- time.go
- trigger_bracket_order_gtc.go
- trigger_bracket_order_gtd.go
- triggerstatus_enumer.go