kucoinapi

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2022 License: MIT Imports: 19 Imported by: 3

Documentation

Index

Constants

View Source
const RestBaseURL = "https://api.kucoin.com/api"
View Source
const SandboxRestBaseURL = "https://openapi-sandbox.kucoin.com/api"

Variables

This section is empty.

Functions

This section is empty.

Types

type APIResponse added in v1.21.1

type APIResponse struct {
	Code    string          `json:"code"`
	Message string          `json:"msg"`
	Data    json.RawMessage `json:"data"`
}

type Account

type Account struct {
	ID        string           `json:"id"`
	Currency  string           `json:"currency"`
	Type      AccountType      `json:"type"`
	Balance   fixedpoint.Value `json:"balance"`
	Available fixedpoint.Value `json:"available"`
	Holds     fixedpoint.Value `json:"holds"`
}

type AccountService

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

func (*AccountService) NewGetAccountRequest added in v1.22.3

func (s *AccountService) NewGetAccountRequest(accountID string) *GetAccountRequest

func (*AccountService) NewListAccountsRequest added in v1.22.3

func (s *AccountService) NewListAccountsRequest() *ListAccountsRequest

func (*AccountService) NewListSubAccountsRequest added in v1.22.3

func (s *AccountService) NewListSubAccountsRequest() *ListSubAccountsRequest

type AccountType

type AccountType string
const (
	AccountTypeMain   AccountType = "main"
	AccountTypeTrade  AccountType = "trade"
	AccountTypeMargin AccountType = "margin"
	AccountTypePool   AccountType = "pool"
)

type AllTickers

type AllTickers struct {
	Time   types.MillisecondTimestamp `json:"time"`
	Ticker []Ticker24H                `json:"ticker"`
}

type BatchPlaceOrderRequest

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

Request via this endpoint to place 5 orders at the same time. The order type must be a limit order of the same symbol. The interface currently only supports spot trading

func (*BatchPlaceOrderRequest) Add

func (*BatchPlaceOrderRequest) Do

func (*BatchPlaceOrderRequest) Symbol

type Bullet

type Bullet struct {
	InstanceServers []struct {
		Endpoint     string `json:"endpoint"`
		Protocol     string `json:"protocol"`
		Encrypt      bool   `json:"encrypt"`
		PingInterval int    `json:"pingInterval"`
		PingTimeout  int    `json:"pingTimeout"`
	} `json:"instanceServers"`
	Token string `json:"token"`
}

func (*Bullet) PingInterval

func (b *Bullet) PingInterval() time.Duration

func (*Bullet) PingTimeout

func (b *Bullet) PingTimeout() time.Duration

func (*Bullet) URL

func (b *Bullet) URL() (*url.URL, error)

type BulletService

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

func (*BulletService) NewGetPrivateBulletRequest

func (s *BulletService) NewGetPrivateBulletRequest() *GetPrivateBulletRequest

func (*BulletService) NewGetPublicBulletRequest

func (s *BulletService) NewGetPublicBulletRequest() *GetPublicBulletRequest

type CancelAllOrderRequest

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

func (*CancelAllOrderRequest) Do

func (*CancelAllOrderRequest) GetParameters

func (r *CancelAllOrderRequest) GetParameters() (map[string]interface{}, error)

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

func (*CancelAllOrderRequest) GetParametersJSON

func (r *CancelAllOrderRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*CancelAllOrderRequest) GetParametersQuery

func (r *CancelAllOrderRequest) GetParametersQuery() (url.Values, error)

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

func (*CancelAllOrderRequest) GetQueryParameters added in v1.21.2

func (r *CancelAllOrderRequest) GetQueryParameters() (url.Values, error)

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

func (*CancelAllOrderRequest) GetSlugParameters added in v1.22.0

func (r *CancelAllOrderRequest) GetSlugParameters() (map[string]interface{}, error)

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

func (*CancelAllOrderRequest) GetSlugsMap added in v1.22.0

func (r *CancelAllOrderRequest) GetSlugsMap() (map[string]string, error)

func (*CancelAllOrderRequest) Symbol

func (*CancelAllOrderRequest) TradeType

func (r *CancelAllOrderRequest) TradeType(tradeType string) *CancelAllOrderRequest

type CancelOrderRequest

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

func (*CancelOrderRequest) ClientOrderID

func (r *CancelOrderRequest) ClientOrderID(clientOrderID string) *CancelOrderRequest

func (*CancelOrderRequest) Do

