Documentation
¶
Overview ¶
Package gateio is the library behind the gateio command line: the HTTP client, request shaping, and typed data models for Gate.io public API.
The Client is the spine every command shares. It sets a real User-Agent, paces requests so a busy session stays polite, and retries transient failures (429 and 5xx). No API key is required — all operations use public endpoints.
Index ¶
- Constants
- type Candle
- type Client
- func (c *Client) Candles(ctx context.Context, pair, interval string, limit int) ([]*Candle, error)
- func (c *Client) Orderbook(ctx context.Context, pair string, depth int) ([]*Order, error)
- func (c *Client) Pairs(ctx context.Context, quote string, limit int) ([]*Pair, error)
- func (c *Client) Ticker(ctx context.Context, pair string) (*Ticker, error)
- type Config
- type Domain
- type Order
- type Pair
- type Ticker
Constants ¶
const BaseURL = "https://" + Host
BaseURL is the root every request is built from.
const DefaultUserAgent = "gateio-cli/0.1 (tamnd87@gmail.com)"
DefaultUserAgent identifies the client politely.
const Host = "api.gateio.ws"
Host is the Gate.io API host.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Candle ¶
type Candle struct {
Time string `kit:"id" json:"time"`
High string `json:"high"`
Low string `json:"low"`
Close string `json:"close"`
BaseVol string `json:"base_vol"`
QuoteVol string `json:"quote_vol"`
}
Candle holds one OHLCV candlestick record. Note: Gate.io's public spot/candlesticks endpoint does not return an open price.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the Gate.io public REST API.
type Config ¶
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Timeout time.Duration
Retries int
}
Config holds all tunable settings for a Client.
type Domain ¶
type Domain struct{}
Domain is the Gate.io driver. It carries no state; the per-run client is built by the factory Register hands kit.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.
type Order ¶
type Order struct {
Side string `kit:"id" json:"side"`
Price string `json:"price"`
Size string `json:"size"`
}
Order is a single entry in the order book (one price level on one side).
type Pair ¶
type Pair struct {
ID string `kit:"id" json:"id"`
Base string `json:"base"`
Quote string `json:"quote"`
Fee string `json:"fee"`
Status string `json:"status"`
}
Pair is a tradable currency pair on Gate.io.
type Ticker ¶
type Ticker struct {
Pair string `kit:"id" json:"pair"`
Last string `json:"last"`
Bid string `json:"bid"`
Ask string `json:"ask"`
ChangePercent string `json:"change_percent"`
BaseVol string `json:"base_vol"`
QuoteVol string `json:"quote_vol"`
High24h string `json:"high_24h"`
Low24h string `json:"low_24h"`
}
Ticker holds current price and 24h stats for a currency pair.