gateEx

package module
v0.0.0-...-0c43e3e Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

gateEx

gate io api ws

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name          string `json:"name"`           //交易所名称 name
	ApiKey        string `json:"api_key"`        //交易所api key
	ApiSecretKey  string `json:"api_secret_key"` //交易所secret key
	ApiPassphrase string `json:"api_passphrase"` //交易所API密码
	ProxyUrl      string `json:"proxy_url"`      //代理服务器地址
	Settle        string `json:"settle"`         //现货为计价币种,合约为结算币种
}

type Exchange

type Exchange struct {
	Config *Config `json:"config"` //exchange config
	// contains filtered or unexported fields
}

func NewExchange

func NewExchange(conf *Config) *Exchange

func (*Exchange) ApiClient

func (e *Exchange) ApiClient() *gateapi.APIClient

func (*Exchange) ApiCtx

func (e *Exchange) ApiCtx() context.Context

func (*Exchange) CancelFuturesOrder

func (e *Exchange) CancelFuturesOrder(orderId string) (out gateapi.FuturesOrder, err error)

func (*Exchange) CancelFuturesOrders

func (e *Exchange) CancelFuturesOrders(contract string, side string) (out []gateapi.FuturesOrder, err error)

func (*Exchange) CreateFuturesOrder

func (e *Exchange) CreateFuturesOrder(futuresOrder gateapi.FuturesOrder) (out gateapi.FuturesOrder, err error)

func (*Exchange) GetAccountDetail

func (e *Exchange) GetAccountDetail() (out gateapi.AccountDetail, err error)

func (*Exchange) GetDualModePosition

func (e *Exchange) GetDualModePosition(contract string) (out []gateapi.Position, err error)

func (*Exchange) GetFuturesContract

func (e *Exchange) GetFuturesContract(contract string) (out gateapi.Contract, err error)

GetFuturesContract Get a single contract

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param settle Settle currency
  • @param contract Futures contract

@return Contract

func (*Exchange) GetPosition

func (e *Exchange) GetPosition(contract string) (out gateapi.Position, err error)

func (*Exchange) GetTotalBalance

func (e *Exchange) GetTotalBalance() (out gateapi.TotalBalance, err error)

func (*Exchange) ListCurrencyPairs

func (e *Exchange) ListCurrencyPairs() (out []gateapi.CurrencyPair, err error)

func (*Exchange) ListFuturesAccountBook

func (e *Exchange) ListFuturesAccountBook(contract, type_ string, limit, offset int32, from, to int64) (out []gateapi.FuturesAccountBook, err error)

ListFuturesAccountBook 查询合约账户变更历史

func (*Exchange) ListFuturesAccounts

func (e *Exchange) ListFuturesAccounts() (out gateapi.FuturesAccount, err error)

ListFuturesAccounts Query futures account

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param settle Settle currency

@return FuturesAccount

func (*Exchange) ListFuturesCandlesticks

func (e *Exchange) ListFuturesCandlesticks(contract string, from int64, to int64, limit int32, interval string) (out FuturesCandlesticks, err error)

ListFuturesCandlesticks Get futures candlesticks Return specified contract candlesticks. If prefix `contract` with `mark_`, the contract's mark price candlesticks are returned; if prefix with `index_`, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval`

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param settle Settle currency
  • @param contract Futures contract
  • @param optional nil or *ListFuturesCandlesticksOpts - Optional Parameters:
  • @param "From" (optional.Int64) - Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified
  • @param "To" (optional.Int64) - End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time
  • @param "Limit" (optional.Int32) - Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected.
  • @param "Interval" (optional.String) - Interval time between data points

@return []FuturesCandlestick

func (*Exchange) ListFuturesContract

func (e *Exchange) ListFuturesContract() (out []gateapi.Contract, err error)

func (*Exchange) ListFuturesOrderBook

func (e *Exchange) ListFuturesOrderBook(contract string, limit int32, interval string) (out gateapi.FuturesOrderBook, err error)

func (*Exchange) ListFuturesOrders

func (e *Exchange) ListFuturesOrders(contract string, status string, limit int32, offset int32, lastId string) (out []gateapi.FuturesOrder, err error)

func (*Exchange) ListFuturesTickers

func (e *Exchange) ListFuturesTickers(contract string) (out []gateapi.FuturesTicker, err error)

func (*Exchange) ListPositionClose

func (e *Exchange) ListPositionClose(contract string, limit, offset int32, from, to int64, side, pnl string) (out []gateapi.PositionClose, err error)

ListPositionClose 查询平仓历史 - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param settle Settle currency - @param optional nil or *ListPositionCloseOpts - Optional Parameters: - @param "Contract" (optional.String) - Futures contract, return related data only if specified - @param "Limit" (optional.Int32) - Maximum number of records to be returned in a single list - @param "Offset" (optional.Int32) - List offset, starting from 0 - @param "From" (optional.Int64) - Start timestamp - @param "To" (optional.Int64) - End timestamp - @param "Side" (optional.String) - Query side. long or shot - @param "Pnl" (optional.String) - Query profit or loss

func (*Exchange) ListPositions

func (e *Exchange) ListPositions(holding bool) (out []gateapi.Position, err error)

func (*Exchange) SetDualMode

func (e *Exchange) SetDualMode(dualMode bool) (out gateapi.FuturesAccount, err error)

func (*Exchange) Settle

func (e *Exchange) Settle() string

func (*Exchange) Transfer

func (e *Exchange) Transfer(settle, currency, from, to, amount string) (out gateapi.TransactionId, err error)

func (*Exchange) UID

func (e *Exchange) UID() string

func (*Exchange) UpdatePositionLeverage

func (e *Exchange) UpdatePositionLeverage(contract, leverage string, isCross bool) (out gateapi.Position, err error)

func (*Exchange) WsFuturesClient

func (e *Exchange) WsFuturesClient() *gatews.WsService

func (*Exchange) WsSpotClient

func (e *Exchange) WsSpotClient() *gatews.WsService

type FuturesCandlesticks

type FuturesCandlesticks []gateapi.FuturesCandlestick

func (FuturesCandlesticks) ToCandlesticks

func (f FuturesCandlesticks) ToCandlesticks() common.Candlesticks

func (FuturesCandlesticks) ToOhlcv

func (f FuturesCandlesticks) ToOhlcv() common.OHLCV

Jump to

Keyboard shortcuts

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