coinbase

package
v0.0.0-...-ea289b0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New() (*Client, error)

func (*Client) CancelOrders

func (self *Client) CancelOrders(orderIds []string) error

func (*Client) CreateOrder

func (self *Client) CreateOrder(market string, side consts.OrderSide, size, price float64) (string, error)

func (*Client) GetOpenOrders

func (self *Client) GetOpenOrders(market string, side consts.OrderSide) ([]Order, error)

func (*Client) GetProduct

func (self *Client) GetProduct(productId string) (*Product, error)

func (*Client) GetProducts

func (self *Client) GetProducts() ([]Product, error)

type Order

type Order struct {
	OrderId       string `json:"order_id"`   // unique id for this order
	ProductId     string `json:"product_id"` // product this order was created for e.g. 'BTC-USD'
	UserId        string `json:"user_id"`    // id of the user owning this Order
	Configuration struct {
		Limit struct {
			Size     float64 `json:"base_size,string"`   // amount of base currency to spend on order
			Price    float64 `json:"limit_price,string"` // ceiling price for which the order should get filled
			PostOnly bool    `json:"post_only"`          // post only limit order
		} `json:"limit_limit_gtc"`
	} `json:"order_configuration"`
	Side          string `json:"side"`            // possible values are: [UNKNOWN_ORDER_SIDE, BUY, SELL]
	ClientOrderId string `json:"client_order_id"` // client specified ID of order
	Status        string `json:"status"`          // possible values are: [OPEN, FILLED, CANCELLED, EXPIRED, FAILED, UNKNOWN_ORDER_STATUS]
	TimeInForce   string `json:"time_in_force"`   // possible values are: [UNKNOWN_TIME_IN_FORCE, GOOD_UNTIL_DATE_TIME, GOOD_UNTIL_CANCELLED, IMMEDIATE_OR_CANCEL, FILL_OR_KILL]
}

type Product

type Product struct {
	ProductId                 string `json:"product_id"`                   // trading pair
	Price                     string `json:"price"`                        // current price for the product, in quote currency
	PricePercentageChange24h  string `json:"price_percentage_change_24h"`  // amount the price of the product has changed, in percent, in the last 24 hours
	Volume24h                 string `json:"volume_24h"`                   // trading volume for the product in the last 24 hours
	VolumePercentageChange24h string `json:"volume_percentage_change_24h"` // percentage amount the volume of the product has changed in the last 24 hours
	BaseIncrement             string `json:"base_increment"`               // minimum amount base value can be increased or decreased at once
	QuoteIncrement            string `json:"quote_increment"`              // minimum amount quote value can be increased or decreased at once
	QuoteMinSize              string `json:"quote_min_size"`               // minimum size that can be represented of quote currency
	QuoteMaxSize              string `json:"quote_max_size"`               // maximum size that can be represented of quote currency
	BaseMinSize               string `json:"base_min_size"`                // minimum size that can be represented of base currency
	BaseMaxSize               string `json:"base_max_size"`                // maximum size that can be represented of base currency
	BaseName                  string `json:"base_name"`                    // name of the base currency
	QuoteName                 string `json:"quote_name"`                   // name of the quote currency
	Watched                   bool   `json:"watched"`                      // whether or not the product is on the user's watchlist
	IsDisabled                bool   `json:"is_disabled"`                  // whether or not the product is disabled for trading
	New                       bool   `json:"new"`                          // whether or not the product is 'new'
	Status                    string `json:"status"`                       // status of the product
	CancelOnly                bool   `json:"cancel_only"`                  // whether or not orders of the product can only be cancelled, not placed or edited
	LimitOnly                 bool   `json:"limit_only"`                   // whether or not orders of the product can only be limit orders, not market orders
	PostOnly                  bool   `json:"post_only"`                    // whether or not orders of the product can only be posted, not cancelled
	TradingDisabled           bool   `json:"trading_disabled"`             // whether or not the product is disabled for trading for all market participants
	AuctionMode               bool   `json:"auction_mode"`                 // whether or not the product is in auction mode
	ProductType               string `json:"product_type"`                 // possible values are: [SPOT, FUTURE]
	QuoteCurrencyId           string `json:"quote_currency_id"`            // symbol of the quote currency
	BaseCurrencyId            string `json:"base_currency_id"`             // symbol of the base currency
	ViewOnly                  bool   `json:"view_only"`                    // whether or not the product is in view only mode
	PriceIncrement            string `json:"price_increment"`              // minimum amount price can be increased or decreased at once
}

Jump to

Keyboard shortcuts

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