api

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 18 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

func BuildResponse added in v1.4.0

func BuildResponse(code int, payload []byte) *http.Response

func BuildResponseJson added in v1.4.0

func BuildResponseJson(code int, payload interface{}) *http.Response

func BuildResponseString added in v1.4.0

func BuildResponseString(code int, payload string) *http.Response

func MockWithJsonReply added in v1.4.0

func MockWithJsonReply(url string, rawData interface{}) *http.Client

Types

type ComplexArg

type ComplexArg struct {
	A, B int
}

type CustomResponseUnmarshalerRequest added in v1.4.0

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

func (*CustomResponseUnmarshalerRequest) Do added in v1.4.0

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

func (*CustomResponseUnmarshalerRequest) GetParameters added in v1.4.0

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

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

func (*CustomResponseUnmarshalerRequest) GetParametersJSON added in v1.4.0

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*CustomResponseUnmarshalerRequest) GetParametersQuery added in v1.4.0

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

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

func (*CustomResponseUnmarshalerRequest) GetPath added in v1.4.0

GetPath returns the request path of the API

func (*CustomResponseUnmarshalerRequest) GetQueryParameters added in v1.4.0

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

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

func (*CustomResponseUnmarshalerRequest) GetSlugParameters added in v1.4.0

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

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

func (*CustomResponseUnmarshalerRequest) GetSlugsMap added in v1.4.0

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

type CustomUnmarshalerResponse added in v1.4.0

type CustomUnmarshalerResponse struct {
	Str    string
	Parsed bool
}

func (*CustomUnmarshalerResponse) Unmarshal added in v1.4.0

func (r *CustomUnmarshalerResponse) Unmarshal(data []byte) error

type MockTransport added in v1.4.0

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

func (*MockTransport) DELETE added in v1.4.0

func (transport *MockTransport) DELETE(path string, f RoundTripFunc)

func (*MockTransport) GET added in v1.4.0

func (transport *MockTransport) GET(path string, f RoundTripFunc)

func (*MockTransport) POST added in v1.4.0

func (transport *MockTransport) POST(path string, f RoundTripFunc)

func (*MockTransport) PUT added in v1.4.0

func (transport *MockTransport) PUT(path string, f RoundTripFunc)

func (*MockTransport) RoundTrip added in v1.4.0

func (transport *MockTransport) RoundTrip(req *http.Request) (*http.Response, error)

type NoParamRequest added in v1.0.1

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

func (*NoParamRequest) Do added in v1.0.1

func (n *NoParamRequest) Do(ctx context.Context) (interface{}, error)

func (*NoParamRequest) GetParameters added in v1.2.0

func (n *NoParamRequest) GetParameters() (map[string]interface{}, error)

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

func (*NoParamRequest) GetParametersJSON added in v1.2.0

func (n *NoParamRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*NoParamRequest) GetParametersQuery added in v1.2.0

func (n *NoParamRequest) GetParametersQuery() (url.Values, error)

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

func (*NoParamRequest) GetQueryParameters added in v1.2.0

func (n *NoParamRequest) GetQueryParameters() (url.Values, error)

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

func (*NoParamRequest) GetSlugParameters added in v1.2.0

func (n *NoParamRequest) GetSlugParameters() (map[string]interface{}, error)

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

func (*NoParamRequest) GetSlugsMap added in v1.2.0

func (n *NoParamRequest) GetSlugsMap() (map[string]string, error)

type Order

type Order struct {
	Id            string `json:"id"`
	Symbol        string `json:"symbol"`
	OpType        string `json:"opType"`
	Type          string `json:"type"`
	Side          string `json:"side"`
	Price         string `json:"price"`
	Size          string `json:"size"`
	Funds         string `json:"funds"`
	DealFunds     string `json:"dealFunds"`
	DealSize      string `json:"dealSize"`
	Fee           string `json:"fee"`
	FeeCurrency   string `json:"feeCurrency"`
	Stp           string `json:"stp"`
	Stop          string `json:"stop"`
	StopTriggered bool   `json:"stopTriggered"`
	StopPrice     string `json:"stopPrice"`
	TimeInForce   string `json:"timeInForce"`
	PostOnly      bool   `json:"postOnly"`
	Hidden        bool   `json:"hidden"`
	Iceberg       bool   `json:"iceberg"`
	VisibleSize   string `json:"visibleSize"`
	CancelAfter   int    `json:"cancelAfter"`
	Channel       string `json:"channel"`
	ClientOid     string `json:"clientOid"`
	Remark        string `json:"remark"`
	Tags          string `json:"tags"`
	IsActive      bool   `json:"isActive"`
	CancelExist   bool   `json:"cancelExist"`
	CreatedAt     int64  `json:"createdAt"`
	TradeType     string `json:"tradeType"`
}

type OrderType

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

type PlaceOrderRequest

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

func (*PlaceOrderRequest) ClientOrderID

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

func (*PlaceOrderRequest) ComplexArg

func (p *PlaceOrderRequest) ComplexArg(complexArg ComplexArg) *PlaceOrderRequest

func (*PlaceOrderRequest) Do

func (p *PlaceOrderRequest) Do(ctx context.Context) (interface{}, error)

func (*PlaceOrderRequest) GetParameters

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

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

func (*PlaceOrderRequest) GetParametersJSON

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

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*PlaceOrderRequest) GetParametersQuery

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

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

func (*PlaceOrderRequest) GetQueryParameters

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

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

func (*PlaceOrderRequest) GetSlugParameters added in v1.2.0

func (p *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.2.0

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

func (*PlaceOrderRequest) OrdType

func (p *PlaceOrderRequest) OrdType(ordType OrderType) *PlaceOrderRequest

func (*PlaceOrderRequest) Page

func (p *PlaceOrderRequest) Page(page int64) *PlaceOrderRequest

func (*PlaceOrderRequest) Price

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

func (*PlaceOrderRequest) Side

func (*PlaceOrderRequest) Size

func (*PlaceOrderRequest) StartTime

func (p *PlaceOrderRequest) StartTime(startTime time.Time) *PlaceOrderRequest

func (*PlaceOrderRequest) Symbol

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

func (*PlaceOrderRequest) Tag

func (*PlaceOrderRequest) TimeInForce

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

type Response

type Response struct {
	Code        string          `json:"code"`
	Message     string          `json:"msg"`
	CurrentPage int             `json:"currentPage"`
	PageSize    int             `json:"pageSize"`
	TotalNum    int             `json:"totalNum"`
	TotalPage   int             `json:"totalPage"`
	Data        json.RawMessage `json:"data"`
}

type RestClient

type RestClient struct {
	requestgen.BaseAPIClient

	Key, Secret, Passphrase string
	KeyVersion              string
}

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

type RoundTripFunc func(req *http.Request) (*http.Response, error)

type SideType

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

type TimeInForceType

type TimeInForceType string
const (
	// TimeInForceGTC 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"

	// TimeInForceGTT 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"

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

	// TimeInForceIOC 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 WalletType added in v1.2.0

type WalletType int
const (
	WalletTypeSpot    WalletType = 0
	WalletTypeMargin  WalletType = 1
	WalletTypeFunding WalletType = 2
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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