func (*CancelOrderRequest) GetParameters

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

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

func (*CancelOrderRequest) GetParametersJSON

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*CancelOrderRequest) GetParametersQuery

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

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

func (*CancelOrderRequest) GetQueryParameters added in v1.21.2

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

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

func (*CancelOrderRequest) GetSlugParameters added in v1.22.0

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

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

func (*CancelOrderRequest) GetSlugsMap added in v1.22.0

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

func (*CancelOrderRequest) OrderID

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

type CancelOrderResponse

type CancelOrderResponse struct {
	CancelledOrderIDs []string `json:"cancelledOrderIds,omitempty"`

	// used when using client order id for canceling order
	CancelledOrderId string `json:"cancelledOrderId,omitempty"`
	ClientOrderID    string `json:"clientOid,omitempty"`
}

type Fill

type Fill struct {
	Symbol         string                     `json:"symbol"`
	TradeId        string                     `json:"tradeId"`
	OrderId        string                     `json:"orderId"`
	CounterOrderId string                     `json:"counterOrderId"`
	Side           SideType                   `json:"side"`
	Liquidity      LiquidityType              `json:"liquidity"`
	ForceTaker     bool                       `json:"forceTaker"`
	Price          fixedpoint.Value           `json:"price"`
	Size           fixedpoint.Value           `json:"size"`
	Funds          fixedpoint.Value           `json:"funds"`
	Fee            fixedpoint.Value           `json:"fee"`
	FeeRate        fixedpoint.Value           `json:"feeRate"`
	FeeCurrency    string                     `json:"feeCurrency"`
	Stop           string                     `json:"stop"`
	Type           OrderType                  `json:"type"`
	CreatedAt      types.MillisecondTimestamp `json:"createdAt"`
	TradeType      TradeType                  `json:"tradeType"`
}

type FillListPage

type FillListPage struct {
	CurrentPage int    `json:"currentPage"`
	PageSize    int    `json:"pageSize"`
	TotalNumber int    `json:"totalNum"`
	TotalPage   int    `json:"totalPage"`
	Items       []Fill `json:"items"`
}

type GetAccountRequest added in v1.22.0

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

func (*GetAccountRequest) AccountID added in v1.22.0

func (g *GetAccountRequest) AccountID(accountID string) *GetAccountRequest

func (*GetAccountRequest) Do added in v1.22.0

func (*GetAccountRequest) GetParameters added in v1.22.0

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

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

func (*GetAccountRequest) GetParametersJSON added in v1.22.0

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetAccountRequest) GetParametersQuery added in v1.22.0

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

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

func (*GetAccountRequest) GetQueryParameters added in v1.22.0

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

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

func (*GetAccountRequest) GetSlugParameters added in v1.22.0

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

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

func (*GetAccountRequest) GetSlugsMap added in v1.22.0

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

type GetAllTickersRequest added in v1.21.2

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

func (*GetAllTickersRequest) Do added in v1.21.2

func (*GetAllTickersRequest) GetParameters added in v1.21.2

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

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

func (*GetAllTickersRequest) GetParametersJSON added in v1.21.2

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetAllTickersRequest) GetParametersQuery added in v1.21.2

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

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

func (*GetAllTickersRequest) GetQueryParameters added in v1.21.2

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

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

func (*GetAllTickersRequest) GetSlugParameters added in v1.22.0

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

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

func (*GetAllTickersRequest) GetSlugsMap added in v1.22.0

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

type GetFillsRequest

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

func (*GetFillsRequest) Do

func (*GetFillsRequest) EndAt

func (r *GetFillsRequest) EndAt(endAt time.Time) *GetFillsRequest

func (*GetFillsRequest) GetParameters

func (r *GetFillsRequest) GetParameters() (map[string]interface{}, error)

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

func (*GetFillsRequest) GetParametersJSON

func (r *GetFillsRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetFillsRequest) GetParametersQuery

func (r *GetFillsRequest) GetParametersQuery() (url.Values, error)

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

func (*GetFillsRequest) GetQueryParameters added in v1.21.2

func (r *GetFillsRequest) GetQueryParameters() (url.Values, error)

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

func (*GetFillsRequest) GetSlugParameters added in v1.22.0

func (r *GetFillsRequest) GetSlugParameters() (map[string]interface{}, error)

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

func (*GetFillsRequest) GetSlugsMap added in v1.22.0

func (r *GetFillsRequest) GetSlugsMap() (map[string]string, error)

