coinbase

package
v1.62.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2025 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHTTPTimeout = 15 * time.Second
	ProductionAPIURL   = "https://api.exchange.coinbase.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Balance

type Balance struct {
	ID             string           `json:"id"`
	Currency       string           `json:"currency"`
	Balance        fixedpoint.Value `json:"balance"`
	Hold           fixedpoint.Value `json:"hold"`
	Available      fixedpoint.Value `json:"available"`
	ProfileID      string           `json:"profile_id"`
	TradingEnabled bool             `json:"trading_enabled"`
}

type BalanceSnapshot

type BalanceSnapshot []Balance

type CancelAllOrdersRequest

type CancelAllOrdersRequest struct {
	// contains filtered or unexported fields
}

func (*CancelAllOrdersRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*CancelAllOrdersRequest) GetParameters

func (c *CancelAllOrdersRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*CancelAllOrdersRequest) GetParametersJSON

func (c *CancelAllOrdersRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*CancelAllOrdersRequest) GetParametersQuery

func (c *CancelAllOrdersRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*CancelAllOrdersRequest) GetPath

func (c *CancelAllOrdersRequest) GetPath() string

GetPath returns the request path of the API

func (*CancelAllOrdersRequest) GetQueryParameters

func (c *CancelAllOrdersRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*CancelAllOrdersRequest) GetSlugParameters

func (c *CancelAllOrdersRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*CancelAllOrdersRequest) GetSlugsMap

func (c *CancelAllOrdersRequest) GetSlugsMap() (map[string]string, error)

func (*CancelAllOrdersRequest) ProductID

func (c *CancelAllOrdersRequest) ProductID(productID string) *CancelAllOrdersRequest

func (*CancelAllOrdersRequest) ProfileID

func (c *CancelAllOrdersRequest) ProfileID(profileID string) *CancelAllOrdersRequest

type CancelAllOrdersResponse

type CancelAllOrdersResponse []string

type CancelOrderRequest

type CancelOrderRequest struct {
	// contains filtered or unexported fields
}

func (*CancelOrderRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*CancelOrderRequest) GetParameters

func (c *CancelOrderRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*CancelOrderRequest) GetParametersJSON

func (c *CancelOrderRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*CancelOrderRequest) GetParametersQuery

func (c *CancelOrderRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*CancelOrderRequest) GetPath

func (c *CancelOrderRequest) GetPath() string

GetPath returns the request path of the API

func (*CancelOrderRequest) GetQueryParameters

func (c *CancelOrderRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*CancelOrderRequest) GetSlugParameters

func (c *CancelOrderRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*CancelOrderRequest) GetSlugsMap

func (c *CancelOrderRequest) GetSlugsMap() (map[string]string, error)

func (*CancelOrderRequest) OrderID

func (c *CancelOrderRequest) OrderID(orderID string) *CancelOrderRequest

func (*CancelOrderRequest) ProductID

func (c *CancelOrderRequest) ProductID(productID string) *CancelOrderRequest

func (*CancelOrderRequest) ProfileID

func (c *CancelOrderRequest) ProfileID(profileID string) *CancelOrderRequest

type CancelOrderResponse

type CancelOrderResponse string

type Candle

type Candle struct {
	Time   types.Time       `json:"time"`
	Low    fixedpoint.Value `json:"low"`
	High   fixedpoint.Value `json:"high"`
	Open   fixedpoint.Value `json:"open"`
	Close  fixedpoint.Value `json:"close"`
	Volume fixedpoint.Value `json:"volume"`
}

type CreateOrderRequest

type CreateOrderRequest struct {
	// contains filtered or unexported fields
}

func (*CreateOrderRequest) CancelAfter

func (c *CreateOrderRequest) CancelAfter(cancelAfter string) *CreateOrderRequest

func (*CreateOrderRequest) ClientOrderID

func (c *CreateOrderRequest) ClientOrderID(clientOrderID string) *CreateOrderRequest

func (*CreateOrderRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*CreateOrderRequest) Funds

func (*CreateOrderRequest) GetParameters

func (c *CreateOrderRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*CreateOrderRequest) GetParametersJSON

func (c *CreateOrderRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*CreateOrderRequest) GetParametersQuery

