Documentation
¶
Overview ¶
Package kucoin is an idiomatic Go client for KuCoin's UTA (Unified Trading Account) and Classic (Spot/Margin/Futures) REST and WebSocket APIs.
UTA and Classic are exposed as explicit, separate service roots (Client.UTA / Client.Classic) rather than a merged type — they are different account models with different permissions and data shapes, and treating them as interchangeable would be misleading.
Index ¶
- Constants
- Variables
- type Client
- type ClientConfig
- type Clock
- type Credentials
- type Logger
- type Option
- func WithClassicBaseURL(url string) Option
- func WithClock(clock Clock) Option
- func WithCredentials(creds Credentials) Option
- func WithEnableNS(enabled bool) Option
- func WithHTTPClient(hc *http.Client) Option
- func WithLogger(logger Logger) Option
- func WithRetryPolicy(policy *RetryPolicy) Option
- func WithSiteType(siteType SiteType) Option
- func WithTimeout(d time.Duration) Option
- func WithUTABaseURL(url string) Option
- type RetryPolicy
- type SiteType
- type UTAServices
Constants ¶
const ( DefaultUTABaseURL = "https://api.kucoin.com" DefaultClassicBaseURL = "https://api.kucoin.com" )
Default production REST host. UTA and Classic currently share a host; kept as two options so they can diverge without a breaking change.
Docs: https://www.kucoin.com/docs-new/rest/ua/introduction Docs: https://www.kucoin.com/docs-new/rest/spot-trading/introduction
const ( SiteTypeGlobal = transport.SiteTypeGlobal SiteTypeAustralia = transport.SiteTypeAustralia )
Variables ¶
var ( NewDefaultRetryPolicy = transport.NewDefaultRetryPolicy NoRetry = transport.NoRetry )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// UTA groups every implemented UTA (Unified Trading Account) service.
UTA UTAServices
// contains filtered or unexported fields
}
Client is the SDK entry point. Construct with NewClient. Public endpoints (e.g. Client.UTA.Market) work with zero-value Credentials; private endpoints return ErrCredentialsRequired locally if none are configured.
type ClientConfig ¶
type ClientConfig struct {
Credentials Credentials
UTABaseURL string
ClassicBaseURL string
HTTPClient *http.Client
Timeout time.Duration
SiteType SiteType
EnableNS bool
Clock Clock
Logger Logger
RetryPolicy *RetryPolicy
}
ClientConfig holds every configurable knob of a Client. Zero value is usable; NewClient fills in defaults for unset fields.
type Clock ¶
Re-exported from package transport so callers only need to import package kucoin for the common case.
type Credentials ¶
type Credentials = transport.Credentials
Re-exported from package transport so callers only need to import package kucoin for the common case.
type Logger ¶
Re-exported from package transport so callers only need to import package kucoin for the common case.
type Option ¶
type Option func(*ClientConfig)
Option configures a ClientConfig at construction time.
func WithClassicBaseURL ¶
func WithCredentials ¶
func WithCredentials(creds Credentials) Option
func WithEnableNS ¶
WithEnableNS sends "kc-enable-ns: true", requesting nanosecond-precision x-in-time/x-out-time response headers.
func WithHTTPClient ¶
func WithLogger ¶
func WithRetryPolicy ¶
func WithRetryPolicy(policy *RetryPolicy) Option
WithRetryPolicy overrides the default conservative retry policy (GET requests only; see transport.RetryPolicy).
func WithSiteType ¶
func WithTimeout ¶
func WithUTABaseURL ¶
type RetryPolicy ¶
type RetryPolicy = transport.RetryPolicy
Re-exported from package transport so callers only need to import package kucoin for the common case.
type SiteType ¶
Re-exported from package transport so callers only need to import package kucoin for the common case.
type UTAServices ¶
UTAServices groups every implemented UTA (Unified Trading Account) service.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package auth implements KuCoin's HMAC-SHA256 request-signing scheme.
|
Package auth implements KuCoin's HMAC-SHA256 request-signing scheme. |
|
examples
|
|
|
uta_market
command
Command uta_market demonstrates KuCoin UTA public market data.
|
Command uta_market demonstrates KuCoin UTA public market data. |
|
internal
|
|
|
gendocs
command
Command gendocs regenerates docs/ENDPOINTS.md from internal/endpoints.yaml, the single source of truth for endpoint coverage.
|
Command gendocs regenerates docs/ENDPOINTS.md from internal/endpoints.yaml, the single source of truth for endpoint coverage. |
|
Package transport implements the shared HTTP request executor, response metadata capture, and error hierarchy used by every KuCoin service.
|
Package transport implements the shared HTTP request executor, response metadata capture, and error hierarchy used by every KuCoin service. |
|
uta
|
|
|
market
Package market implements KuCoin UTA's public market-data endpoints.
|
Package market implements KuCoin UTA's public market-data endpoints. |