func (*GetFillsRequest) OrderID

func (r *GetFillsRequest) OrderID(orderID string) *GetFillsRequest

func (*GetFillsRequest) OrderType

func (r *GetFillsRequest) OrderType(orderType string) *GetFillsRequest

func (*GetFillsRequest) Side

func (r *GetFillsRequest) Side(side string) *GetFillsRequest

func (*GetFillsRequest) StartAt

func (r *GetFillsRequest) StartAt(startAt time.Time) *GetFillsRequest

func (*GetFillsRequest) Symbol

func (r *GetFillsRequest) Symbol(symbol string) *GetFillsRequest

func (*GetFillsRequest) TradeType added in v1.22.2

func (r *GetFillsRequest) TradeType(tradeType string) *GetFillsRequest

type GetKLinesRequest

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

func (*GetKLinesRequest) Do

func (r *GetKLinesRequest) Do(ctx context.Context) ([]KLine, error)

func (*GetKLinesRequest) EndAt

func (r *GetKLinesRequest) EndAt(endAt time.Time) *GetKLinesRequest

func (*GetKLinesRequest) GetParameters

func (r *GetKLinesRequest) GetParameters() (map[string]interface{}, error)

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

func (*GetKLinesRequest) GetParametersJSON

func (r *GetKLinesRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetKLinesRequest) GetParametersQuery

func (r *GetKLinesRequest) GetParametersQuery() (url.Values, error)

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

func (*GetKLinesRequest) GetQueryParameters added in v1.21.2

func (r *GetKLinesRequest) GetQueryParameters() (url.Values, error)

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

func (*GetKLinesRequest) GetSlugParameters added in v1.22.0

func (r *GetKLinesRequest) GetSlugParameters() (map[string]interface{}, error)

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

func (*GetKLinesRequest) GetSlugsMap added in v1.22.0

func (r *GetKLinesRequest) GetSlugsMap() (map[string]string, error)

func (*GetKLinesRequest) Interval

func (r *GetKLinesRequest) Interval(interval string) *GetKLinesRequest

func (*GetKLinesRequest) StartAt

func (r *GetKLinesRequest) StartAt(startAt time.Time) *GetKLinesRequest

func (*GetKLinesRequest) Symbol

func (r *GetKLinesRequest) Symbol(symbol string) *GetKLinesRequest

type GetOrderBookLevel2Depth100Request added in v1.21.2

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

func (*GetOrderBookLevel2Depth100Request) Do added in v1.21.2

func (*GetOrderBookLevel2Depth100Request) GetParameters added in v1.21.2

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

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

func (*GetOrderBookLevel2Depth100Request) GetParametersJSON added in v1.21.2

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetOrderBookLevel2Depth100Request) GetParametersQuery added in v1.21.2

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

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

func (*GetOrderBookLevel2Depth100Request) GetQueryParameters added in v1.21.2

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

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

func (*GetOrderBookLevel2Depth100Request) GetSlugParameters added in v1.22.0

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

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

func (*GetOrderBookLevel2Depth100Request) GetSlugsMap added in v1.22.0

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

func (*GetOrderBookLevel2Depth100Request) Symbol added in v1.21.2

type GetOrderBookLevel2Depth20Request added in v1.21.2

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

func (*GetOrderBookLevel2Depth20Request) Do added in v1.21.2

func (*GetOrderBookLevel2Depth20Request) GetParameters added in v1.21.2

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

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

func (*GetOrderBookLevel2Depth20Request) GetParametersJSON added in v1.21.2

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetOrderBookLevel2Depth20Request) GetParametersQuery added in v1.21.2

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

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

func (*GetOrderBookLevel2Depth20Request) GetQueryParameters added in v1.21.2

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

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

func (*GetOrderBookLevel2Depth20Request) GetSlugParameters added in v1.22.0

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

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

func (*GetOrderBookLevel2Depth20Request) GetSlugsMap added in v1.22.0

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

func (*GetOrderBookLevel2Depth20Request) Symbol added in v1.21.2

type GetOrderBookLevel2DepthAllRequest added in v1.21.2

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

func (*GetOrderBookLevel2DepthAllRequest) Do added in v1.21.2

func (*GetOrderBookLevel2DepthAllRequest) GetParameters added in v1.21.2

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

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

func (*GetOrderBookLevel2DepthAllRequest) GetParametersJSON added in v1.21.2

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetOrderBookLevel2DepthAllRequest) GetParametersQuery added in v1.21.2

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

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