func (c *CreateOrderRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*CreateOrderRequest) GetPath

func (c *CreateOrderRequest) GetPath() string

GetPath returns the request path of the API

func (*CreateOrderRequest) GetQueryParameters

func (c *CreateOrderRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*CreateOrderRequest) GetSlugParameters

func (c *CreateOrderRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*CreateOrderRequest) GetSlugsMap

func (c *CreateOrderRequest) GetSlugsMap() (map[string]string, error)

func (*CreateOrderRequest) MaxFloor

func (c *CreateOrderRequest) MaxFloor(maxFloor string) *CreateOrderRequest

func (*CreateOrderRequest) OrderType

func (c *CreateOrderRequest) OrderType(orderType string) *CreateOrderRequest

func (*CreateOrderRequest) PostOnly

func (c *CreateOrderRequest) PostOnly(postOnly bool) *CreateOrderRequest

func (*CreateOrderRequest) Price

func (*CreateOrderRequest) ProductID

func (c *CreateOrderRequest) ProductID(productID string) *CreateOrderRequest

func (*CreateOrderRequest) ProfileID

func (c *CreateOrderRequest) ProfileID(profileID string) *CreateOrderRequest

func (*CreateOrderRequest) Side

func (*CreateOrderRequest) Size

func (*CreateOrderRequest) Stop

func (*CreateOrderRequest) StopLimitPrice

func (c *CreateOrderRequest) StopLimitPrice(stopLimitPrice fixedpoint.Value) *CreateOrderRequest

func (*CreateOrderRequest) StopPrice

func (c *CreateOrderRequest) StopPrice(stopPrice fixedpoint.Value) *CreateOrderRequest

func (*CreateOrderRequest) Stp

func (*CreateOrderRequest) TimeInForce

func (c *CreateOrderRequest) TimeInForce(timeInForce string) *CreateOrderRequest

type CreateOrderResponse

type CreateOrderResponse struct {
	ID               string           `json:"id"`
	Price            fixedpoint.Value `json:"price,omitempty"`
	Size             fixedpoint.Value `json:"size,omitempty"`
	ProductID        string           `json:"product_id"`
	ProfileID        string           `json:"profile_id,omitempty"`
	Side             SideType         `json:"side"`
	Funds            fixedpoint.Value `json:"funds,omitempty"`
	SpecifiedFunds   fixedpoint.Value `json:"specified_funds,omitempty"`
	Type             OrderType        `json:"type"`
	TimeInForce      TimeInForceType  `json:"time_in_force,omitempty"`
	ExpireTime       types.Time       `json:"expire_time,omitempty"`
	PostOnly         bool             `json:"post_only"`
	CreatedAt        types.Time       `json:"created_at"`
	DoneAt           types.Time       `json:"done_at,omitempty"`
	DoneReason       string           `json:"done_reason,omitempty"`
	RejectReason     string           `json:"reject_reason,omitempty"`
	FillFees         fixedpoint.Value `json:"fill_fees"`
	FilledSize       fixedpoint.Value `json:"filled_size"`
	ExecutedValue    fixedpoint.Value `json:"executed_value,omitempty"`
	Status           OrderStatus      `json:"status"`
	Settled          bool             `json:"settled"`
	Stop             OrderStopType    `json:"stop,omitempty"`
	StopPrice        fixedpoint.Value `json:"stop_price,omitempty"`
	FundingAmount    string           `json:"funding_amount,omitempty"`
	ClientOrderID    string           `json:"client_oid,omitempty"`
	MarketType       string           `json:"market_type,omitempty"`
	MaxFloor         string           `json:"max_floor,omitempty"`
	SecondaryOrderID string           `json:"secondary_order_id,omitempty"`
	StopLimitPrice   fixedpoint.Value `json:"stop_limit_price,omitempty"`
}

type GetBalancesRequest

type GetBalancesRequest struct {
	// contains filtered or unexported fields
}

func (*GetBalancesRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetBalancesRequest) GetParameters

func (g *GetBalancesRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetBalancesRequest) GetParametersJSON

func (g *GetBalancesRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetBalancesRequest) GetParametersQuery

func (g *GetBalancesRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetBalancesRequest) GetPath

