gate

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ACCEPT       = "Accept"
	CONTENT_TYPE = "Content-Type"

	APPLICATION_JSON      = "application/json"
	APPLICATION_JSON_UTF8 = "application/json; charset=UTF-8"

	ENDPOINT = "https://api.gateio.ws"
)

Variables

View Source
var GATE_PLACE_TYPE_CONVERTER = map[PlaceType]string{
	NORMAL:     "gtc",
	IOC:        "ioc",
	ONLY_MAKER: "poc",
}
View Source
var GATE_PLACE_TYPE_REVERTER = map[string]PlaceType{
	"gtc": NORMAL,
	"ioc": IOC,
	"poc": ONLY_MAKER,
}

Functions

This section is empty.

Types

type Gate

type Gate struct {
	Spot *Spot
	Swap *Swap
	// contains filtered or unexported fields
}

func New

func New(config *APIConfig) *Gate

func (*Gate) DoRequest

func (gate *Gate) DoRequest(
	httpMethod,
	uri,
	rawQuery string,
	reqBody string,
	response interface{},
) ([]byte, error)

func (*Gate) DoSignRequest

func (gate *Gate) DoSignRequest(
	httpMethod,
	uri,
	rawQuery string,
	reqBody string,
	response interface{},
) ([]byte, error)

func (*Gate) GetExchangeName

func (*Gate) GetExchangeName() string

type Spot

type Spot struct {
	*Gate
}

func (*Spot) CancelOrder

func (spot *Spot) CancelOrder(order *Order) ([]byte, error)

func (*Spot) GetAccount

func (spot *Spot) GetAccount() (*Account, []byte, error)

func (*Spot) GetDepth

func (spot *Spot) GetDepth(pair Pair, size int) (*Depth, []byte, error)

func (*Spot) GetExchangeRule

func (spot *Spot) GetExchangeRule(pair Pair) (*Rule, []byte, error)

func (*Spot) GetKlineRecords

func (spot *Spot) GetKlineRecords(pair Pair, period, size, since int) ([]*Kline, []byte, error)

func (*Spot) GetOHLCs

func (spot *Spot) GetOHLCs(symbol string, period, size, since int) ([]*OHLC, []byte, error)

func (*Spot) GetOrder

func (spot *Spot) GetOrder(order *Order) ([]byte, error)

func (*Spot) GetOrders

func (spot *Spot) GetOrders(pair Pair) ([]*Order, error)

func (*Spot) GetTicker

func (spot *Spot) GetTicker(pair Pair) (*Ticker, []byte, error)

func (*Spot) GetTrades

func (spot *Spot) GetTrades(pair Pair, since int64) ([]*Trade, error)

func (*Spot) GetUnFinishOrders

func (spot *Spot) GetUnFinishOrders(pair Pair) ([]*Order, []byte, error)

func (*Spot) KeepAlive

func (spot *Spot) KeepAlive()

func (*Spot) PlaceOrder

func (spot *Spot) PlaceOrder(order *Order) ([]byte, error)

type Swap

type Swap struct {
	*Gate
}

func (*Swap) AddMargin

func (swap *Swap) AddMargin(pair Pair, openType FutureType, marginAmount float64) ([]byte, error)

func (*Swap) CancelOrder

func (swap *Swap) CancelOrder(order *SwapOrder) ([]byte, error)

func (*Swap) GetAccount

func (swap *Swap) GetAccount() (*SwapAccount, []byte, error)

func (*Swap) GetAccountFlow

func (swap *Swap) GetAccountFlow() ([]*SwapAccountItem, []byte, error)

func (*Swap) GetContract

func (swap *Swap) GetContract(pair Pair) *SwapContract

func (*Swap) GetDepth

func (swap *Swap) GetDepth(pair Pair, size int) (*SwapDepth, []byte, error)

func (*Swap) GetFundingFee

func (swap *Swap) GetFundingFee(pair Pair) (float64, error)

func (*Swap) GetFundingFees

func (swap *Swap) GetFundingFees(pair Pair) ([][]interface{}, []byte, error)

func (*Swap) GetKline

func (swap *Swap) GetKline(pair Pair, period, size, since int) ([]*SwapKline, []byte, error)

func (*Swap) GetLimit

func (swap *Swap) GetLimit(pair Pair) (float64, float64, error)

func (*Swap) GetOpenAmount

func (swap *Swap) GetOpenAmount(pair Pair) (float64, int64, []byte, error)

func (*Swap) GetOrder

func (swap *Swap) GetOrder(order *SwapOrder) ([]byte, error)

func (*Swap) GetOrders

func (swap *Swap) GetOrders(pair Pair) ([]*SwapOrder, []byte, error)

func (*Swap) GetPosition

func (swap *Swap) GetPosition(pair Pair, openType FutureType) (*SwapPosition, []byte, error)

func (*Swap) GetTicker

func (swap *Swap) GetTicker(pair Pair) (*SwapTicker, []byte, error)

func (*Swap) GetUnFinishOrders

func (swap *Swap) GetUnFinishOrders(pair Pair) ([]*SwapOrder, []byte, error)

func (*Swap) KeepAlive

func (swap *Swap) KeepAlive()

func (*Swap) PlaceOrder

func (swap *Swap) PlaceOrder(order *SwapOrder) ([]byte, error)

func (*Swap) ReduceMargin

func (swap *Swap) ReduceMargin(pair Pair, openType FutureType, marginAmount float64) ([]byte, error)

type SwapOrderGate

type SwapOrderGate struct {
	Id           int64   `json:"id,omitempty"`
	User         int64   `json:"user,omitempty"`
	Contract     string  `json:"contract"`
	CreateTime   int64   `json:"create_time,omitempty"`
	Size         int64   `json:"size"`
	Left         int64   `json:"left,omitempty"`
	Price        float64 `json:"price,string"`
	FillPrice    float64 `json:"fill_price,string"`
	Status       string  `json:"status,omitempty"`
	Close        bool    `json:"close"`
	ReduceOnly   bool    `json:"reduce_only"`
	IsReduceOnly bool    `json:"is_reduce_only,omitempty"`
	Tif          string  `json:"tif"`
	Text         string  `json:"text"`
	FinishTime   int64   `json:"finish_time"`
	FinishAt     string  `json:"finish_at"`
}

func (*SwapOrderGate) Merge

func (sog *SwapOrderGate) Merge(order *SwapOrder)

func (*SwapOrderGate) New

func (sog *SwapOrderGate) New(loc *time.Location) *SwapOrder

Jump to

Keyboard shortcuts

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