func (*GetOrderBookLevel2DepthAllRequest) GetQueryParameters added in v1.21.2

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

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

func (*GetOrderBookLevel2DepthAllRequest) GetSlugParameters added in v1.22.0

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

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

func (*GetOrderBookLevel2DepthAllRequest) GetSlugsMap added in v1.22.0

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

func (*GetOrderBookLevel2DepthAllRequest) Symbol added in v1.21.2

type GetPrivateBulletRequest

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

func (*GetPrivateBulletRequest) Do

func (*GetPrivateBulletRequest) GetParameters added in v1.22.0

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

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

func (*GetPrivateBulletRequest) GetParametersJSON added in v1.22.0

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetPrivateBulletRequest) GetParametersQuery added in v1.22.0

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

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

func (*GetPrivateBulletRequest) GetQueryParameters added in v1.22.0

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

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

func (*GetPrivateBulletRequest) GetSlugParameters added in v1.22.0

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

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

func (*GetPrivateBulletRequest) GetSlugsMap added in v1.22.0

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

type GetPublicBulletRequest

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

func (*GetPublicBulletRequest) Do

func (*GetPublicBulletRequest) GetParameters added in v1.22.0

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

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

func (*GetPublicBulletRequest) GetParametersJSON added in v1.22.0

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetPublicBulletRequest) GetParametersQuery added in v1.22.0

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

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

func (*GetPublicBulletRequest) GetQueryParameters added in v1.22.0

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

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

func (*GetPublicBulletRequest) GetSlugParameters added in v1.22.0

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

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

func (*GetPublicBulletRequest) GetSlugsMap added in v1.22.0

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

type GetTickerRequest added in v1.21.2

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

func (*GetTickerRequest) Do added in v1.21.2

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

func (*GetTickerRequest) GetParameters added in v1.21.2

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 added in v1.21.2

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetTickerRequest) GetParametersQuery added in v1.21.2

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

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

func (*GetTickerRequest) GetQueryParameters added in v1.21.2

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

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

func (*GetTickerRequest) GetSlugParameters added in v1.22.0

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 added in v1.22.0

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

func (*GetTickerRequest) Symbol added in v1.21.2

func (g *GetTickerRequest) Symbol(symbol string) *GetTickerRequest

type HistoryOrder added in v1.22.2

type HistoryOrder struct {
	Symbol    string `json:"symbol"`
	DealPrice string `json:"dealPrice"`
	DealValue string `json:"dealValue"`
	Amount    string `json:"amount"`
	Fee       string `json:"fee"`
	Side      string `json:"side"`
	CreatedAt int    `json:"createdAt"`
}

type HistoryOrderListPage added in v1.22.2

type HistoryOrderListPage struct {
	CurrentPage int            `json:"currentPage"`
	PageSize    int            `json:"pageSize"`
	TotalNum    int            `json:"totalNum"`
	TotalPage   int            `json:"totalPage"`
	Items       []HistoryOrder `json:"items"`
}

type KLine

type KLine struct {
	Symbol              string
	Interval            string
	StartTime           time.Time
	Open                fixedpoint.Value
	High                fixedpoint.Value
	Low                 fixedpoint.Value
	Close               fixedpoint.Value
	Volume, QuoteVolume fixedpoint.Value
}

type LiquidityType

type LiquidityType string
const (
	LiquidityTypeMaker LiquidityType = "maker"
	LiquidityTypeTaker LiquidityType = "taker"
)

type ListAccountsRequest added in v1.22.0

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

func (*ListAccountsRequest) Do added in v1.22.0

func (*ListAccountsRequest) GetParameters added in v1.22.0

func (l *ListAccountsRequest) GetParameters() (map[string]interface{}, error)

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

func (*ListAccountsRequest) GetParametersJSON added in v1.22.0

func (l *ListAccountsRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*ListAccountsRequest) GetParametersQuery added in v1.22.0

func (l *ListAccountsRequest) GetParametersQuery() (url.Values, error)

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

func (*ListAccountsRequest) GetQueryParameters added in v1.22.0

func (l *ListAccountsRequest) GetQueryParameters() (url.Values, error)

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

func (*ListAccountsRequest) GetSlugParameters added in v1.22.0

func (l *ListAccountsRequest) GetSlugParameters() (map[string]interface{}, error)

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

func (*ListAccountsRequest) GetSlugsMap added in v1.22.0