func (g *GetBalancesRequest) GetPath() string

GetPath returns the request path of the API

func (*GetBalancesRequest) GetQueryParameters

func (g *GetBalancesRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetBalancesRequest) GetSlugParameters

func (g *GetBalancesRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetBalancesRequest) GetSlugsMap

func (g *GetBalancesRequest) GetSlugsMap() (map[string]string, error)

type GetCandlesRequest

type GetCandlesRequest struct {
	// contains filtered or unexported fields
}

https://docs.cdp.coinbase.com/exchange/reference/exchangerestapi_getproductcandles

func (*GetCandlesRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetCandlesRequest) End

func (*GetCandlesRequest) GetParameters

func (g *GetCandlesRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetCandlesRequest) GetParametersJSON

func (g *GetCandlesRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetCandlesRequest) GetParametersQuery

func (g *GetCandlesRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetCandlesRequest) GetPath

func (g *GetCandlesRequest) GetPath() string

GetPath returns the request path of the API

func (*GetCandlesRequest) GetQueryParameters

func (g *GetCandlesRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetCandlesRequest) GetSlugParameters

func (g *GetCandlesRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetCandlesRequest) GetSlugsMap

func (g *GetCandlesRequest) GetSlugsMap() (map[string]string, error)

func (*GetCandlesRequest) Granularity

func (g *GetCandlesRequest) Granularity(granularity string) *GetCandlesRequest

func (*GetCandlesRequest) ProductID

func (g *GetCandlesRequest) ProductID(productID string) *GetCandlesRequest

func (*GetCandlesRequest) Start

func (g *GetCandlesRequest) Start(start time.Time) *GetCandlesRequest

type GetCandlesResponse

type GetCandlesResponse []RawCandle

type GetMarketInfoRequest

type GetMarketInfoRequest struct {
	// contains filtered or unexported fields
}

https://docs.cdp.coinbase.com/exchange/reference/exchangerestapi_getproducts

func (*GetMarketInfoRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetMarketInfoRequest) GetParameters

func (g *GetMarketInfoRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetMarketInfoRequest) GetParametersJSON

func (g *GetMarketInfoRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetMarketInfoRequest) GetParametersQuery

func (g *GetMarketInfoRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetMarketInfoRequest) GetPath

func (g *GetMarketInfoRequest) GetPath() string

GetPath returns the request path of the API

func (*GetMarketInfoRequest) GetQueryParameters

func (g *GetMarketInfoRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetMarketInfoRequest) GetSlugParameters

func (g *GetMarketInfoRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetMarketInfoRequest) GetSlugsMap

func (g *GetMarketInfoRequest) GetSlugsMap() (map[string]string, error)

type GetOrderTradesRequest

type GetOrderTradesRequest struct {
	// contains filtered or unexported fields
}

func (*GetOrderTradesRequest) After

func (*GetOrderTradesRequest) Before

func (g *GetOrderTradesRequest) Before(before int) *GetOrderTradesRequest

func (*GetOrderTradesRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetOrderTradesRequest) EndDate

func (g *GetOrderTradesRequest) EndDate(endDate string) *GetOrderTradesRequest

func (*GetOrderTradesRequest) GetParameters

func (g *GetOrderTradesRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetOrderTradesRequest) GetParametersJSON

func (g *GetOrderTradesRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetOrderTradesRequest) GetParametersQuery

func (g *GetOrderTradesRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetOrderTradesRequest) GetPath

func (g *GetOrderTradesRequest) GetPath() string

GetPath returns the request path of the API

func (*GetOrderTradesRequest) GetQueryParameters

func (g *GetOrderTradesRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetOrderTradesRequest) GetSlugParameters

func (g *GetOrderTradesRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetOrderTradesRequest) GetSlugsMap

func (g *GetOrderTradesRequest) GetSlugsMap() (map[string]string, error)

func (*GetOrderTradesRequest) Limit

func (*GetOrderTradesRequest) MarketType

func (g *GetOrderTradesRequest) MarketType(marketType MarketType) *GetOrderTradesRequest

func (*GetOrderTradesRequest) OrderID

func (g *GetOrderTradesRequest) OrderID(orderID string) *GetOrderTradesRequest

