kucoinapi

package
v0.0.0-...-8d88297 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: AGPL-3.0 Imports: 19 Imported by: 0

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

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

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

func (*AccountService) NewListAccountsRequest

func (s *AccountService) NewListAccountsRequest() *ListAccountsRequest

func (*AccountService) NewListSubAccountsRequest

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

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

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

func (*CancelAllOrderRequest) GetSlugParameters

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

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

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

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

func (*CancelOrderRequest) GetSlugParameters

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

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

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

func (*GetAccountRequest) AccountID

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

func (*GetAccountRequest) Do

func (*GetAccountRequest) GetParameters

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

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetAccountRequest) GetParametersQuery

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

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

func (*GetAccountRequest) GetQueryParameters

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

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

func (*GetAccountRequest) GetSlugParameters

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

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

type GetAllTickersRequest

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

func (*GetAllTickersRequest) Do

func (*GetAllTickersRequest) GetParameters

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

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetAllTickersRequest) GetParametersQuery

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

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

func (*GetAllTickersRequest) GetQueryParameters

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

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

func (*GetAllTickersRequest) GetSlugParameters

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

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

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

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

func (*GetFillsRequest) GetSlugParameters

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

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

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

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

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

func (*GetKLinesRequest) GetSlugParameters

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

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

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

func (*GetOrderBookLevel2Depth100Request) Do

func (*GetOrderBookLevel2Depth100Request) GetParameters

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

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetOrderBookLevel2Depth100Request) GetParametersQuery

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

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

func (*GetOrderBookLevel2Depth100Request) GetQueryParameters

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

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

func (*GetOrderBookLevel2Depth100Request) GetSlugParameters

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

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

func (*GetOrderBookLevel2Depth100Request) Symbol

type GetOrderBookLevel2Depth20Request

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

func (*GetOrderBookLevel2Depth20Request) Do

func (*GetOrderBookLevel2Depth20Request) GetParameters

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

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetOrderBookLevel2Depth20Request) GetParametersQuery

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

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

func (*GetOrderBookLevel2Depth20Request) GetQueryParameters

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

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

func (*GetOrderBookLevel2Depth20Request) GetSlugParameters

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

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

func (*GetOrderBookLevel2Depth20Request) Symbol

type GetOrderBookLevel2DepthAllRequest

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

func (*GetOrderBookLevel2DepthAllRequest) Do

func (*GetOrderBookLevel2DepthAllRequest) GetParameters

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

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetOrderBookLevel2DepthAllRequest) GetParametersQuery

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

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

func (*GetOrderBookLevel2DepthAllRequest) GetQueryParameters

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

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

func (*GetOrderBookLevel2DepthAllRequest) GetSlugParameters

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

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

func (*GetOrderBookLevel2DepthAllRequest) Symbol

type GetPrivateBulletRequest

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

func (*GetPrivateBulletRequest) Do

func (*GetPrivateBulletRequest) GetParameters

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

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetPrivateBulletRequest) GetParametersQuery

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

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

func (*GetPrivateBulletRequest) GetQueryParameters

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

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

func (*GetPrivateBulletRequest) GetSlugParameters

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

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

type GetPublicBulletRequest

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

func (*GetPublicBulletRequest) Do

func (*GetPublicBulletRequest) GetParameters

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

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetPublicBulletRequest) GetParametersQuery

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

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

func (*GetPublicBulletRequest) GetQueryParameters

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

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

func (*GetPublicBulletRequest) GetSlugParameters

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

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

type GetTickerRequest

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

func (*GetTickerRequest) Do

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

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) 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) Symbol

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

type HistoryOrder

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

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

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

func (*ListAccountsRequest) Do

func (*ListAccountsRequest) GetParameters

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

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*ListAccountsRequest) GetParametersQuery

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

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

func (*ListAccountsRequest) GetQueryParameters

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

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

func (*ListAccountsRequest) GetSlugParameters

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

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

type ListHistoryOrdersRequest

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

func (*ListHistoryOrdersRequest) Do

func (*ListHistoryOrdersRequest) EndAt

func (*ListHistoryOrdersRequest) GetParameters

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

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*ListHistoryOrdersRequest) GetParametersQuery

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

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

func (*ListHistoryOrdersRequest) GetQueryParameters

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

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

func (*ListHistoryOrdersRequest) GetSlugParameters

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

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

func (*ListHistoryOrdersRequest) StartAt

func (*ListHistoryOrdersRequest) Symbol

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

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

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

func (*ListOrdersRequest) GetSlugParameters

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

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

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

func (*ListSubAccountsRequest) Do

func (*ListSubAccountsRequest) GetParameters

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

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*ListSubAccountsRequest) GetParametersQuery

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

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

func (*ListSubAccountsRequest) GetQueryParameters

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

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

func (*ListSubAccountsRequest) GetSlugParameters

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

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

type ListSymbolsRequest

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

func (*ListSymbolsRequest) Do

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

func (*ListSymbolsRequest) GetParameters

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

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*ListSymbolsRequest) GetParametersQuery

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

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

func (*ListSymbolsRequest) GetQueryParameters

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

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

func (*ListSymbolsRequest) GetSlugParameters

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

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

func (*ListSymbolsRequest) Market

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

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

func (*MarketDataService) NewGetTickerRequest

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

func (*MarketDataService) NewListSymbolsRequest

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

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

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

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

func (*PlaceOrderRequest) GetSlugParameters

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

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

func (*PlaceOrderRequest) OrderType

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

func (*PlaceOrderRequest) PostOnly

func (r *PlaceOrderRequest) PostOnly(postOnly bool) *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 {
	requestgen.BaseAPIClient

	Key, Secret, Passphrase string
	KeyVersion              string

	AccountService    *AccountService
	MarketDataService *MarketDataService
	TradeService      *TradeService
	BulletService     *BulletService
}

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.

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

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