func (l *ListAccountsRequest) GetSlugsMap() (map[string]string, error)

type ListHistoryOrdersRequest added in v1.22.2

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

func (*ListHistoryOrdersRequest) Do added in v1.22.2

func (*ListHistoryOrdersRequest) EndAt added in v1.22.2

func (*ListHistoryOrdersRequest) GetParameters added in v1.22.2

func (l *ListHistoryOrdersRequest) GetParameters() (map[string]interface{}, error)

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

func (*ListHistoryOrdersRequest) GetParametersJSON added in v1.22.2

func (l *ListHistoryOrdersRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*ListHistoryOrdersRequest) GetParametersQuery added in v1.22.2

func (l *ListHistoryOrdersRequest) GetParametersQuery() (url.Values, error)

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

func (*ListHistoryOrdersRequest) GetQueryParameters added in v1.22.2

func (l *ListHistoryOrdersRequest) GetQueryParameters() (url.Values, error)

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

func (*ListHistoryOrdersRequest) GetSlugParameters added in v1.22.2

func (l *ListHistoryOrdersRequest) GetSlugParameters() (map[string]interface{}, error)

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

func (*ListHistoryOrdersRequest) GetSlugsMap added in v1.22.2

func (l *ListHistoryOrdersRequest) GetSlugsMap() (map[string]string, error)

func (*ListHistoryOrdersRequest) StartAt added in v1.22.2

func (*ListHistoryOrdersRequest) Symbol added in v1.22.2

type ListOrdersRequest

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

func (*ListOrdersRequest) Do

func (*ListOrdersRequest) EndAt

func (r *ListOrdersRequest) EndAt(endAt time.Time) *ListOrdersRequest

func (*ListOrdersRequest) GetParameters

func (r *ListOrdersRequest) GetParameters() (map[string]interface{}, error)

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

func (*ListOrdersRequest) GetParametersJSON

func (r *ListOrdersRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*ListOrdersRequest) GetParametersQuery

func (r *ListOrdersRequest) GetParametersQuery() (url.Values, error)

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

func (*ListOrdersRequest) GetQueryParameters added in v1.21.2

func (r *ListOrdersRequest) GetQueryParameters() (url.Values, error)

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

func (*ListOrdersRequest) GetSlugParameters added in v1.22.0

func (r *ListOrdersRequest) GetSlugParameters() (map[string]interface{}, error)

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

func (*ListOrdersRequest) GetSlugsMap added in v1.22.0

func (r *ListOrdersRequest) GetSlugsMap() (map[string]string, error)

func (*ListOrdersRequest) OrderType

func (r *ListOrdersRequest) OrderType(orderType OrderType) *ListOrdersRequest

func (*ListOrdersRequest) Side

func (*ListOrdersRequest) StartAt

func (r *ListOrdersRequest) StartAt(startAt time.Time) *ListOrdersRequest

func (*ListOrdersRequest) Status

func (r *ListOrdersRequest) Status(status string) *ListOrdersRequest

func (*ListOrdersRequest) Symbol

func (r *ListOrdersRequest) Symbol(symbol string) *ListOrdersRequest

func (*ListOrdersRequest) TradeType

func (r *ListOrdersRequest) TradeType(tradeType TradeType) *ListOrdersRequest

type ListSubAccountsRequest added in v1.22.0

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

func (*ListSubAccountsRequest) Do added in v1.22.0

func (*ListSubAccountsRequest) GetParameters added in v1.22.0

func (l *ListSubAccountsRequest) GetParameters() (map[string]interface{}, error)

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

func (*ListSubAccountsRequest) GetParametersJSON added in v1.22.0

func (l *ListSubAccountsRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*ListSubAccountsRequest) GetParametersQuery added in v1.22.0

func (l *ListSubAccountsRequest) GetParametersQuery() (url.Values, error)

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

func (*ListSubAccountsRequest) GetQueryParameters added in v1.22.0

func (l *ListSubAccountsRequest) GetQueryParameters() (url.Values, error)

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

func (*ListSubAccountsRequest) GetSlugParameters added in v1.22.0

func (l *ListSubAccountsRequest) GetSlugParameters() (map[string]interface{}, error)

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

func (*ListSubAccountsRequest) GetSlugsMap added in v1.22.0

func (l *ListSubAccountsRequest) GetSlugsMap() (map[string]string, error)

type ListSymbolsRequest added in v1.21.2

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

func (*ListSymbolsRequest) Do added in v1.21.2

func (l *ListSymbolsRequest) Do(ctx context.Context) ([]Symbol, error)

func (*ListSymbolsRequest) GetParameters added in v1.21.2

func (l *ListSymbolsRequest) GetParameters() (map[string]interface{}, error)

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

func (*ListSymbolsRequest) GetParametersJSON added in v1.21.2

func (l *ListSymbolsRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*ListSymbolsRequest) GetParametersQuery added in v1.21.2

func (l *ListSymbolsRequest) GetParametersQuery() (url.Values, error)

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

func (*ListSymbolsRequest) GetQueryParameters added in v1.21.2

func (l *ListSymbolsRequest) GetQueryParameters() (url.Values, error)

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

func (*ListSymbolsRequest) GetSlugParameters added in v1.22.0

func (l *ListSymbolsRequest) GetSlugParameters() (map[string]interface{}, error)

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

func (*ListSymbolsRequest) GetSlugsMap added in v1.22.0

func (l *ListSymbolsRequest) GetSlugsMap() (map[string]string, error)

func (*ListSymbolsRequest) Market added in v1.21.2

func (l *ListSymbolsRequest) Market(market string) *ListSymbolsRequest

type MarketDataService

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

func (*MarketDataService) GetOrderBook

func (s *MarketDataService) GetOrderBook(symbol string, depth int) (*OrderBook, error)

func (*MarketDataService) GetTicker24HStat

func (s *MarketDataService) GetTicker24HStat(symbol string) (*Ticker24H, error)

func (*MarketDataService) ListSymbols

func (s *MarketDataService) ListSymbols(market ...string) ([]Symbol, error)

func (*MarketDataService) ListTickers

func (s *MarketDataService) ListTickers() (*AllTickers, error)

func (*MarketDataService) NewGetKLinesRequest

func (s *MarketDataService) NewGetKLinesRequest() *GetKLinesRequest

func (*MarketDataService) NewGetOrderBookRequest added in v1.21.2

func (s *MarketDataService) NewGetOrderBookRequest(symbol string, depth int) OrderBookRequest

func (*MarketDataService) NewGetTickerRequest added in v1.21.2

func (s *MarketDataService) NewGetTickerRequest(symbol string) *GetTickerRequest

func (*MarketDataService) NewListSymbolsRequest added in v1.21.2

func (s *MarketDataService) NewListSymbolsRequest() *ListSymbolsRequest

type Order

type Order struct {
	ID             string                     `json:"id"`
	Symbol         string                     `json:"symbol"`
	OperationType  string                     `json:"opType"`
	Type           string                     `json:"type"`
	Side           string                     `json:"side"`
	Price          fixedpoint.Value           `json:"price"`
	Size           fixedpoint.Value           `json:"size"`
	Funds          fixedpoint.Value           `json:"funds"`
	DealFunds      fixedpoint.Value           `json:"dealFunds"`
	DealSize       fixedpoint.Value           `json:"dealSize"`
	Fee            fixedpoint.Value           `json:"fee"`
	FeeCurrency    string                     `json:"feeCurrency"`
	StopType       string                     `json:"stop"`
	StopTriggerred bool                       `json:"stopTriggered"`
	StopPrice      fixedpoint.Value           `json:"stopPrice"`
	TimeInForce    TimeInForceType            `json:"timeInForce"`
	PostOnly       bool                       `json:"postOnly"`
	Hidden         bool                       `json:"hidden"`
	Iceberg        bool                       `json:"iceberg"`
	Channel        string                     `json:"channel"`
	ClientOrderID  string                     `json:"clientOid"`
	Remark         string                     `json:"remark"`
	IsActive       bool                       `json:"isActive"`
	CancelExist    bool                       `json:"cancelExist"`
	CreatedAt      types.MillisecondTimestamp `json:"createdAt"`
}

type OrderBook

type OrderBook struct {
	Sequence string                     `json:"sequence,omitempty"`
	Time     types.MillisecondTimestamp `json:"time"`
	Bids     types.PriceVolumeSlice     `json:"bids,omitempty"`
	Asks     types.PriceVolumeSlice     `json:"asks,omitempty"`
}
{
    "sequence": "3262786978",
    "time": 1550653727731,
    "bids": [["6500.12", "0.45054140"],
             ["6500.11", "0.45054140"]],  //[price,size]
    "asks": [["6500.16", "0.57753524"],
             ["6500.15", "0.57753524"]]
}

type OrderBookRequest added in v1.21.2

type OrderBookRequest interface {
	Do(ctx context.Context) (*OrderBook, error)
}

type OrderListPage

type OrderListPage struct {
	CurrentPage int     `json:"currentPage"`
	PageSize    int     `json:"pageSize"`
	TotalNumber int     `json:"totalNum"`
	TotalPage   int     `json:"totalPage"`
	Items       []Order `json:"items"`
}

type OrderResponse

type OrderResponse struct {
	OrderID string `json:"orderId"`
}

type OrderState

type OrderState string
const (
	OrderStateCanceled        OrderState = "canceled"
	OrderStateLive            OrderState = "live"
	OrderStatePartiallyFilled OrderState = "partially_filled"
	OrderStateFilled          OrderState = "filled"
)

type OrderType

type OrderType string
const (
	OrderTypeMarket    OrderType = "market"
	OrderTypeLimit     OrderType = "limit"
	OrderTypeStopLimit OrderType = "stop_limit"
)

type PlaceOrderRequest

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

func (*PlaceOrderRequest) ClientOrderID

func (r *PlaceOrderRequest) ClientOrderID(clientOrderID string) *PlaceOrderRequest

func (*PlaceOrderRequest) Do

func (*PlaceOrderRequest) GetParameters

func (r *PlaceOrderRequest) GetParameters() (map[string]interface{}, error)

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

func (*PlaceOrderRequest) GetParametersJSON

func (r *PlaceOrderRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*PlaceOrderRequest) GetParametersQuery

func (r *PlaceOrderRequest) GetParametersQuery() (url.Values, error)

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

func (*PlaceOrderRequest) GetQueryParameters added in v1.21.2

func (r *PlaceOrderRequest) GetQueryParameters() (url.Values, error)

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

func (*PlaceOrderRequest) GetSlugParameters added in v1.22.0

func (r *PlaceOrderRequest) GetSlugParameters() (map[string]interface{}, error)

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

func (*PlaceOrderRequest) GetSlugsMap added in v1.22.0

func (r *PlaceOrderRequest) GetSlugsMap() (map[string]string, error)

func (*PlaceOrderRequest) OrderType

func (r *PlaceOrderRequest) OrderType(orderType OrderType) *PlaceOrderRequest

func (*PlaceOrderRequest) Price

func (r *PlaceOrderRequest) Price(price string) *PlaceOrderRequest

func (*PlaceOrderRequest) Side

func (*PlaceOrderRequest) Size

func (*PlaceOrderRequest) Symbol

func (r *PlaceOrderRequest) Symbol(symbol string) *PlaceOrderRequest

func (*PlaceOrderRequest) Tag

func (*PlaceOrderRequest) TimeInForce

func (r *PlaceOrderRequest) TimeInForce(timeInForce TimeInForceType) *PlaceOrderRequest

type RestClient