func (*GetOrderTradesRequest) ProductID

func (g *GetOrderTradesRequest) ProductID(productID string) *GetOrderTradesRequest

func (*GetOrderTradesRequest) StartDate

func (g *GetOrderTradesRequest) StartDate(startDate string) *GetOrderTradesRequest

type GetOrdersRequest

type GetOrdersRequest struct {
	// contains filtered or unexported fields
}

func (*GetOrdersRequest) After

func (g *GetOrdersRequest) After(after time.Time) *GetOrdersRequest

func (*GetOrdersRequest) Before

func (g *GetOrdersRequest) Before(before time.Time) *GetOrdersRequest

func (*GetOrdersRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetOrdersRequest) EndDate

func (g *GetOrdersRequest) EndDate(endDate time.Time) *GetOrdersRequest

func (*GetOrdersRequest) GetParameters

func (g *GetOrdersRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetOrdersRequest) GetParametersJSON

func (g *GetOrdersRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetOrdersRequest) GetParametersQuery

func (g *GetOrdersRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetOrdersRequest) GetPath

func (g *GetOrdersRequest) GetPath() string

GetPath returns the request path of the API

func (*GetOrdersRequest) GetQueryParameters

func (g *GetOrdersRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetOrdersRequest) GetSlugParameters

func (g *GetOrdersRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetOrdersRequest) GetSlugsMap

func (g *GetOrdersRequest) GetSlugsMap() (map[string]string, error)

func (*GetOrdersRequest) Limit

func (g *GetOrdersRequest) Limit(limit int) *GetOrdersRequest

func (*GetOrdersRequest) ProductID

func (g *GetOrdersRequest) ProductID(productID string) *GetOrdersRequest

func (*GetOrdersRequest) ProfileID

func (g *GetOrdersRequest) ProfileID(profileID string) *GetOrdersRequest

func (*GetOrdersRequest) SortedBy

func (g *GetOrdersRequest) SortedBy(sortedBy string) *GetOrdersRequest

func (*GetOrdersRequest) Sorting

func (g *GetOrdersRequest) Sorting(sorting string) *GetOrdersRequest

func (*GetOrdersRequest) StartDate

func (g *GetOrdersRequest) StartDate(startDate time.Time) *GetOrdersRequest

func (*GetOrdersRequest) Status

func (g *GetOrdersRequest) Status(status []string) *GetOrdersRequest

type GetSingleOrderRequest

type GetSingleOrderRequest struct {
	// contains filtered or unexported fields
}

func (*GetSingleOrderRequest) Do

Do generates the request object and send the request object to the API endpoint

func (*GetSingleOrderRequest) GetParameters

func (g *GetSingleOrderRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetSingleOrderRequest) GetParametersJSON

func (g *GetSingleOrderRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetSingleOrderRequest) GetParametersQuery

func (g *GetSingleOrderRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetSingleOrderRequest) GetPath

func (g *GetSingleOrderRequest) GetPath() string

GetPath returns the request path of the API

func (*GetSingleOrderRequest) GetQueryParameters

func (g *GetSingleOrderRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetSingleOrderRequest) GetSlugParameters

func (g *GetSingleOrderRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetSingleOrderRequest) GetSlugsMap

func (g *GetSingleOrderRequest) GetSlugsMap() (map[string]string, error)

func (*GetSingleOrderRequest) OrderID

func (g *GetSingleOrderRequest) OrderID(orderID string) *GetSingleOrderRequest

type GetTickerRequest

type GetTickerRequest struct {
	// contains filtered or unexported fields
}

func (*GetTickerRequest) Do

func (g *GetTickerRequest) Do(ctx context.Context) (*Ticker, error)

Do generates the request object and send the request object to the API endpoint

func (*GetTickerRequest) GetParameters

func (g *GetTickerRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetTickerRequest) GetParametersJSON

func (g *GetTickerRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetTickerRequest) GetParametersQuery

func (g *GetTickerRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetTickerRequest) GetPath

func (g *GetTickerRequest) GetPath() string

GetPath returns the request path of the API

func (*GetTickerRequest) GetQueryParameters

func (g *GetTickerRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetTickerRequest) GetSlugParameters

func (g *GetTickerRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetTickerRequest) GetSlugsMap

func (g *GetTickerRequest) GetSlugsMap() (map[string]string, error)

func (*GetTickerRequest) ProductID

func (g *GetTickerRequest) ProductID(productID string) *GetTickerRequest

type Liquidity

type Liquidity string
const (
	LiquidityMaker Liquidity = "M"
	LiquidityTaker Liquidity = "T"
	LiquidityOther Liquidity = "O"
)

type MarketInfo

type MarketInfo struct {
	ID                     string           `json:"id"`
	BaseCurrency           string           `json:"base_currency"`
	QuoteCurrency          string           `json:"quote_currency"`
	QuoteIncrement         fixedpoint.Value `json:"quote_increment"`
	BaseIncrement          fixedpoint.Value `json:"base_increment"`
	DisplayName            string           `json:"display_name"`
	MinMarketFunds         fixedpoint.Value `json:"min_market_funds"`
	MarginEnabled          bool             `json:"margin_enabled"`
	PostOnly               bool             `json:"post_only"`
	LimitOnly              bool             `json:"limit_only"`
	CancelOnly             bool             `json:"cancel_only"`
	Status                 MarketStatus     `json:"status"`
	StatusMessage          string           `json:"status_message"`
	AuctionMode            bool             `json:"auction_mode"`
	TradingDisabled        bool             `json:"trading_disabled,omitempty"`
	FxStablecoin           bool             `json:"fx_stablecoin,omitempty"`
	MaxSlippagePercentage  string           `json:"max_slippage_percentage,omitempty"`
	HighBidLimitPercentage string           `json:"high_bid_limit_percentage,omitempty"`
}

type MarketInfoResponse

type MarketInfoResponse []MarketInfo

type MarketStatus

type MarketStatus string
const (
	MarketStatusOnline   MarketStatus = "online"
	MarketStatusOffline  MarketStatus = "offline"
	MarketStatusInternal MarketStatus = "internal"
	MarketStatusDelisted MarketStatus = "delisted"
)

type MarketType

type MarketType string
const (
	MarketTypeSpot MarketType = "spot"
	MarketTypeRfq  MarketType = "rfq"
)

type Order

type Order struct {
	Type      string           `json:"type"`
	Size      fixedpoint.Value `json:"size"`
	Side      SideType         `json:"side"`
	ProductID string           `json:"product_id"`
	// ClientOID must be uuid
	ClientOID string           `json:"client_oid"`
	Stop      string           `json:"stop"`
	StopPrice fixedpoint.Value `json:"stop_price"`

	// Limit Order
	Price       fixedpoint.Value `json:"price"`
	TimeInForce TimeInForceType  `json:"time_in_force"`
	PostOnly    bool             `json:"post_only"`
	CancelAfter string           `json:"cancel_after"`

	// Market Order
	Funds          fixedpoint.Value `json:"funds"`
	SpecifiedFunds fixedpoint.Value `json:"specified_funds"`

	// Response Fields
	ID            string           `json:"id"`
	Status        OrderStatus      `json:"status"`
	Settled       bool             `json:"settled"`
	DoneReason    string           `json:"done_reason"`
	DoneAt        types.Time       `json:"done_at"`
	CreatedAt     types.Time       `json:"created_at"`
	FillFees      fixedpoint.Value `json:"fill_fees"`
	FilledSize    fixedpoint.Value `json:"filled_size"`
	ExecutedValue fixedpoint.Value `json:"executed_value"`
}

type OrderSnapshot

type OrderSnapshot []Order

type OrderStatus

type OrderStatus string
const (
	OrderStatusReceived OrderStatus = "received"
	OrderStatusPending  OrderStatus = "pending"
	OrderStatusOpen     OrderStatus = "open"
	OrderStatusRejected OrderStatus = "rejected"
	OrderStatusDone     OrderStatus = "done"
	OrderStatusActive   OrderStatus = "active" // query only status
	OrderStatusAll      OrderStatus = "all"    // query only status
)

type OrderStopType

type OrderStopType string
const (
	OrderStopTypeLoss  OrderStopType = "loss"
	OrderStopTypeEntry OrderStopType = "entry"
)

type OrderType