type RestClient struct {
	BaseURL *url.URL

	Key, Secret, Passphrase string
	KeyVersion              string

	AccountService    *AccountService
	MarketDataService *MarketDataService
	TradeService      *TradeService
	BulletService     *BulletService
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *RestClient

func (*RestClient) Auth

func (c *RestClient) Auth(key, secret, passphrase string)

func (*RestClient) NewAuthenticatedRequest

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

newAuthenticatedRequest creates new http request for authenticated routes.

func (*RestClient) NewRequest

func (c *RestClient) NewRequest(ctx context.Context, method, refURL string, params url.Values, payload interface{}) (*http.Request, error)

NewRequest create new API request. Relative url can be provided in refURL.

func (*RestClient) SendRequest

func (c *RestClient) SendRequest(req *http.Request) (*requestgen.Response, error)

sendRequest sends the request to the API server and handle the response

type SideType

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

type SubAccount

type SubAccount struct {
	UserID string `json:"userId"`
	Name   string `json:"subName"`
	Type   string `json:"type"`
	Remark string `json:"remarks"`
}

type Symbol

type Symbol struct {
	Symbol          string           `json:"symbol"`
	Name            string           `json:"name"`
	BaseCurrency    string           `json:"baseCurrency"`
	QuoteCurrency   string           `json:"quoteCurrency"`
	FeeCurrency     string           `json:"feeCurrency"`
	Market          string           `json:"market"`
	BaseMinSize     fixedpoint.Value `json:"baseMinSize"`
	QuoteMinSize    fixedpoint.Value `json:"quoteMinSize"`
	BaseIncrement   fixedpoint.Value `json:"baseIncrement"`
	QuoteIncrement  fixedpoint.Value `json:"quoteIncrement"`
	PriceIncrement  fixedpoint.Value `json:"priceIncrement"`
	PriceLimitRate  fixedpoint.Value `json:"priceLimitRate"`
	IsMarginEnabled bool             `json:"isMarginEnabled"`
	EnableTrading   bool             `json:"enableTrading"`
}

type Ticker

type Ticker struct {
	Sequence    string                     `json:"sequence"`
	Size        fixedpoint.Value           `json:"size"`
	Price       fixedpoint.Value           `json:"price"`
	BestAsk     fixedpoint.Value           `json:"bestAsk"`
	BestBid     fixedpoint.Value           `json:"bestBid"`
	BestBidSize fixedpoint.Value           `json:"bestBidSize"`
	Time        types.MillisecondTimestamp `json:"time"`
}

//Get Ticker

{
    "sequence": "1550467636704",
    "bestAsk": "0.03715004",
    "size": "0.17",
    "price": "0.03715005",
    "bestBidSize": "3.803",
    "bestBid": "0.03710768",
    "bestAskSize": "1.788",
    "time": 1550653727731
}

type Ticker24H

type Ticker24H struct {
	Symbol       string           `json:"symbol"`
	SymbolName   string           `json:"symbolName"`
	Buy          fixedpoint.Value `json:"buy"`
	Sell         fixedpoint.Value `json:"sell"`
	ChangeRate   fixedpoint.Value `json:"changeRate"`
	ChangePrice  fixedpoint.Value `json:"changePrice"`
	High         fixedpoint.Value `json:"high"`
	Low          fixedpoint.Value `json:"low"`
	Last         fixedpoint.Value `json:"last"`
	AveragePrice fixedpoint.Value `json:"averagePrice"`
	Volume       fixedpoint.Value `json:"vol"`      // base volume
	VolumeValue  fixedpoint.Value `json:"volValue"` // quote volume

	TakerFeeRate fixedpoint.Value `json:"takerFeeRate"`
	MakerFeeRate fixedpoint.Value `json:"makerFeeRate"`

	TakerCoefficient fixedpoint.Value `json:"takerCoefficient"`
	MakerCoefficient fixedpoint.Value `json:"makerCoefficient"`

	Time types.MillisecondTimestamp `json:"time"`
}

type TimeInForceType

type TimeInForceType string
const (
	// GTC Good Till Canceled orders remain open on the book until canceled. This is the default behavior if no policy is specified.
	TimeInForceGTC TimeInForceType = "GTC"

	// GTT Good Till Time orders remain open on the book until canceled or the allotted cancelAfter is depleted on the matching engine. GTT orders are guaranteed to cancel before any other order is processed after the cancelAfter seconds placed in order book.
	TimeInForceGTT TimeInForceType = "GTT"

	// FOK Fill Or Kill orders are rejected if the entire size cannot be matched.
	TimeInForceFOK TimeInForceType = "FOK"

	// IOC Immediate Or Cancel orders instantly cancel the remaining size of the limit order instead of opening it on the book.
	TimeInForceIOC TimeInForceType = "IOC"
)

type TradeService

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

func (*TradeService) NewBatchPlaceOrderRequest

func (c *TradeService) NewBatchPlaceOrderRequest() *BatchPlaceOrderRequest

func (*TradeService) NewCancelAllOrderRequest

func (c *TradeService) NewCancelAllOrderRequest() *CancelAllOrderRequest

func (*TradeService) NewCancelOrderRequest

func (c *TradeService) NewCancelOrderRequest() *CancelOrderRequest

func (*TradeService) NewGetFillsRequest

func (c *TradeService) NewGetFillsRequest() *GetFillsRequest

func (*TradeService) NewListHistoryOrdersRequest added in v1.22.2

func (c *TradeService) NewListHistoryOrdersRequest() *ListHistoryOrdersRequest

func (*TradeService) NewListOrdersRequest

func (c *TradeService) NewListOrdersRequest() *ListOrdersRequest

func (*TradeService) NewPlaceOrderRequest

func (c *TradeService) NewPlaceOrderRequest() *PlaceOrderRequest

type TradeType

type TradeType string
const (
	TradeTypeSpot   TradeType = "TRADE"
	TradeTypeMargin TradeType = "MARGIN"
)

Jump to

Keyboard shortcuts

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