type OrderType string
const (
	OrderTypeLimit  OrderType = "limit"
	OrderTypeMarket OrderType = "market"
	OrderTypeStop   OrderType = "stop"
)

type RawCandle

type RawCandle []fixedpoint.Value

an array of [ time, low, high, open, close, volume ] `time` is the timestamp of the start time of the bucket, which is the seconds since epoch.

func (*RawCandle) Candle

func (rc *RawCandle) Candle() (*Candle, error)

type RestAPIClient

type RestAPIClient struct {
	requestgen.BaseAPIClient
	// contains filtered or unexported fields
}

func NewClient

func NewClient(
	key, secret, passphrase string, timeout time.Duration,
) *RestAPIClient

func (*RestAPIClient) NewAuthenticatedRequest

func (client *RestAPIClient) NewAuthenticatedRequest(ctx context.Context, method, refURL string, params url.Values, payload interface{}) (*http.Request, error)

Implements AuthenticatedAPIClient

func (*RestAPIClient) NewCancelAllOrdersRequest

func (c *RestAPIClient) NewCancelAllOrdersRequest() *CancelAllOrdersRequest

func (*RestAPIClient) NewCancelOrderRequest

func (c *RestAPIClient) NewCancelOrderRequest() *CancelOrderRequest

func (*RestAPIClient) NewCreateOrderRequest

func (client *RestAPIClient) NewCreateOrderRequest() *CreateOrderRequest

func (*RestAPIClient) NewGetBalancesRequest

func (c *RestAPIClient) NewGetBalancesRequest() *GetBalancesRequest

func (*RestAPIClient) NewGetCandlesRequest

func (client *RestAPIClient) NewGetCandlesRequest() *GetCandlesRequest

func (*RestAPIClient) NewGetMarketInfoRequest

func (c *RestAPIClient) NewGetMarketInfoRequest() *GetMarketInfoRequest

func (*RestAPIClient) NewGetOrderTradesRequest

func (c *RestAPIClient) NewGetOrderTradesRequest() *GetOrderTradesRequest

func (*RestAPIClient) NewGetOrdersRequest

func (client *RestAPIClient) NewGetOrdersRequest() *GetOrdersRequest

func (*RestAPIClient) NewGetTickerRequest

func (client *RestAPIClient) NewGetTickerRequest() *GetTickerRequest

func (*RestAPIClient) NewSingleOrderRequst

func (client *RestAPIClient) NewSingleOrderRequst() *GetSingleOrderRequest

type SideType

type SideType string
const (
	SideTypeBuy  SideType = "buy"
	SideTypeSell SideType = "sell"
)

type Ticker

type Ticker struct {
	TradeID           int              `json:"trade_id"`
	Ask               fixedpoint.Value `json:"ask"`
	Bid               fixedpoint.Value `json:"bid"`
	Volume            fixedpoint.Value `json:"volume"`
	Price             fixedpoint.Value `json:"price"`
	Size              fixedpoint.Value `json:"size"`
	Time              types.Time       `json:"time"`
	RfqVolume         string           `json:"rfq_volume"`
	ConversionsVolume string           `json:"conversions_volume"`
}

type TimeInForceType

type TimeInForceType string
const (
	TimeInForceGTC TimeInForceType = "GTC"
	TimeInForceGTT TimeInForceType = "GTT"
	TimeInForceIOC TimeInForceType = "IOC"
	TimeInForceFOK TimeInForceType = "FOK"
)

type Trade

type Trade struct {
	TradeID         int              `json:"trade_id"`
	ProductID       string           `json:"product_id"`
	OrderID         string           `json:"order_id"`
	UserID          string           `json:"user_id"`
	ProfileID       string           `json:"profile_id"`
	Liquidity       Liquidity        `json:"liquidity"`
	Price           fixedpoint.Value `json:"price"`
	Size            fixedpoint.Value `json:"size"`
	Fee             fixedpoint.Value `json:"fee"`
	CreatedAt       types.Time       `json:"created_at"`
	Side            SideType         `json:"side"`
	Settled         bool             `json:"settled"`
	UsdVolume       string           `json:"usd_volume"`
	FundingCurrency string           `json:"funding_currency"`
}

type TradeSnapshot

type TradeSnapshot []Trade

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL