gateio

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: MIT Imports: 41 Imported by: 0

README

GoCryptoTrader package Gateio

Build Status Software License GoDoc Coverage Status Go Report Card

This gateio package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progress on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

GateIO Exchange

Current Features
  • REST functions
How to enable
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
How to do REST public/private calls
  • If enabled via "configuration".json file the exchange will be added to the IBotExchange array in the go var bot Bot and you will only be able to use the wrapper interface functions for accessing exchange data. View routines.go for an example of integration usage with GoCryptoTrader. Rudimentary example below:

main.go

var g exchange.IBotExchange

for i := range bot.Exchanges {
	if bot.Exchanges[i].GetName() == "GateIO" {
		g = bot.Exchanges[i]
	}
}

// Public calls - wrapper functions

// Fetches current ticker information
tick, err := g.FetchTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := g.FetchOrderbook()
if err != nil {
	// Handle error
}

// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true

// Fetches current account information
accountInfo, err := g.GetAccountInfo()
if err != nil {
	// Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

// Fetches current ticker information
ticker, err := g.GetTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := g.GetOrderBook()
if err != nil {
	// Handle error
}

// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true

// GetUserInfo returns account info
accountInfo, err := g.GetUserInfo(...)
if err != nil {
	// Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := g.Trade(...)
if err != nil {
	// Handle error
}
How to do LongPolling public/private calls
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WithdrawalFees = map[currency.Code]float64{}/* 439 elements not displayed */

WithdrawalFees the large list of predefined withdrawal fees Prone to change

Functions

This section is empty.

Types

type APIV4KeyPerm

type APIV4KeyPerm struct {
	PermissionName string   `json:"name,omitempty"`
	ReadOnly       bool     `json:"read_only,omitempty"`
	IPWhitelist    []string `json:"ip_whitelist,omitempty"`
}

APIV4KeyPerm represents an API Version 4 Key permission information

type AccountBalanceInformation

type AccountBalanceInformation struct {
	Available    types.Number `json:"available"`
	Borrowed     types.Number `json:"borrowed"`
	Interest     types.Number `json:"interest"`
	Currency     string       `json:"currency"`
	LockedAmount types.Number `json:"locked"`
}

AccountBalanceInformation represents currency account balance information.

type AccountBook

type AccountBook struct {
	ChangeTime    gateioTime   `json:"time"`
	AccountChange types.Number `json:"change"`
	Balance       types.Number `json:"balance"`
	CustomText    string       `json:"text"`
	ChangingType  string       `json:"type"`
}

AccountBook represents account changing history item

type AccountBookItem

type AccountBookItem struct {
	Time    gateioTime   `json:"time"`
	Change  types.Number `json:"change"`
	Balance types.Number `json:"balance"`
	Text    string       `json:"text"`
	Type    string       `json:"type"`
}

AccountBookItem represents account book item

type AmendFuturesOrderParam

type AmendFuturesOrderParam struct {
	Size  types.Number `json:"size"`
	Price types.Number `json:"price"`
}

AmendFuturesOrderParam represents amend futures order parameter

type CancelOrderByIDParam

type CancelOrderByIDParam struct {
	CurrencyPair currency.Pair `json:"currency_pair"`
	ID           string        `json:"id"`
}

CancelOrderByIDParam represents cancel order by id request param.

type CancelOrderByIDResponse

type CancelOrderByIDResponse struct {
	CurrencyPair string `json:"currency_pair"`
	OrderID      string `json:"id"`
	Succeeded    bool   `json:"succeeded"`
	Label        string `json:"label"`
	Message      string `json:"message"`
	Account      string `json:"account"`
}

CancelOrderByIDResponse represents calcel order response when deleted by id.

type Candlestick

type Candlestick struct {
	Timestamp      time.Time
	QuoteCcyVolume float64
	ClosePrice     float64
	HighestPrice   float64
	LowestPrice    float64
	OpenPrice      float64
	BaseCcyAmount  float64
}

Candlestick represents candlestick data point detail.

type ClosePositionRequestParam

type ClosePositionRequestParam struct {
	Text         string        `json:"text"`
	CurrencyPair currency.Pair `json:"currency_pair"`
	Amount       types.Number  `json:"amount"`
	Price        types.Number  `json:"price"`
}

ClosePositionRequestParam represents close position when cross currency is disable.

type ContractClosePosition

type ContractClosePosition struct {
	PositionCloseTime gateioTime   `json:"time"`
	Pnl               types.Number `json:"pnl"`
	SettleSize        string       `json:"settle_size"`
	Side              string       `json:"side"` // Position side, long or short
	FuturesContract   string       `json:"contract"`
	CloseOrderText    string       `json:"text"`
}

ContractClosePosition represents user's liquidation history

type ContractStat

type ContractStat struct {
	Time                   gateioTime `json:"time"`
	LongShortTaker         float64    `json:"lsr_taker"`
	LongShortAccount       float64    `json:"lsr_account"`
	LongLiqSize            float64    `json:"long_liq_size"`
	ShortLiquidationSize   float64    `json:"short_liq_size"`
	OpenInterest           float64    `json:"open_interest"`
	ShortLiquidationUsd    float64    `json:"short_liq_usd"`
	MarkPrice              float64    `json:"mark_price"`
	TopLongShortSize       float64    `json:"top_lsr_size"`
	ShortLiquidationAmount float64    `json:"short_liq_amount"`
	LongLiquidiationAmount float64    `json:"long_liq_amount"`
	OpenInterestUsd        float64    `json:"open_interest_usd"`
	TopLongShortAccount    float64    `json:"top_lsr_account"`
	LongLiquidationUSD     float64    `json:"long_liq_usd"`
}

ContractStat represents futures stats

type CountdownCancelOrderParam

type CountdownCancelOrderParam struct {
	CurrencyPair currency.Pair `json:"currency_pair"`
	Timeout      int64         `json:"timeout"` // timeout: Countdown time, in seconds At least 5 seconds, 0 means cancel the countdown
}

CountdownCancelOrderParam represents countdown cancel order params

type CountdownParams

type CountdownParams struct {
	Timeout  int64         `json:"timeout"` // In Seconds
	Contract currency.Pair `json:"contract"`
}

CountdownParams represents query parameters for countdown cancel order

type CreateAPIKeyResponse

type CreateAPIKeyResponse struct {
	UserID      string         `json:"user_id"`
	APIKeyName  string         `json:"name"` // API key name
	Permissions []APIV4KeyPerm `json:"perms"`
	IPWhitelist []string       `json:"ip_whitelist,omitempty"`
	APIKey      string         `json:"key"`
	Secret      string         `json:"secret"`
	State       int64          `json:"state"` // State 1 - normal 2 - locked 3 - frozen
	CreatedAt   gateioTime     `json:"created_at"`
	UpdatedAt   gateioTime     `json:"updated_at"`
}

CreateAPIKeyResponse represents an API key response object

type CreateAPIKeySubAccountParams

type CreateAPIKeySubAccountParams struct {
	SubAccountUserID int64          `json:"user_id"`
	Body             *SubAccountKey `json:"body"`
}

CreateAPIKeySubAccountParams represents subaccount new API key creation parameters.

type CreateOrderRequestData

type CreateOrderRequestData struct {
	Text         string        `json:"text,omitempty"`
	CurrencyPair currency.Pair `json:"currency_pair,omitempty"`
	Type         string        `json:"type,omitempty"`
	Account      string        `json:"account,omitempty"`
	Side         string        `json:"side,omitempty"`
	Iceberg      string        `json:"iceberg,omitempty"`
	Amount       types.Number  `json:"amount,omitempty"`
	Price        types.Number  `json:"price,omitempty"`
	TimeInForce  string        `json:"time_in_force,omitempty"`
	AutoBorrow   bool          `json:"auto_borrow,omitempty"`
}

CreateOrderRequestData represents a single order creation param.

type CrossMarginAccount

type CrossMarginAccount struct {
	UserID                      int64                                 `json:"user_id"`
	Locked                      bool                                  `json:"locked"`
	Balances                    map[string]CrossMarginCurrencyBalance `json:"balances"`
	Total                       types.Number                          `json:"total"`
	Borrowed                    types.Number                          `json:"borrowed"`
	Interest                    types.Number                          `json:"interest"`
	Risk                        types.Number                          `json:"risk"`
	TotalInitialMargin          string                                `json:"total_initial_margin"`
	TotalMarginBalance          types.Number                          `json:"total_margin_balance"`
	TotalMaintenanceMargin      types.Number                          `json:"total_maintenance_margin"`
	TotalInitialMarginRate      types.Number                          `json:"total_initial_margin_rate"`
	TotalMaintenanceMarginRate  types.Number                          `json:"total_maintenance_margin_rate"`
	TotalAvailableMargin        types.Number                          `json:"total_available_margin"`
	TotalPortfolioMarginAccount types.Number                          `json:"portfolio_margin_total"`
}

CrossMarginAccount represents the account detail for cross margin account balance

type CrossMarginAccountHistoryItem

type CrossMarginAccountHistoryItem struct {
	ID       string       `json:"id"`
	Time     gateioTime   `json:"time"`
	Currency string       `json:"currency"` // Currency changed
	Change   string       `json:"change"`
	Balance  types.Number `json:"balance"`
	Type     string       `json:"type"`
}

CrossMarginAccountHistoryItem represents a cross margin account change history item

type CrossMarginBalance

type CrossMarginBalance struct {
	Available           types.Number `json:"available"`
	Freeze              types.Number `json:"freeze"`
	Borrowed            types.Number `json:"borrowed"`
	Interest            types.Number `json:"interest"`
	Total               string       `json:"total"`
	BorrowedNet         string       `json:"borrowed_net"`
	TotalNetAssetInUSDT string       `json:"net"`
	PositionLeverage    string       `json:"leverage"`
	Risk                string       `json:"risk"` // Risk rate. When it belows 110%, liquidation will be triggered. Calculation formula: total / (borrowed+interest)
}

CrossMarginBalance represents cross-margin currency balance detail

type CrossMarginBorrowLoanParams

type CrossMarginBorrowLoanParams struct {
	Currency currency.Code `json:"currency"`
	Amount   types.Number  `json:"amount"`
	Text     string        `json:"text"`
}

CrossMarginBorrowLoanParams represents a cross margin borrow loan parameters

type CrossMarginCurrencies

type CrossMarginCurrencies struct {
	Name                 string       `json:"name"`
	Rate                 types.Number `json:"rate"`
	CurrencyPrecision    types.Number `json:"prec"`
	Discount             string       `json:"discount"`
	MinBorrowAmount      types.Number `json:"min_borrow_amount"`
	UserMaxBorrowAmount  types.Number `json:"user_max_borrow_amount"`
	TotalMaxBorrowAmount types.Number `json:"total_max_borrow_amount"`
	Price                types.Number `json:"price"` // Price change between this currency and USDT
	Status               int64        `json:"status"`
}

CrossMarginCurrencies represents a currency supported by cross margin

type CrossMarginCurrencyBalance

type CrossMarginCurrencyBalance struct {
	Available types.Number `json:"available"`
	Freeze    types.Number `json:"freeze"`
	Borrowed  types.Number `json:"borrowed"`
	Interest  types.Number `json:"interest"`
}

CrossMarginCurrencyBalance represents the currency detailed balance information for cross margin

type CrossMarginLoanResponse

type CrossMarginLoanResponse struct {
	ID             string       `json:"id"`
	CreateTime     gateioTime   `json:"create_time"`
	UpdateTime     gateioTime   `json:"update_time"`
	Currency       string       `json:"currency"`
	Amount         types.Number `json:"amount"`
	Text           string       `json:"text"`
	Status         int64        `json:"status"`
	Repaid         string       `json:"repaid"`
	RepaidInterest types.Number `json:"repaid_interest"`
	UnpaidInterest types.Number `json:"unpaid_interest"`
}

CrossMarginLoanResponse represents a cross margin borrow loan response

type CurrencyAndAmount

type CurrencyAndAmount struct {
	Currency currency.Code `json:"currency"`
	Amount   types.Number  `json:"amount"`
}

CurrencyAndAmount represents request parameters for repayment

type CurrencyBalanceAmount

type CurrencyBalanceAmount struct {
	Currency string `json:"currency"`
	Amount   string `json:"amount"`
}

CurrencyBalanceAmount represents currency and its amount.

type CurrencyChain

type CurrencyChain struct {
	Chain              string `json:"chain"`
	ChineseChainName   string `json:"name_cn"`
	ChainName          string `json:"name_en"`
	IsDisabled         int64  `json:"is_disabled"`          // If it is disabled. 0 means NOT being disabled
	IsDepositDisabled  int64  `json:"is_deposit_disabled"`  // Is deposit disabled. 0 means not
	IsWithdrawDisabled int64  `json:"is_withdraw_disabled"` // Is withdrawal disabled. 0 means not
}

CurrencyChain currency chain detail.

type CurrencyDepositAddressInfo

type CurrencyDepositAddressInfo struct {
	Currency            string                  `json:"currency"`
	Address             string                  `json:"address"`
	MultichainAddresses []MultiChainAddressItem `json:"multichain_addresses"`
}

CurrencyDepositAddressInfo represents a crypto deposit address

type CurrencyInfo

type CurrencyInfo struct {
	Currency         string       `json:"currency"`
	Delisted         bool         `json:"delisted"`
	WithdrawDisabled bool         `json:"withdraw_disabled"`
	WithdrawDelayed  bool         `json:"withdraw_delayed"`
	DepositDisabled  bool         `json:"deposit_disabled"`
	TradeDisabled    bool         `json:"trade_disabled"`
	FixedFeeRate     types.Number `json:"fixed_rate,omitempty"`
	Chain            string       `json:"chain"`
}

CurrencyInfo represents currency details with permission.

type CurrencyPairDetail

type CurrencyPairDetail struct {
	ID              string       `json:"id"`
	Base            string       `json:"base"`
	Quote           string       `json:"quote"`
	TradingFee      types.Number `json:"fee"`
	MinBaseAmount   types.Number `json:"min_base_amount"`
	MinQuoteAmount  types.Number `json:"min_quote_amount"`
	AmountPrecision float64      `json:"amount_precision"` // Amount scale
	Precision       float64      `json:"precision"`        // Price scale
	TradeStatus     string       `json:"trade_status"`
	SellStart       float64      `json:"sell_start"`
	BuyStart        float64      `json:"buy_start"`
}

CurrencyPairDetail represents a single currency pair detail.

type DeliveryContract

type DeliveryContract struct {
	Name                string       `json:"name"`
	Underlying          string       `json:"underlying"`
	Cycle               string       `json:"cycle"`
	Type                string       `json:"type"`
	QuantoMultiplier    types.Number `json:"quanto_multiplier"`
	MarkType            string       `json:"mark_type"`
	LastPrice           types.Number `json:"last_price"`
	MarkPrice           types.Number `json:"mark_price"`
	IndexPrice          types.Number `json:"index_price"`
	BasisRate           types.Number `json:"basis_rate"`
	BasisValue          types.Number `json:"basis_value"`
	BasisImpactValue    types.Number `json:"basis_impact_value"`
	SettlePrice         types.Number `json:"settle_price"`
	SettlePriceInterval int64        `json:"settle_price_interval"`
	SettlePriceDuration int64        `json:"settle_price_duration"`
	SettleFeeRate       types.Number `json:"settle_fee_rate"`
	OrderPriceRound     types.Number `json:"order_price_round"`
	MarkPriceRound      types.Number `json:"mark_price_round"`
	LeverageMin         types.Number `json:"leverage_min"`
	LeverageMax         types.Number `json:"leverage_max"`
	MaintenanceRate     types.Number `json:"maintenance_rate"`
	RiskLimitBase       types.Number `json:"risk_limit_base"`
	RiskLimitStep       types.Number `json:"risk_limit_step"`
	RiskLimitMax        types.Number `json:"risk_limit_max"`
	MakerFeeRate        types.Number `json:"maker_fee_rate"`
	TakerFeeRate        types.Number `json:"taker_fee_rate"`
	RefDiscountRate     types.Number `json:"ref_discount_rate"`
	RefRebateRate       types.Number `json:"ref_rebate_rate"`
	OrderPriceDeviate   types.Number `json:"order_price_deviate"`
	OrderSizeMin        int64        `json:"order_size_min"`
	OrderSizeMax        int64        `json:"order_size_max"`
	OrdersLimit         int64        `json:"orders_limit"`
	OrderbookID         int64        `json:"orderbook_id"`
	TradeID             int64        `json:"trade_id"`
	TradeSize           int64        `json:"trade_size"`
	PositionSize        int64        `json:"position_size"`
	ExpireTime          gateioTime   `json:"expire_time"`
	ConfigChangeTime    gateioTime   `json:"config_change_time"`
	InDelisting         bool         `json:"in_delisting"`
}

DeliveryContract represents a delivery contract instance detail.

type DeliveryTradingHistory

type DeliveryTradingHistory struct {
	ID         int64        `json:"id"`
	CreateTime gateioTime   `json:"create_time"`
	Contract   string       `json:"contract"`
	Size       float64      `json:"size"`
	Price      types.Number `json:"price"`
}

DeliveryTradingHistory represents futures trading history

type DepositRecord

type DepositRecord struct {
	ID            string       `json:"id"`
	Timestamp     gateioTime   `json:"timestamp"`
	Currency      string       `json:"currency"`
	Address       string       `json:"address"`
	TransactionID string       `json:"txid"`
	Amount        types.Number `json:"amount"`
	Memo          string       `json:"memo"`
	Status        string       `json:"status"`
	Chain         string       `json:"chain"`
	Fee           types.Number `json:"fee"`
}

DepositRecord represents deposit record item

type DualModeResponse

type DualModeResponse struct {
	User           int64        `json:"user"`
	Currency       string       `json:"currency"`
	Total          string       `json:"total"`
	UnrealisedPnl  types.Number `json:"unrealised_pnl"`
	PositionMargin types.Number `json:"position_margin"`
	OrderMargin    string       `json:"order_margin"`
	Available      string       `json:"available"`
	Point          string       `json:"point"`
	Bonus          string       `json:"bonus"`
	InDualMode     bool         `json:"in_dual_mode"`
	History        struct {
		DepositAndWithdrawal types.Number `json:"dnw"` // total amount of deposit and withdraw
		ProfitAndLoss        types.Number `json:"pnl"` // total amount of trading profit and loss
		Fee                  types.Number `json:"fee"`
		Refr                 types.Number `json:"refr"`
		Fund                 types.Number `json:"fund"`
		PointDnw             types.Number `json:"point_dnw"`
		PointFee             types.Number `json:"point_fee"`
		PointRefr            types.Number `json:"point_refr"`
		BonusDnw             types.Number `json:"bonus_dnw"`
		BonusOffset          types.Number `json:"bonus_offset"`
	} `json:"history"`
}

DualModeResponse represents dual mode enable or disable

type FlashSwapOrderParams

type FlashSwapOrderParams struct {
	PreviewID    string        `json:"preview_id"`
	SellCurrency currency.Code `json:"sell_currency"`
	SellAmount   types.Number  `json:"sell_amount,omitempty"`
	BuyCurrency  currency.Code `json:"buy_currency"`
	BuyAmount    types.Number  `json:"buy_amount,omitempty"`
}

FlashSwapOrderParams represents create flash swap order request parameters.

type FlashSwapOrderResponse

type FlashSwapOrderResponse struct {
	ID           int64        `json:"id"`
	CreateTime   gateioTime   `json:"create_time"`
	UpdateTime   gateioTime   `json:"update_time"`
	UserID       int64        `json:"user_id"`
	SellCurrency string       `json:"sell_currency"`
	SellAmount   types.Number `json:"sell_amount"`
	BuyCurrency  string       `json:"buy_currency"`
	BuyAmount    types.Number `json:"buy_amount"`
	Price        types.Number `json:"price"`
	Status       int64        `json:"status"`
}

FlashSwapOrderResponse represents create flash swap order response

type FuturesAccount

type FuturesAccount struct {
	User           int64        `json:"user"`
	Currency       string       `json:"currency"`
	Total          types.Number `json:"total"` // total = position_margin + order_margin + available
	UnrealisedPnl  string       `json:"unrealised_pnl"`
	PositionMargin string       `json:"position_margin"`
	OrderMargin    string       `json:"order_margin"` // Order margin of unfinished orders
	Available      types.Number `json:"available"`    // The available balance for transferring or trading
	Point          string       `json:"point"`
	Bonus          string       `json:"bonus"`
	InDualMode     bool         `json:"in_dual_mode"` // Whether dual mode is enabled
	History        struct {
		DepositAndWithdrawal string       `json:"dnw"`  // total amount of deposit and withdraw
		ProfitAndLoss        types.Number `json:"pnl"`  // total amount of trading profit and loss
		Fee                  string       `json:"fee"`  // total amount of fee
		Refr                 string       `json:"refr"` // total amount of referrer rebates
		Fund                 string       `json:"fund"`
		PointDnw             string       `json:"point_dnw"` // total amount of point deposit and withdraw
		PointFee             string       `json:"point_fee"` // total amount of point fee
		PointRefr            string       `json:"point_refr"`
		BonusDnw             string       `json:"bonus_dnw"`    // total amount of perpetual contract bonus transfer
		BonusOffset          string       `json:"bonus_offset"` // total amount of perpetual contract bonus deduction
	} `json:"history"`
}

FuturesAccount represents futures account detail

type FuturesCandlestick

type FuturesCandlestick struct {
	Timestamp    gateioTime   `json:"t"`
	Volume       float64      `json:"v"`
	ClosePrice   types.Number `json:"c"`
	HighestPrice types.Number `json:"h"`
	LowestPrice  types.Number `json:"l"`
	OpenPrice    types.Number `json:"o"`

	// Added for websocket push data
	Name string `json:"n,omitempty"`
}

FuturesCandlestick represents futures candlestick data

type FuturesContract

type FuturesContract struct {
	Name                  string       `json:"name"`
	Type                  string       `json:"type"`
	QuantoMultiplier      types.Number `json:"quanto_multiplier"`
	RefDiscountRate       types.Number `json:"ref_discount_rate"`
	OrderPriceDeviate     string       `json:"order_price_deviate"`
	MaintenanceRate       types.Number `json:"maintenance_rate"`
	MarkType              string       `json:"mark_type"`
	LastPrice             types.Number `json:"last_price"`
	MarkPrice             types.Number `json:"mark_price"`
	IndexPrice            types.Number `json:"index_price"`
	FundingRateIndicative types.Number `json:"funding_rate_indicative"`
	MarkPriceRound        types.Number `json:"mark_price_round"`
	FundingOffset         int64        `json:"funding_offset"`
	InDelisting           bool         `json:"in_delisting"`
	RiskLimitBase         string       `json:"risk_limit_base"`
	InterestRate          string       `json:"interest_rate"`
	OrderPriceRound       string       `json:"order_price_round"`
	OrderSizeMin          int64        `json:"order_size_min"`
	RefRebateRate         string       `json:"ref_rebate_rate"`
	FundingInterval       int64        `json:"funding_interval"`
	RiskLimitStep         string       `json:"risk_limit_step"`
	LeverageMin           types.Number `json:"leverage_min"`
	LeverageMax           types.Number `json:"leverage_max"`
	RiskLimitMax          string       `json:"risk_limit_max"`
	MakerFeeRate          types.Number `json:"maker_fee_rate"`
	TakerFeeRate          types.Number `json:"taker_fee_rate"`
	FundingRate           types.Number `json:"funding_rate"`
	OrderSizeMax          int64        `json:"order_size_max"`
	FundingNextApply      gateioTime   `json:"funding_next_apply"`
	ConfigChangeTime      gateioTime   `json:"config_change_time"`
	ShortUsers            int64        `json:"short_users"`
	TradeSize             int64        `json:"trade_size"`
	PositionSize          int64        `json:"position_size"`
	LongUsers             int64        `json:"long_users"`
	FundingImpactValue    string       `json:"funding_impact_value"`
	OrdersLimit           int64        `json:"orders_limit"`
	TradeID               int64        `json:"trade_id"`
	OrderbookID           int64        `json:"orderbook_id"`
}

FuturesContract represents futures contract detailed data.

type FuturesFundingRate

type FuturesFundingRate struct {
	Timestamp gateioTime   `json:"t"`
	Rate      types.Number `json:"r"`
}

FuturesFundingRate represents futures funding rate response.

type FuturesInitial

type FuturesInitial struct {
	Contract    currency.Pair `json:"contract"`
	Size        int64         `json:"size"`  // Order size. Positive size means to buy, while negative one means to sell. Set to 0 to close the position
	Price       types.Number  `json:"price"` // Order price. Set to 0 to use market price
	Close       bool          `json:"close,omitempty"`
	TimeInForce string        `json:"tif,omitempty"`
	Text        string        `json:"text,omitempty"`
	ReduceOnly  bool          `json:"reduce_only,omitempty"`
	AutoSize    string        `json:"auto_size,omitempty"`
}

FuturesInitial represents a price triggered order initial parameters

type FuturesPremiumIndexKLineResponse

type FuturesPremiumIndexKLineResponse struct {
	UnixTimestamp gateioTime   `json:"t"`
	ClosePrice    types.Number `json:"c"`
	HighestPrice  types.Number `json:"h"`
	LowestPrice   types.Number `json:"l"`
	OpenPrice     types.Number `json:"o"`
}

FuturesPremiumIndexKLineResponse represents premium index K-Line information.

type FuturesPriceTriggeredOrderParam

type FuturesPriceTriggeredOrderParam struct {
	Initial   FuturesInitial `json:"initial"`
	Trigger   FuturesTrigger `json:"trigger"`
	OrderType string         `json:"order_type,omitempty"`
}

FuturesPriceTriggeredOrderParam represents a creates a price triggered order

type FuturesSubAccountBalance

type FuturesSubAccountBalance struct {
	UserID    int64 `json:"uid,string"`
	Available struct {
		Total                     types.Number `json:"total"`
		UnrealisedProfitAndLoss   string       `json:"unrealised_pnl"`
		PositionMargin            string       `json:"position_margin"`
		OrderMargin               string       `json:"order_margin"`
		TotalAvailable            types.Number `json:"available"`
		PointAmount               float64      `json:"point"`
		SettleCurrency            string       `json:"currency"`
		InDualMode                bool         `json:"in_dual_mode"`
		EnableCredit              bool         `json:"enable_credit"`
		PositionInitialMargin     string       `json:"position_initial_margin"` // applicable to the portfolio margin account model
		MaintenanceMarginPosition string       `json:"maintenance_margin"`
		PerpetualContractBonus    string       `json:"bonus"`
		StatisticalData           struct {
			TotalDNW         types.Number `json:"dnw"` // total amount of deposit and withdraw
			ProfitAndLoss    types.Number `json:"pnl"` // total amount of trading profit and loss
			TotalAmountOfFee types.Number `json:"fee"`
			ReferrerRebates  types.Number `json:"refr"` // total amount of referrer rebates
			Fund             types.Number `json:"fund"` // total amount of funding costs
			PointDNW         types.Number `json:"point_dnw"`
			PoointFee        types.Number `json:"point_fee"`
			PointRefr        types.Number `json:"point_refr"`
			BonusDNW         types.Number `json:"bonus_dnw"`
			BonusOffset      types.Number `json:"bonus_offset"`
		} `json:"history"`
	} `json:"available"`
}

FuturesSubAccountBalance represents sub account balance for specific sub account and several currencies

type FuturesTicker

type FuturesTicker struct {
	Contract              string       `json:"contract"`
	ChangePercentage      string       `json:"change_percentage"`
	Last                  types.Number `json:"last"`
	Low24H                types.Number `json:"low_24h"`
	High24H               types.Number `json:"high_24h"`
	TotalSize             types.Number `json:"total_size"`
	Volume24H             types.Number `json:"volume_24h"`
	Volume24HBtc          types.Number `json:"volume_24h_btc"`
	Volume24HUsd          types.Number `json:"volume_24h_usd"`
	Volume24HBase         types.Number `json:"volume_24h_base"`
	Volume24HQuote        types.Number `json:"volume_24h_quote"`
	Volume24HSettle       types.Number `json:"volume_24h_settle"`
	MarkPrice             types.Number `json:"mark_price"`
	FundingRate           types.Number `json:"funding_rate"`
	FundingRateIndicative string       `json:"funding_rate_indicative"`
	IndexPrice            types.Number `json:"index_price"`
}

FuturesTicker represents futures ticker data.

type FuturesTrigger

type FuturesTrigger struct {
	StrategyType int64        `json:"strategy_type,omitempty"` // How the order will be triggered 0: by price, which means the order will be triggered if price condition is satisfied 1: by price gap, which means the order will be triggered if gap of recent two prices of specified price_type are satisfied. Only 0 is supported currently
	PriceType    int64        `json:"price_type,omitempty"`
	Price        types.Number `json:"price,omitempty"`
	Rule         int64        `json:"rule,omitempty"`
	Expiration   int64        `json:"expiration,omitempty"` // how long(in seconds) to wait for the condition to be triggered before cancelling the order
	OrderType    string       `json:"order_type,omitempty"`
}

FuturesTrigger represents a price triggered order trigger parameter

type Gateio

type Gateio struct {
	exchange.Base
}

Gateio is the overarching type across this package

func (*Gateio) AmendFuturesOrder

func (g *Gateio) AmendFuturesOrder(ctx context.Context, settle, orderID string, arg AmendFuturesOrderParam) (*Order, error)

AmendFuturesOrder amends an existing futures order

func (*Gateio) AmendSpotOrder

func (g *Gateio) AmendSpotOrder(ctx context.Context, orderID string, currencyPair currency.Pair, isCrossMarginAccount bool, arg *PriceAndAmount) (*SpotOrder, error)

AmendSpotOrder amend an order By default, the orders of spot and margin account are updated. If you need to modify orders of the cross-margin account, you must specify account as cross_margin. For portfolio margin account, only cross_margin account is supported.

func (*Gateio) CancelAllDeliveryPriceTriggeredOrder

func (g *Gateio) CancelAllDeliveryPriceTriggeredOrder(ctx context.Context, settle string, contract currency.Pair) ([]PriceTriggeredOrder, error)

CancelAllDeliveryPriceTriggeredOrder cancels all delivery price triggered orders

func (*Gateio) CancelAllFuturesOpenOrders

func (g *Gateio) CancelAllFuturesOpenOrders(ctx context.Context, settle string, contract currency.Pair) ([]PriceTriggeredOrder, error)

CancelAllFuturesOpenOrders cancels all futures open orders

func (*Gateio) CancelAllOpenOrdersSpecifiedCurrencyPair

func (g *Gateio) CancelAllOpenOrdersSpecifiedCurrencyPair(ctx context.Context, currencyPair currency.Pair, side order.Side, account asset.Item) ([]SpotOrder, error)

CancelAllOpenOrdersSpecifiedCurrencyPair cancel all open orders in specified currency pair

func (*Gateio) CancelAllOrders

func (g *Gateio) CancelAllOrders(ctx context.Context, o *order.Cancel) (order.CancelAllResponse, error)

CancelAllOrders cancels all orders associated with a currency pair

func (*Gateio) CancelBatchOrders

func (g *Gateio) CancelBatchOrders(ctx context.Context, o []order.Cancel) (*order.CancelBatchResponse, error)

CancelBatchOrders cancels an orders by their corresponding ID numbers

func (*Gateio) CancelBatchOrdersWithIDList

func (g *Gateio) CancelBatchOrdersWithIDList(ctx context.Context, args []CancelOrderByIDParam) ([]CancelOrderByIDResponse, error)

CancelBatchOrdersWithIDList cancels batch orders specifying the order ID and currency pair information Multiple currency pairs can be specified, but maximum 20 orders are allowed per request

func (*Gateio) CancelDeliveryPriceTriggeredOrder

func (g *Gateio) CancelDeliveryPriceTriggeredOrder(ctx context.Context, settle, orderID string) (*PriceTriggeredOrder, error)

CancelDeliveryPriceTriggeredOrder cancel a price-triggered order

func (*Gateio) CancelFuturesPriceTriggeredOrder

func (g *Gateio) CancelFuturesPriceTriggeredOrder(ctx context.Context, settle, orderID string) (*PriceTriggeredOrder, error)

CancelFuturesPriceTriggeredOrder cancel a price-triggered order

func (*Gateio) CancelLendingLoan

func (g *Gateio) CancelLendingLoan(ctx context.Context, ccy currency.Code, loanID string) (*MarginLoanResponse, error)

CancelLendingLoan cancels lending loans. only lent loans can be canceled.

func (*Gateio) CancelMultipleDeliveryOrders

func (g *Gateio) CancelMultipleDeliveryOrders(ctx context.Context, contract currency.Pair, side, settle string) ([]Order, error)

CancelMultipleDeliveryOrders cancel all open orders matched Zero-filled order cannot be retrieved 10 minutes after order cancellation

func (*Gateio) CancelMultipleFuturesOpenOrders

func (g *Gateio) CancelMultipleFuturesOpenOrders(ctx context.Context, contract currency.Pair, side, settle string) ([]Order, error)

CancelMultipleFuturesOpenOrders ancel all open orders Zero-filled order cannot be retrieved 10 minutes after order cancellation

func (*Gateio) CancelMultipleOptionOpenOrders

func (g *Gateio) CancelMultipleOptionOpenOrders(ctx context.Context, contract currency.Pair, underlying, side string) ([]OptionOrderResponse, error)

CancelMultipleOptionOpenOrders cancels all open orders matched

func (*Gateio) CancelMultipleSpotOpenOrders

func (g *Gateio) CancelMultipleSpotOpenOrders(ctx context.Context, currencyPair currency.Pair, account asset.Item) ([]SpotPriceTriggeredOrder, error)

CancelMultipleSpotOpenOrders deletes price triggered orders.

func (*Gateio) CancelOptionSingleOrder

func (g *Gateio) CancelOptionSingleOrder(ctx context.Context, orderID string) (*OptionOrderResponse, error)

CancelOptionSingleOrder cancel a single order.

func (*Gateio) CancelOrder

func (g *Gateio) CancelOrder(ctx context.Context, o *order.Cancel) error

CancelOrder cancels an order by its corresponding ID number

func (*Gateio) CancelPriceTriggeredOrder

func (g *Gateio) CancelPriceTriggeredOrder(ctx context.Context, orderID string) (*SpotPriceTriggeredOrder, error)

CancelPriceTriggeredOrder cancel a price-triggered order

func (*Gateio) CancelSingleDeliveryOrder

func (g *Gateio) CancelSingleDeliveryOrder(ctx context.Context, settle, orderID string) (*Order, error)

CancelSingleDeliveryOrder cancel a single order

func (*Gateio) CancelSingleFuturesOrder

func (g *Gateio) CancelSingleFuturesOrder(ctx context.Context, settle, orderID string) (*Order, error)

CancelSingleFuturesOrder cancel a single order

func (*Gateio) CancelSingleSpotOrder

func (g *Gateio) CancelSingleSpotOrder(ctx context.Context, orderID, currencyPair string, isCrossMarginAccount bool) (*SpotOrder, error)

CancelSingleSpotOrder cancels a single order Spot and margin orders are cancelled by default. If trying to cancel cross margin orders or portfolio margin account are used, account must be set to cross_margin

func (*Gateio) CancelWithdrawalWithSpecifiedID

func (g *Gateio) CancelWithdrawalWithSpecifiedID(ctx context.Context, withdrawalID string) (*WithdrawalResponse, error)

CancelWithdrawalWithSpecifiedID cancels withdrawal with specified ID.

func (*Gateio) CountdownCancelOrders

func (g *Gateio) CountdownCancelOrders(ctx context.Context, settle string, arg CountdownParams) (*TriggerTimeResponse, error)

CountdownCancelOrders represents a trigger time response

func (*Gateio) CountdownCancelorders

func (g *Gateio) CountdownCancelorders(ctx context.Context, arg CountdownCancelOrderParam) (*TriggerTimeResponse, error)

CountdownCancelorders Countdown cancel orders When the timeout set by the user is reached, if there is no cancel or set a new countdown, the related pending orders will be automatically cancelled. This endpoint can be called repeatedly to set a new countdown or cancel the countdown.

func (*Gateio) CreateAPIKeysOfSubAccount

func (g *Gateio) CreateAPIKeysOfSubAccount(ctx context.Context, arg CreateAPIKeySubAccountParams) (*CreateAPIKeyResponse, error)

CreateAPIKeysOfSubAccount creates a sub-account for the sub-account

name: Permission name (all permissions will be removed if no value is passed) >> wallet: wallet, spot: spot/margin, futures: perpetual contract, delivery: delivery, earn: earn, options: options

func (*Gateio) CreateBatchOrders

func (g *Gateio) CreateBatchOrders(ctx context.Context, args []CreateOrderRequestData) ([]SpotOrder, error)

CreateBatchOrders Create a batch of orders Batch orders requirements: custom order field text is required At most 4 currency pairs, maximum 10 orders each, are allowed in one request No mixture of spot orders and margin orders, i.e. account must be identical for all orders

func (*Gateio) CreateCrossMarginBorrowLoan

func (g *Gateio) CreateCrossMarginBorrowLoan(ctx context.Context, arg CrossMarginBorrowLoanParams) (*CrossMarginLoanResponse, error)

CreateCrossMarginBorrowLoan create a cross margin borrow loan Borrow amount cannot be less than currency minimum borrow amount

func (*Gateio) CreateFlashSwapOrder

func (g *Gateio) CreateFlashSwapOrder(ctx context.Context, arg FlashSwapOrderParams) (*FlashSwapOrderResponse, error)

CreateFlashSwapOrder creates a new flash swap order initiate a flash swap preview in advance because order creation requires a preview result

func (*Gateio) CreateNewSubAccount

func (g *Gateio) CreateNewSubAccount(ctx context.Context, arg SubAccountParams) (*SubAccount, error)

CreateNewSubAccount creates a new sub-account

func (*Gateio) CreatePriceTriggeredFuturesOrder

func (g *Gateio) CreatePriceTriggeredFuturesOrder(ctx context.Context, settle string, arg *FuturesPriceTriggeredOrderParam) (*OrderID, error)

CreatePriceTriggeredFuturesOrder create a price-triggered order

func (*Gateio) CreatePriceTriggeredOrder

func (g *Gateio) CreatePriceTriggeredOrder(ctx context.Context, arg *PriceTriggeredOrderParam) (*OrderID, error)

CreatePriceTriggeredOrder create a price-triggered order

func (*Gateio) CurrencySupportedByCrossMargin

func (g *Gateio) CurrencySupportedByCrossMargin(ctx context.Context) ([]CrossMarginCurrencies, error)

CurrencySupportedByCrossMargin currencies supported by cross margin.

func (*Gateio) DeliveryFuturesSubscribe

func (g *Gateio) DeliveryFuturesSubscribe(channelsToUnsubscribe []subscription.Subscription) error

DeliveryFuturesSubscribe sends a websocket message to stop receiving data from the channel

func (*Gateio) DeliveryFuturesUnsubscribe

func (g *Gateio) DeliveryFuturesUnsubscribe(channelsToUnsubscribe []subscription.Subscription) error

DeliveryFuturesUnsubscribe sends a websocket message to stop receiving data from the channel

func (*Gateio) EnableOrDisableDualMode

func (g *Gateio) EnableOrDisableDualMode(ctx context.Context, settle string, dualMode bool) (*DualModeResponse, error)

EnableOrDisableDualMode enable or disable dual mode Before setting dual mode, make sure all positions are closed and no orders are open

func (*Gateio) ExecuteRepayment

func (g *Gateio) ExecuteRepayment(ctx context.Context, arg CurrencyAndAmount) ([]CrossMarginLoanResponse, error)

ExecuteRepayment when the liquidity of the currency is insufficient and the transaction risk is high, the currency will be disabled, and funds cannot be transferred.When the available balance of cross-margin is insufficient, the balance of the spot account can be used for repayment. Please ensure that the balance of the spot account is sufficient, and system uses cross-margin account for repayment first

func (*Gateio) FetchAccountInfo

func (g *Gateio) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

FetchAccountInfo retrieves balances for all enabled currencies

func (*Gateio) FetchOrderbook

func (g *Gateio) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

FetchOrderbook returns orderbook base on the currency pair

func (*Gateio) FetchTicker

func (g *Gateio) FetchTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)

FetchTicker retrieves a list of tickers.

func (*Gateio) FetchTradablePairs

func (g *Gateio) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error)

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*Gateio) FuturesSubscribe

func (g *Gateio) FuturesSubscribe(channelsToUnsubscribe []subscription.Subscription) error

FuturesSubscribe sends a websocket message to stop receiving data from the channel

func (*Gateio) FuturesUnsubscribe

func (g *Gateio) FuturesUnsubscribe(channelsToUnsubscribe []subscription.Subscription) error

FuturesUnsubscribe sends a websocket message to stop receiving data from the channel

func (*Gateio) GateIOGetPersonalTradingHistory

func (g *Gateio) GateIOGetPersonalTradingHistory(ctx context.Context, currencyPair currency.Pair,
	orderID string, page, limit uint64, crossMarginAccount bool, from, to time.Time) ([]SpotPersonalTradeHistory, error)

GateIOGetPersonalTradingHistory retrieves personal trading history

func (*Gateio) GateioSpotOpenOrders

func (g *Gateio) GateioSpotOpenOrders(ctx context.Context, page, limit uint64, isCrossMargin bool) ([]SpotOrdersDetail, error)

GateioSpotOpenOrders retrieves all open orders List open orders in all currency pairs. Note that pagination parameters affect record number in each currency pair's open order list. No pagination is applied to the number of currency pairs returned. All currency pairs with open orders will be returned. Spot and margin orders are returned by default. To list cross margin orders, account must be set to cross_margin

func (*Gateio) GenerateCurrencyDepositAddress

func (g *Gateio) GenerateCurrencyDepositAddress(ctx context.Context, ccy currency.Code) (*CurrencyDepositAddressInfo, error)

GenerateCurrencyDepositAddress generate currency deposit address

func (*Gateio) GenerateDefaultSubscriptions

func (g *Gateio) GenerateDefaultSubscriptions() ([]subscription.Subscription, error)

GenerateDefaultSubscriptions returns default subscriptions

func (*Gateio) GenerateDeliveryFuturesDefaultSubscriptions

func (g *Gateio) GenerateDeliveryFuturesDefaultSubscriptions() ([]subscription.Subscription, error)

GenerateDeliveryFuturesDefaultSubscriptions returns delivery futures default subscriptions params.

func (*Gateio) GenerateFuturesDefaultSubscriptions

func (g *Gateio) GenerateFuturesDefaultSubscriptions() ([]subscription.Subscription, error)

GenerateFuturesDefaultSubscriptions returns default subscriptions information.

func (*Gateio) GenerateOptionsDefaultSubscriptions

func (g *Gateio) GenerateOptionsDefaultSubscriptions(pairs currency.Pairs) ([]subscription.Subscription, error)

GenerateOptionsDefaultSubscriptions generates list of channel subscriptions for options asset type.

func (*Gateio) GenerateSignature

func (g *Gateio) GenerateSignature(secret, method, path, query string, body interface{}, dtime time.Time) (string, error)

GenerateSignature returns hash for authenticated requests

func (*Gateio) GetAPIKeyOfSubAccount

func (g *Gateio) GetAPIKeyOfSubAccount(ctx context.Context, subAccountUserID int64, apiKey string) (*CreateAPIKeyResponse, error)

GetAPIKeyOfSubAccount retrieves the API Key of the sub-account

func (*Gateio) GetAccountChangingHistory

func (g *Gateio) GetAccountChangingHistory(ctx context.Context, offset, limit uint64, from, to time.Time, changingType string) ([]AccountBook, error)

GetAccountChangingHistory retrieves list of account changing history

func (*Gateio) GetAccountFundingHistory

func (g *Gateio) GetAccountFundingHistory(_ context.Context) ([]exchange.FundingHistory, error)

GetAccountFundingHistory returns funding history, deposits and withdrawals

func (*Gateio) GetActiveOrders

func (g *Gateio) GetActiveOrders(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)

GetActiveOrders retrieves any orders that are active/open

func (*Gateio) GetAllAPIKeyOfSubAccount

func (g *Gateio) GetAllAPIKeyOfSubAccount(ctx context.Context, userID int64) ([]CreateAPIKeyResponse, error)

GetAllAPIKeyOfSubAccount list all API Key of the sub-account

func (*Gateio) GetAllContractOfUnderlyingWithinExpiryDate

func (g *Gateio) GetAllContractOfUnderlyingWithinExpiryDate(ctx context.Context, underlying string, expTime time.Time) ([]OptionContract, error)

GetAllContractOfUnderlyingWithinExpiryDate retrieves list of contracts of the specified underlying and expiry time.

func (*Gateio) GetAllDeliveryContracts

func (g *Gateio) GetAllDeliveryContracts(ctx context.Context, settle string) ([]DeliveryContract, error)

GetAllDeliveryContracts retrieves all futures contracts

func (*Gateio) GetAllDeliveryPositionsOfUser

func (g *Gateio) GetAllDeliveryPositionsOfUser(ctx context.Context, settle string) (*Position, error)

GetAllDeliveryPositionsOfUser retrieves all positions of user

func (*Gateio) GetAllFlashSwapOrders

func (g *Gateio) GetAllFlashSwapOrders(ctx context.Context, status int, sellCurrency, buyCurrency currency.Code, reverse bool, limit, page uint64) ([]FlashSwapOrderResponse, error)

GetAllFlashSwapOrders retrieves list of flash swap orders filtered by the params

func (*Gateio) GetAllFutureContracts

func (g *Gateio) GetAllFutureContracts(ctx context.Context, settle string) ([]FuturesContract, error)

GetAllFutureContracts retrieves list all futures contracts

func (*Gateio) GetAllFuturesPositionsOfUsers

func (g *Gateio) GetAllFuturesPositionsOfUsers(ctx context.Context, settle string, realPositionsOnly bool) ([]Position, error)

GetAllFuturesPositionsOfUsers list all positions of users.

func (*Gateio) GetAllOptionsUnderlyings

func (g *Gateio) GetAllOptionsUnderlyings(ctx context.Context) ([]OptionUnderlying, error)

GetAllOptionsUnderlyings retrieves all option underlyings

func (*Gateio) GetAvailableTransferChains

func (g *Gateio) GetAvailableTransferChains(ctx context.Context, cryptocurrency currency.Code) ([]string, error)

GetAvailableTransferChains returns the available transfer blockchains for the specific cryptocurrency

func (*Gateio) GetCandlesticks

func (g *Gateio) GetCandlesticks(ctx context.Context, currencyPair currency.Pair, limit uint64, from, to time.Time, interval kline.Interval) ([]Candlestick, error)

GetCandlesticks retrieves market candlesticks.

func (*Gateio) GetCrossMarginAccountChangeHistory

func (g *Gateio) GetCrossMarginAccountChangeHistory(ctx context.Context, ccy currency.Code, from, to time.Time, page, limit uint64, accountChangeType string) ([]CrossMarginAccountHistoryItem, error)

GetCrossMarginAccountChangeHistory retrieve cross margin account change history Record time range cannot exceed 30 days

func (*Gateio) GetCrossMarginAccounts

func (g *Gateio) GetCrossMarginAccounts(ctx context.Context) (*CrossMarginAccount, error)

GetCrossMarginAccounts retrieve cross margin account

func (*Gateio) GetCrossMarginBorrowHistory

func (g *Gateio) GetCrossMarginBorrowHistory(ctx context.Context, status uint64, ccy currency.Code, limit, offset uint64, reverse bool) ([]CrossMarginLoanResponse, error)

GetCrossMarginBorrowHistory retrieves cross margin borrow history sorted by creation time in descending order by default. Set reverse=false to return ascending results.

func (*Gateio) GetCrossMarginRepayments

func (g *Gateio) GetCrossMarginRepayments(ctx context.Context, ccy currency.Code, loanID string, limit, offset uint64, reverse bool) ([]CrossMarginLoanResponse, error)

GetCrossMarginRepayments retrieves list of cross margin repayments

func (*Gateio) GetCrossMarginSupportedCurrencyDetail

func (g *Gateio) GetCrossMarginSupportedCurrencyDetail(ctx context.Context, ccy currency.Code) (*CrossMarginCurrencies, error)

GetCrossMarginSupportedCurrencyDetail retrieve detail of one single currency supported by cross margin

func (*Gateio) GetCurrencyDetail

func (g *Gateio) GetCurrencyDetail(ctx context.Context, ccy currency.Code) (*CurrencyInfo, error)

GetCurrencyDetail details of a specific currency.

func (*Gateio) GetCurrencyPairDetail

func (g *Gateio) GetCurrencyPairDetail(ctx context.Context, currencyPair string) (*CurrencyPairDetail, error)

GetCurrencyPairDetail to get details of a specific order for spot/margin accounts.

func (*Gateio) GetCurrencyTradeURL

func (g *Gateio) GetCurrencyTradeURL(_ context.Context, a asset.Item, cp currency.Pair) (string, error)

GetCurrencyTradeURL returns the URL to the exchange's trade page for the given asset and currency pair

func (*Gateio) GetDeliveryAccountBooks

func (g *Gateio) GetDeliveryAccountBooks(ctx context.Context, settle string, limit uint64, from, to time.Time, changingType string) ([]AccountBookItem, error)

GetDeliveryAccountBooks retrieves account books

func (*Gateio) GetDeliveryAllAutoOrder

func (g *Gateio) GetDeliveryAllAutoOrder(ctx context.Context, status, settle string, contract currency.Pair, limit, offset uint64) ([]PriceTriggeredOrder, error)

GetDeliveryAllAutoOrder retrieves all auto orders

func (*Gateio) GetDeliveryFutureTickers

func (g *Gateio) GetDeliveryFutureTickers(ctx context.Context, settle string, contract currency.Pair) ([]FuturesTicker, error)

GetDeliveryFutureTickers retrieves futures ticker information for a specific settle and contract info.

func (*Gateio) GetDeliveryFuturesAccounts

func (g *Gateio) GetDeliveryFuturesAccounts(ctx context.Context, settle string) (*FuturesAccount, error)

GetDeliveryFuturesAccounts retrieves futures account

func (*Gateio) GetDeliveryFuturesCandlesticks

func (g *Gateio) GetDeliveryFuturesCandlesticks(ctx context.Context, settle string, contract currency.Pair, from, to time.Time, limit uint64, interval kline.Interval) ([]FuturesCandlestick, error)

GetDeliveryFuturesCandlesticks retrieves specified contract candlesticks

func (*Gateio) GetDeliveryInsuranceBalanceHistory

func (g *Gateio) GetDeliveryInsuranceBalanceHistory(ctx context.Context, settle string, limit uint64) ([]InsuranceBalance, error)

GetDeliveryInsuranceBalanceHistory retrieves delivery futures insurance balance history

func (*Gateio) GetDeliveryLiquidationHistory

func (g *Gateio) GetDeliveryLiquidationHistory(ctx context.Context, settle string, contract currency.Pair, limit uint64, at time.Time) ([]LiquidationHistoryItem, error)

GetDeliveryLiquidationHistory lists liquidation history

func (*Gateio) GetDeliveryOrderbook

func (g *Gateio) GetDeliveryOrderbook(ctx context.Context, settle, interval string, contract currency.Pair, limit uint64, withOrderbookID bool) (*Orderbook, error)

GetDeliveryOrderbook delivery orderbook

func (*Gateio) GetDeliveryOrders

func (g *Gateio) GetDeliveryOrders(ctx context.Context, contract currency.Pair, status, settle, lastID string, limit, offset uint64, countTotal int64) ([]Order, error)

GetDeliveryOrders list futures orders Zero-filled order cannot be retrieved 10 minutes after order cancellation

func (*Gateio) GetDeliveryPersonalTradingHistory

func (g *Gateio) GetDeliveryPersonalTradingHistory(ctx context.Context, settle, orderID string, contract currency.Pair, limit, offset, countTotal uint64, lastID string) ([]TradingHistoryItem, error)

GetDeliveryPersonalTradingHistory retrieves personal trading history

func (*Gateio) GetDeliveryPositionCloseHistory

func (g *Gateio) GetDeliveryPositionCloseHistory(ctx context.Context, settle string, contract currency.Pair, limit, offset uint64, from, to time.Time) ([]PositionCloseHistoryResponse, error)

GetDeliveryPositionCloseHistory retrieves position history

func (*Gateio) GetDeliveryPriceTriggeredOrder

func (g *Gateio) GetDeliveryPriceTriggeredOrder(ctx context.Context, settle string, arg *FuturesPriceTriggeredOrderParam) (*OrderID, error)

GetDeliveryPriceTriggeredOrder creates a price-triggered order

func (*Gateio) GetDeliverySettlementHistory

func (g *Gateio) GetDeliverySettlementHistory(ctx context.Context, settle string, contract currency.Pair, limit uint64, at time.Time) ([]SettlementHistoryItem, error)

GetDeliverySettlementHistory retrieves settlement history

func (*Gateio) GetDeliveryTradingHistory

func (g *Gateio) GetDeliveryTradingHistory(ctx context.Context, settle, lastID string, contract currency.Pair, limit uint64, from, to time.Time) ([]DeliveryTradingHistory, error)

GetDeliveryTradingHistory retrieves futures trading history

func (*Gateio) GetDepositAddress

func (g *Gateio) GetDepositAddress(ctx context.Context, cryptocurrency currency.Code, _, chain string) (*deposit.Address, error)

GetDepositAddress returns a deposit address for a specified currency

func (*Gateio) GetDepositRecords

func (g *Gateio) GetDepositRecords(ctx context.Context, ccy currency.Code, from, to time.Time, offset, limit uint64) ([]DepositRecord, error)

GetDepositRecords retrieves deposit records. Record time range cannot exceed 30 days

func (*Gateio) GetExpirationTime

func (g *Gateio) GetExpirationTime(ctx context.Context, underlying string) (time.Time, error)

GetExpirationTime return the expiration time for the provided underlying.

func (*Gateio) GetFee

func (g *Gateio) GetFee(ctx context.Context, feeBuilder *exchange.FeeBuilder) (fee float64, err error)

GetFee returns an estimate of fee based on type of transaction

func (*Gateio) GetFeeByType

func (g *Gateio) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFeeByType returns an estimate of fee based on type of transaction

func (*Gateio) GetFutureFundingRates

func (g *Gateio) GetFutureFundingRates(ctx context.Context, settle string, contract currency.Pair, limit uint64) ([]FuturesFundingRate, error)

GetFutureFundingRates retrieves funding rate information.

func (*Gateio) GetFutureStats

func (g *Gateio) GetFutureStats(ctx context.Context, settle string, contract currency.Pair, from time.Time, interval kline.Interval, limit uint64) ([]ContractStat, error)

GetFutureStats retrieves futures stats

func (*Gateio) GetFuturesAccountBooks

func (g *Gateio) GetFuturesAccountBooks(ctx context.Context, settle string, limit uint64, from, to time.Time, changingType string) ([]AccountBookItem, error)

GetFuturesAccountBooks retrieves account books

func (*Gateio) GetFuturesCandlesticks

func (g *Gateio) GetFuturesCandlesticks(ctx context.Context, settle, contract string, from, to time.Time, limit uint64, interval kline.Interval) ([]FuturesCandlestick, error)

GetFuturesCandlesticks retrieves specified contract candlesticks.

func (*Gateio) GetFuturesContractDetails

func (g *Gateio) GetFuturesContractDetails(ctx context.Context, item asset.Item) ([]futures.Contract, error)

GetFuturesContractDetails returns details about futures contracts

func (*Gateio) GetFuturesInsuranceBalanceHistory

func (g *Gateio) GetFuturesInsuranceBalanceHistory(ctx context.Context, settle string, limit uint64) ([]InsuranceBalance, error)

GetFuturesInsuranceBalanceHistory retrieves futures insurance balance history

func (*Gateio) GetFuturesLiquidationHistory

func (g *Gateio) GetFuturesLiquidationHistory(ctx context.Context, settle string, contract currency.Pair, limit uint64, at time.Time) ([]LiquidationHistoryItem, error)

GetFuturesLiquidationHistory list liquidation history

func (*Gateio) GetFuturesOrderbook

func (g *Gateio) GetFuturesOrderbook(ctx context.Context, settle, contract, interval string, limit uint64, withOrderbookID bool) (*Orderbook, error)

GetFuturesOrderbook retrieves futures order book data

func (*Gateio) GetFuturesOrders

func (g *Gateio) GetFuturesOrders(ctx context.Context, contract currency.Pair, status, lastID, settle string, limit, offset uint64, countTotal int64) ([]Order, error)

GetFuturesOrders retrieves list of futures orders Zero-filled order cannot be retrieved 10 minutes after order cancellation

func (*Gateio) GetFuturesPositionCloseHistory

func (g *Gateio) GetFuturesPositionCloseHistory(ctx context.Context, settle string, contract currency.Pair, limit, offset uint64, from, to time.Time) ([]PositionCloseHistoryResponse, error)

GetFuturesPositionCloseHistory lists position close history

func (*Gateio) GetFuturesTickers

func (g *Gateio) GetFuturesTickers(ctx context.Context, settle string, contract currency.Pair) ([]FuturesTicker, error)

GetFuturesTickers retrieves futures ticker information for a specific settle and contract info.

func (*Gateio) GetFuturesTradingHistory

func (g *Gateio) GetFuturesTradingHistory(ctx context.Context, settle string, contract currency.Pair, limit, offset uint64, lastID string, from, to time.Time) ([]TradingHistoryItem, error)

GetFuturesTradingHistory retrieves futures trading history

func (*Gateio) GetHistoricCandles

func (g *Gateio) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, start, end time.Time) (*kline.Item, error)

GetHistoricCandles returns candles between a time period for a set time interval

func (*Gateio) GetHistoricCandlesExtended

func (g *Gateio) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, start, end time.Time) (*kline.Item, error)

GetHistoricCandlesExtended returns candles between a time period for a set time interval

func (*Gateio) GetHistoricTrades

func (g *Gateio) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error)

GetHistoricTrades returns historic trade data within the timeframe provided

func (*Gateio) GetHistoricalFundingRates

func (g *Gateio) GetHistoricalFundingRates(ctx context.Context, r *fundingrate.HistoricalRatesRequest) (*fundingrate.HistoricalRates, error)

GetHistoricalFundingRates returns historical funding rates for a futures contract

func (*Gateio) GetIndexConstituent

func (g *Gateio) GetIndexConstituent(ctx context.Context, settle, index string) (*IndexConstituent, error)

GetIndexConstituent retrieves index constituents

func (*Gateio) GetIntervalFromString

func (g *Gateio) GetIntervalFromString(interval string) (kline.Interval, error)

GetIntervalFromString returns a kline.Interval representation of the interval string

func (*Gateio) GetIntervalString

func (g *Gateio) GetIntervalString(interval kline.Interval) (string, error)

GetIntervalString returns a string representation of the interval according to the Gateio exchange representation.

func (*Gateio) GetLatestFundingRates

func (g *Gateio) GetLatestFundingRates(ctx context.Context, r *fundingrate.LatestRateRequest) ([]fundingrate.LatestRateResponse, error)

GetLatestFundingRates returns the latest funding rates data

func (*Gateio) GetLiquidationHistory

func (g *Gateio) GetLiquidationHistory(ctx context.Context, settle string, contract currency.Pair, from, to time.Time, limit uint64) ([]LiquidationHistory, error)

GetLiquidationHistory retrieves liqudiation history

func (*Gateio) GetMarginAccountList

func (g *Gateio) GetMarginAccountList(ctx context.Context, currencyPair currency.Pair) ([]MarginAccountItem, error)

GetMarginAccountList margin account list

func (*Gateio) GetMarginAllLoans

func (g *Gateio) GetMarginAllLoans(ctx context.Context, status, side, sortBy string, ccy currency.Code, currencyPair currency.Pair, reverseSort bool, page, limit uint64) ([]MarginLoanResponse, error)

GetMarginAllLoans retrieves all loans (borrow and lending) orders.

func (*Gateio) GetMarginFundingAccountList

func (g *Gateio) GetMarginFundingAccountList(ctx context.Context, ccy currency.Code) ([]MarginFundingAccountItem, error)

GetMarginFundingAccountList retrieves funding account list

func (*Gateio) GetMarginSupportedCurrencyPairs

func (g *Gateio) GetMarginSupportedCurrencyPairs(ctx context.Context) ([]MarginCurrencyPairInfo, error)

GetMarginSupportedCurrencyPairs retrieves margin supported currency pairs.

func (*Gateio) GetMarketTrades

func (g *Gateio) GetMarketTrades(ctx context.Context, pairString currency.Pair, limit uint64, lastID string, reverse bool, from, to time.Time, page uint64) ([]Trade, error)

GetMarketTrades retrieve market trades

func (*Gateio) GetMaxBorrowableAmountForSpecificCrossMarginCurrency

func (g *Gateio) GetMaxBorrowableAmountForSpecificCrossMarginCurrency(ctx context.Context, ccy currency.Code) (*CurrencyAndAmount, error)

GetMaxBorrowableAmountForSpecificCrossMarginCurrency returns the max borrowable amount for a specific cross margin currency

func (*Gateio) GetMaxBorrowableAmountForSpecificMarginCurrency

func (g *Gateio) GetMaxBorrowableAmountForSpecificMarginCurrency(ctx context.Context, ccy currency.Code, currencyPair currency.Pair) (*MaxTransferAndLoanAmount, error)

GetMaxBorrowableAmountForSpecificMarginCurrency retrieves the max borrowble amount for specific currency

func (*Gateio) GetMaxTransferableAmountForSpecificCrossMarginCurrency

func (g *Gateio) GetMaxTransferableAmountForSpecificCrossMarginCurrency(ctx context.Context, ccy currency.Code) (*CurrencyAndAmount, error)

GetMaxTransferableAmountForSpecificCrossMarginCurrency get the max transferable amount for a specific cross margin currency

func (*Gateio) GetMaxTransferableAmountForSpecificMarginCurrency

func (g *Gateio) GetMaxTransferableAmountForSpecificMarginCurrency(ctx context.Context, ccy currency.Code, currencyPair currency.Pair) (*MaxTransferAndLoanAmount, error)

GetMaxTransferableAmountForSpecificMarginCurrency get the max transferable amount for a specific margin currency.

func (*Gateio) GetMyOptionsSettlements

func (g *Gateio) GetMyOptionsSettlements(ctx context.Context, underlying string, contract currency.Pair, offset, limit uint64, to time.Time) ([]MyOptionSettlement, error)

GetMyOptionsSettlements retrieves accounts option settlements.

func (*Gateio) GetMyPersonalTradingHistory

func (g *Gateio) GetMyPersonalTradingHistory(ctx context.Context, settle, lastID, orderID string, contract currency.Pair, limit, offset, countTotal uint64) ([]TradingHistoryItem, error)

GetMyPersonalTradingHistory retrieves my personal trading history

func (*Gateio) GetOneSingleLoanRecord

func (g *Gateio) GetOneSingleLoanRecord(ctx context.Context, loanID, loanRecordID string) (*LoanRecord, error)

GetOneSingleLoanRecord get one single loan record

func (*Gateio) GetOpenInterest

func (g *Gateio) GetOpenInterest(ctx context.Context, k ...key.PairAsset) ([]futures.OpenInterest, error)

GetOpenInterest returns the open interest rate for a given asset pair

func (*Gateio) GetOptionAccounts

func (g *Gateio) GetOptionAccounts(ctx context.Context) (*OptionAccount, error)

GetOptionAccounts lists option accounts

func (*Gateio) GetOptionFuturesCandlesticks

func (g *Gateio) GetOptionFuturesCandlesticks(ctx context.Context, contract currency.Pair, limit uint64, from, to time.Time, interval kline.Interval) ([]FuturesCandlestick, error)

GetOptionFuturesCandlesticks retrieves option futures candlesticks

func (*Gateio) GetOptionFuturesMarkPriceCandlesticks

func (g *Gateio) GetOptionFuturesMarkPriceCandlesticks(ctx context.Context, underlying string, limit uint64, from, to time.Time, interval kline.Interval) ([]FuturesCandlestick, error)

GetOptionFuturesMarkPriceCandlesticks retrieves mark price candlesticks of an underlying

func (*Gateio) GetOptionFuturesOrders

func (g *Gateio) GetOptionFuturesOrders(ctx context.Context, contract currency.Pair, underlying, status string, offset, limit uint64, from, to time.Time) ([]OptionOrderResponse, error)

GetOptionFuturesOrders retrieves futures orders

func (*Gateio) GetOptionUnderlyingTickers

func (g *Gateio) GetOptionUnderlyingTickers(ctx context.Context, underlying string) (*OptionsUnderlyingTicker, error)

GetOptionUnderlyingTickers retrieves options underlying ticker

func (*Gateio) GetOptionsOrderbook

func (g *Gateio) GetOptionsOrderbook(ctx context.Context, contract currency.Pair, interval string, limit uint64, withOrderbookID bool) (*Orderbook, error)

GetOptionsOrderbook returns the orderbook data for the given contract.

func (*Gateio) GetOptionsPersonalTradingHistory

func (g *Gateio) GetOptionsPersonalTradingHistory(ctx context.Context, underlying string, contract currency.Pair, offset, limit uint64, from, to time.Time) ([]OptionTradingHistory, error)

GetOptionsPersonalTradingHistory retrieves personal tradign histories given the underlying{Required}, contract, and other pagination params.

func (*Gateio) GetOptionsSpecifiedContractDetail

func (g *Gateio) GetOptionsSpecifiedContractDetail(ctx context.Context, contract currency.Pair) (*OptionContract, error)

GetOptionsSpecifiedContractDetail query specified contract detail

func (*Gateio) GetOptionsSpecifiedContractsSettlement

func (g *Gateio) GetOptionsSpecifiedContractsSettlement(ctx context.Context, contract currency.Pair, underlying string, at int64) (*OptionSettlement, error)

GetOptionsSpecifiedContractsSettlement retrieve a single contract settlement detail passing the underlying and contract name

func (*Gateio) GetOptionsTickers

func (g *Gateio) GetOptionsTickers(ctx context.Context, underlying string) ([]OptionsTicker, error)

GetOptionsTickers lists tickers of options contracts

func (*Gateio) GetOptionsTradeHistory

func (g *Gateio) GetOptionsTradeHistory(ctx context.Context, contract currency.Pair, callType string, offset, limit uint64, from, to time.Time) ([]TradingHistoryItem, error)

GetOptionsTradeHistory retrieves options trade history

func (*Gateio) GetOrderHistory

func (g *Gateio) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)

GetOrderHistory retrieves account order information Can Limit response to specific order status

func (*Gateio) GetOrderInfo

func (g *Gateio) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, a asset.Item) (*order.Detail, error)

GetOrderInfo returns order information based on order ID

func (*Gateio) GetOrderbook

func (g *Gateio) GetOrderbook(ctx context.Context, pairString, interval string, limit uint64, withOrderbookID bool) (*Orderbook, error)

GetOrderbook returns the orderbook data for a suppled currency pair

func (*Gateio) GetOrderbookOfLendingLoans

func (g *Gateio) GetOrderbookOfLendingLoans(ctx context.Context, ccy currency.Code) ([]OrderbookOfLendingLoan, error)

GetOrderbookOfLendingLoans retrieves order book of lending loans for specific currency

func (*Gateio) GetPersonalTradingFee

func (g *Gateio) GetPersonalTradingFee(ctx context.Context, currencyPair currency.Pair, settle string) (*PersonalTradingFee, error)

GetPersonalTradingFee retrieves personal trading fee

func (*Gateio) GetPriceTriggeredOrderList

func (g *Gateio) GetPriceTriggeredOrderList(ctx context.Context, status string, market currency.Pair, account asset.Item, offset, limit uint64) ([]SpotPriceTriggeredOrder, error)

GetPriceTriggeredOrderList retrieves price orders created with an order detail and trigger price information.

func (*Gateio) GetRecentTrades

func (g *Gateio) GetRecentTrades(ctx context.Context, p currency.Pair, a asset.Item) ([]trade.Data, error)

GetRecentTrades returns the most recent trades for a currency and asset

func (*Gateio) GetSavedAddresses

func (g *Gateio) GetSavedAddresses(ctx context.Context, ccy currency.Code, chain string, limit uint64) ([]WalletSavedAddress, error)

GetSavedAddresses retrieves saved currency address info and related details.

func (*Gateio) GetServerTime

func (g *Gateio) GetServerTime(ctx context.Context, _ asset.Item) (time.Time, error)

GetServerTime retrieves current server time

func (*Gateio) GetSettlementHistory

func (g *Gateio) GetSettlementHistory(ctx context.Context, underlying string, offset, limit uint64, from, to time.Time) ([]OptionSettlement, error)

GetSettlementHistory retrieves list of settlement history

func (*Gateio) GetSingleBorrowLoanDetail

func (g *Gateio) GetSingleBorrowLoanDetail(ctx context.Context, loanID string) (*CrossMarginLoanResponse, error)

GetSingleBorrowLoanDetail retrieve single borrow loan detail

func (*Gateio) GetSingleContract

func (g *Gateio) GetSingleContract(ctx context.Context, settle, contract string) (*FuturesContract, error)

GetSingleContract returns a single contract info for the specified settle and Currency Pair (contract << in this case)

func (*Gateio) GetSingleDeliveryContracts

func (g *Gateio) GetSingleDeliveryContracts(ctx context.Context, settle string, contract currency.Pair) (*DeliveryContract, error)

GetSingleDeliveryContracts retrieves a single delivery contract instance.

func (*Gateio) GetSingleDeliveryOrder

func (g *Gateio) GetSingleDeliveryOrder(ctx context.Context, settle, orderID string) (*Order, error)

GetSingleDeliveryOrder Get a single order Zero-filled order cannot be retrieved 10 minutes after order cancellation

func (*Gateio) GetSingleDeliveryPosition

func (g *Gateio) GetSingleDeliveryPosition(ctx context.Context, settle string, contract currency.Pair) (*Position, error)

GetSingleDeliveryPosition get single position

func (*Gateio) GetSingleDeliveryPriceTriggeredOrder

func (g *Gateio) GetSingleDeliveryPriceTriggeredOrder(ctx context.Context, settle, orderID string) (*PriceTriggeredOrder, error)

GetSingleDeliveryPriceTriggeredOrder retrieves a single price triggered order

func (*Gateio) GetSingleFlashSwapOrder

func (g *Gateio) GetSingleFlashSwapOrder(ctx context.Context, orderID string) (*FlashSwapOrderResponse, error)

GetSingleFlashSwapOrder get a single flash swap order's detail

func (*Gateio) GetSingleFuturesOrder

func (g *Gateio) GetSingleFuturesOrder(ctx context.Context, settle, orderID string) (*Order, error)

GetSingleFuturesOrder retrieves a single order by its identifier

func (*Gateio) GetSingleFuturesPriceTriggeredOrder

func (g *Gateio) GetSingleFuturesPriceTriggeredOrder(ctx context.Context, settle, orderID string) (*PriceTriggeredOrder, error)

GetSingleFuturesPriceTriggeredOrder retrieves a single price triggered order

func (*Gateio) GetSingleMarginSupportedCurrencyPair

func (g *Gateio) GetSingleMarginSupportedCurrencyPair(ctx context.Context, market currency.Pair) (*MarginCurrencyPairInfo, error)

GetSingleMarginSupportedCurrencyPair retrieves margin supported currency pair detail given the currency pair.

func (*Gateio) GetSingleOptionOrder

func (g *Gateio) GetSingleOptionOrder(ctx context.Context, orderID string) (*OptionOrderResponse, error)

GetSingleOptionOrder retrieves a single option order

func (*Gateio) GetSinglePosition

func (g *Gateio) GetSinglePosition(ctx context.Context, settle string, contract currency.Pair) (*Position, error)

GetSinglePosition returns a single position

func (*Gateio) GetSinglePriceTriggeredOrder

func (g *Gateio) GetSinglePriceTriggeredOrder(ctx context.Context, orderID string) (*SpotPriceTriggeredOrder, error)

GetSinglePriceTriggeredOrder get a single order

func (*Gateio) GetSingleSubAccount

func (g *Gateio) GetSingleSubAccount(ctx context.Context, userID string) (*SubAccount, error)

GetSingleSubAccount retrieves a single sub-account for given account

func (*Gateio) GetSpecifiedContractPosition

func (g *Gateio) GetSpecifiedContractPosition(ctx context.Context, contract currency.Pair) (*UsersPositionForUnderlying, error)

GetSpecifiedContractPosition retrieves specified contract position

func (*Gateio) GetSpotAccounts

func (g *Gateio) GetSpotAccounts(ctx context.Context, ccy currency.Code) ([]SpotAccount, error)

GetSpotAccounts retrieves spot account.

func (*Gateio) GetSpotOrder

func (g *Gateio) GetSpotOrder(ctx context.Context, orderID string, currencyPair currency.Pair, account asset.Item) (*SpotOrder, error)

GetSpotOrder retrieves a single spot order using the order id and currency pair information.

func (*Gateio) GetSpotOrders

func (g *Gateio) GetSpotOrders(ctx context.Context, currencyPair currency.Pair, status string, page, limit uint64) ([]SpotOrder, error)

GetSpotOrders retrieves spot orders.

func (*Gateio) GetSubAccountBalances

func (g *Gateio) GetSubAccountBalances(ctx context.Context, subAccountUserID string) ([]FuturesSubAccountBalance, error)

GetSubAccountBalances retrieve sub account balances

func (*Gateio) GetSubAccountCrossMarginBalances

func (g *Gateio) GetSubAccountCrossMarginBalances(ctx context.Context, subAccountUserID string) ([]SubAccountCrossMarginInfo, error)

GetSubAccountCrossMarginBalances query subaccount's cross_margin account info

func (*Gateio) GetSubAccountFuturesBalances

func (g *Gateio) GetSubAccountFuturesBalances(ctx context.Context, subAccountUserID, settle string) ([]FuturesSubAccountBalance, error)

GetSubAccountFuturesBalances retrieves sub accounts' futures account balances

func (*Gateio) GetSubAccountMarginBalances

func (g *Gateio) GetSubAccountMarginBalances(ctx context.Context, subAccountUserID string) ([]SubAccountMarginBalance, error)

GetSubAccountMarginBalances query sub accounts' margin balances

func (*Gateio) GetSubAccountTransferHistory

func (g *Gateio) GetSubAccountTransferHistory(ctx context.Context, subAccountUserID string, from, to time.Time, offset, limit uint64) ([]SubAccountTransferResponse, error)

GetSubAccountTransferHistory retrieve transfer records between main and sub accounts. retrieve transfer records between main and sub accounts. Record time range cannot exceed 30 days Note: only records after 2020-04-10 can be retrieved

func (*Gateio) GetSubAccounts

func (g *Gateio) GetSubAccounts(ctx context.Context) ([]SubAccount, error)

GetSubAccounts retrieves list of sub-accounts for given account

func (*Gateio) GetSupportedFlashSwapCurrencies

func (g *Gateio) GetSupportedFlashSwapCurrencies(ctx context.Context) ([]SwapCurrencies, error)

GetSupportedFlashSwapCurrencies retrieves all supported currencies in flash swap

func (*Gateio) GetTicker

func (g *Gateio) GetTicker(ctx context.Context, currencyPair, timezone string) (*Ticker, error)

GetTicker retrieves a single ticker information for a currency pair.

func (*Gateio) GetTickers

func (g *Gateio) GetTickers(ctx context.Context, currencyPair, timezone string) ([]Ticker, error)

GetTickers retrieve ticker information Return only related data if currency_pair is specified; otherwise return all of them

func (*Gateio) GetTradingFeeRatio

func (g *Gateio) GetTradingFeeRatio(ctx context.Context, currencyPair currency.Pair) (*SpotTradingFeeRate, error)

GetTradingFeeRatio retrieves user trading fee rates

func (*Gateio) GetUnderlyingFromCurrencyPair

func (g *Gateio) GetUnderlyingFromCurrencyPair(p currency.Pair) (currency.Pair, error)

GetUnderlyingFromCurrencyPair returns an underlying string from a currency pair

func (*Gateio) GetUserAutoRepaymentSetting

func (g *Gateio) GetUserAutoRepaymentSetting(ctx context.Context) (*OnOffStatus, error)

GetUserAutoRepaymentSetting retrieve user auto repayment setting

func (*Gateio) GetUsersLiquidationHistoryForSpecifiedUnderlying

func (g *Gateio) GetUsersLiquidationHistoryForSpecifiedUnderlying(ctx context.Context, underlying string, contract currency.Pair) ([]ContractClosePosition, error)

GetUsersLiquidationHistoryForSpecifiedUnderlying retrieves user's liquidation history of specified underlying

func (*Gateio) GetUsersPositionSpecifiedUnderlying

func (g *Gateio) GetUsersPositionSpecifiedUnderlying(ctx context.Context, underlying string) ([]UsersPositionForUnderlying, error)

GetUsersPositionSpecifiedUnderlying lists user's positions of specified underlying

func (*Gateio) GetUsersTotalBalance

func (g *Gateio) GetUsersTotalBalance(ctx context.Context, ccy currency.Code) (*UsersAllAccountBalance, error)

GetUsersTotalBalance retrieves user's total balances

func (*Gateio) GetWithdrawalRecords

func (g *Gateio) GetWithdrawalRecords(ctx context.Context, ccy currency.Code, from, to time.Time, offset, limit uint64) ([]WithdrawalResponse, error)

GetWithdrawalRecords retrieves withdrawal records. Record time range cannot exceed 30 days

func (*Gateio) GetWithdrawalStatus

func (g *Gateio) GetWithdrawalStatus(ctx context.Context, ccy currency.Code) ([]WithdrawalStatus, error)

GetWithdrawalStatus retrieves withdrawal status

func (*Gateio) GetWithdrawalsHistory

func (g *Gateio) GetWithdrawalsHistory(ctx context.Context, c currency.Code, _ asset.Item) ([]exchange.WithdrawalHistory, error)

GetWithdrawalsHistory returns previous withdrawals data

func (*Gateio) InitiateFlashSwapOrderReview

func (g *Gateio) InitiateFlashSwapOrderReview(ctx context.Context, arg FlashSwapOrderParams) (*InitFlashSwapOrderPreviewResponse, error)

InitiateFlashSwapOrderReview initiate a flash swap order preview

func (*Gateio) IsPerpetualFutureCurrency

func (g *Gateio) IsPerpetualFutureCurrency(a asset.Item, _ currency.Pair) (bool, error)

IsPerpetualFutureCurrency ensures a given asset and currency is a perpetual future

func (*Gateio) IsValidPairString

func (g *Gateio) IsValidPairString(currencyPair string) bool

IsValidPairString returns true if the string represents a valid currency pair

func (*Gateio) ListAllFuturesAutoOrders

func (g *Gateio) ListAllFuturesAutoOrders(ctx context.Context, status, settle string, contract currency.Pair, limit, offset uint64) ([]PriceTriggeredOrder, error)

ListAllFuturesAutoOrders lists all open orders

func (*Gateio) ListCurrencyChain

func (g *Gateio) ListCurrencyChain(ctx context.Context, ccy currency.Code) ([]CurrencyChain, error)

ListCurrencyChain retrieves a list of currency chain name

func (*Gateio) ListLoanRepaymentRecords

func (g *Gateio) ListLoanRepaymentRecords(ctx context.Context, loanID string) ([]LoanRepaymentRecord, error)

ListLoanRepaymentRecords retrieves loan repayment records for specified loan ID

func (*Gateio) ListMarginAccountBalanceChangeHistory

func (g *Gateio) ListMarginAccountBalanceChangeHistory(ctx context.Context, ccy currency.Code, currencyPair currency.Pair, from, to time.Time, page, limit uint64) ([]MarginAccountBalanceChangeInfo, error)

ListMarginAccountBalanceChangeHistory retrieves margin account balance change history Only transferals from and to margin account are provided for now. Time range allows 30 days at most

func (*Gateio) ListRepaymentRecordsOfSpecificLoan

func (g *Gateio) ListRepaymentRecordsOfSpecificLoan(ctx context.Context, loanID, status string, page, limit uint64) ([]LoanRecord, error)

ListRepaymentRecordsOfSpecificLoan retrieves repayment records of specific loan

func (*Gateio) ListSpotCurrencies

func (g *Gateio) ListSpotCurrencies(ctx context.Context) ([]CurrencyInfo, error)

ListSpotCurrencies to retrieve detailed list of each currency.

func (*Gateio) ListSpotCurrencyPairs

func (g *Gateio) ListSpotCurrencyPairs(ctx context.Context) ([]CurrencyPairDetail, error)

ListSpotCurrencyPairs retrieve all currency pairs supported by the exchange.

func (*Gateio) LockSubAccount

func (g *Gateio) LockSubAccount(ctx context.Context, subAccountUserID int64) error

LockSubAccount locks the sub-account

func (*Gateio) MarginLoan

MarginLoan represents lend or borrow request

func (*Gateio) MergeMultipleLendingLoans

func (g *Gateio) MergeMultipleLendingLoans(ctx context.Context, ccy currency.Code, ids []string) (*MarginLoanResponse, error)

MergeMultipleLendingLoans merge multiple lending loans

func (*Gateio) ModifyALoan

func (g *Gateio) ModifyALoan(ctx context.Context, loanID string, arg *ModifyLoanRequestParam) (*MarginLoanResponse, error)

ModifyALoan Modify a loan only auto_renew modification is supported currently

func (*Gateio) ModifyALoanRecord

func (g *Gateio) ModifyALoanRecord(ctx context.Context, loanRecordID string, arg *ModifyLoanRequestParam) (*LoanRecord, error)

ModifyALoanRecord modify a loan record Only auto_renew modification is supported currently

func (*Gateio) ModifyOrder

func (g *Gateio) ModifyOrder(_ context.Context, _ *order.Modify) (*order.ModifyResponse, error)

ModifyOrder will allow of changing orderbook placement and limit to market conversion

func (*Gateio) OptionsSubscribe

func (g *Gateio) OptionsSubscribe(channelsToUnsubscribe []subscription.Subscription) error

OptionsSubscribe sends a websocket message to stop receiving data for asset type options

func (*Gateio) OptionsUnsubscribe

func (g *Gateio) OptionsUnsubscribe(channelsToUnsubscribe []subscription.Subscription) error

OptionsUnsubscribe sends a websocket message to stop receiving data for asset type options

func (*Gateio) PlaceBatchFuturesOrders

func (g *Gateio) PlaceBatchFuturesOrders(ctx context.Context, settle string, args []OrderCreateParams) ([]Order, error)

PlaceBatchFuturesOrders creates a list of futures orders Up to 10 orders per request If any of the order's parameters are missing or in the wrong format, all of them will not be executed, and a http status 400 error will be returned directly If the parameters are checked and passed, all are executed. Even if there is a business logic error in the middle (such as insufficient funds), it will not affect other execution orders The returned result is in array format, and the order corresponds to the orders in the request body In the returned result, the succeeded field of type bool indicates whether the execution was successful or not If the execution is successful, the normal order content is included; if the execution fails, the label field is included to indicate the cause of the error In the rate limiting, each order is counted individually

func (*Gateio) PlaceDeliveryOrder

func (g *Gateio) PlaceDeliveryOrder(ctx context.Context, arg *OrderCreateParams) (*Order, error)

PlaceDeliveryOrder create a futures order Zero-filled order cannot be retrieved 10 minutes after order cancellation

func (*Gateio) PlaceFuturesOrder

func (g *Gateio) PlaceFuturesOrder(ctx context.Context, arg *OrderCreateParams) (*Order, error)

PlaceFuturesOrder creates futures order Create a futures order Creating futures orders requires size, which is number of contracts instead of currency amount. You can use quanto_multiplier in contract detail response to know how much currency 1 size contract represents Zero-filled order cannot be retrieved 10 minutes after order cancellation. You will get a 404 not found for such orders Set reduce_only to true can keep the position from changing side when reducing position size In single position mode, to close a position, you need to set size to 0 and close to true In dual position mode, to close one side position, you need to set auto_size side, reduce_only to true and size to 0

func (*Gateio) PlaceOptionOrder

func (g *Gateio) PlaceOptionOrder(ctx context.Context, arg *OptionOrderParam) (*OptionOrderResponse, error)

PlaceOptionOrder creates an options order

func (*Gateio) PlaceSpotOrder

func (g *Gateio) PlaceSpotOrder(ctx context.Context, arg *CreateOrderRequestData) (*SpotOrder, error)

PlaceSpotOrder creates a spot order you can place orders with spot, margin or cross margin account through setting the accountfield. It defaults to spot, which means spot account is used to place orders.

func (*Gateio) PremiumIndexKLine

func (g *Gateio) PremiumIndexKLine(ctx context.Context, settleCurrency string, contract currency.Pair, from, to time.Time, limit int64, interval kline.Interval) ([]FuturesPremiumIndexKLineResponse, error)

PremiumIndexKLine retrieves premium Index K-Line Maximum of 1000 points can be returned in a query. Be sure not to exceed the limit when specifying from, to and interval

func (*Gateio) QueryFuturesAccount

func (g *Gateio) QueryFuturesAccount(ctx context.Context, settle string) (*FuturesAccount, error)

QueryFuturesAccount retrieves futures account

func (*Gateio) RepayALoan

func (g *Gateio) RepayALoan(ctx context.Context, loanID string, arg *RepayLoanRequestParam) (*MarginLoanResponse, error)

RepayALoan execute a loan repay.

func (*Gateio) RetriveOneSingleLoanDetail

func (g *Gateio) RetriveOneSingleLoanDetail(ctx context.Context, side, loanID string) (*MarginLoanResponse, error)

RetriveOneSingleLoanDetail retrieve one single loan detail "side" represents loan side: Lend or Borrow

func (*Gateio) RetrivePositionDetailInDualMode

func (g *Gateio) RetrivePositionDetailInDualMode(ctx context.Context, settle string, contract currency.Pair) ([]Position, error)

RetrivePositionDetailInDualMode retrieve position detail in dual mode

func (*Gateio) SendAuthenticatedHTTPRequest

func (g *Gateio) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, epl request.EndpointLimit, method, endpoint string, param url.Values, data, result interface{}) error

SendAuthenticatedHTTPRequest sends authenticated requests to the Gateio API To use this you must setup an APIKey and APISecret from the exchange

func (*Gateio) SendHTTPRequest

func (g *Gateio) SendHTTPRequest(ctx context.Context, ep exchange.URL, epl request.EndpointLimit, path string, result interface{}) error

SendHTTPRequest sends an unauthenticated HTTP request

func (*Gateio) SetDefaults

func (g *Gateio) SetDefaults()

SetDefaults sets default values for the exchange

func (*Gateio) Setup

func (g *Gateio) Setup(exch *config.Exchange) error

Setup sets user configuration

func (*Gateio) SpotClosePositionWhenCrossCurrencyDisabled

func (g *Gateio) SpotClosePositionWhenCrossCurrencyDisabled(ctx context.Context, arg *ClosePositionRequestParam) (*SpotOrder, error)

SpotClosePositionWhenCrossCurrencyDisabled set close position when cross-currency is disabled

func (*Gateio) SubAccountTransfer

func (g *Gateio) SubAccountTransfer(ctx context.Context, arg SubAccountTransferParam) error

SubAccountTransfer to transfer between main and sub accounts Support transferring with sub user's spot or futures account. Note that only main user's spot account is used no matter which sub user's account is operated.

func (*Gateio) SubAccountTransferToSubAccount

func (g *Gateio) SubAccountTransferToSubAccount(ctx context.Context, arg *InterSubAccountTransferParams) error

SubAccountTransferToSubAccount performs sub-account transfers to sub-account

func (*Gateio) SubmitOrder

func (g *Gateio) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitResponse, error)

SubmitOrder submits a new order TODO: support multiple order types (IOC)

func (*Gateio) SubmitOrders added in v1.0.2

func (g *Gateio) SubmitOrders(ctx context.Context, ss ...*order.Submit) ([]*order.SubmitResponse, error)

func (*Gateio) Subscribe

func (g *Gateio) Subscribe(channelsToUnsubscribe []subscription.Subscription) error

Subscribe sends a websocket message to stop receiving data from the channel

func (*Gateio) TransferCurrency

func (g *Gateio) TransferCurrency(ctx context.Context, arg *TransferCurrencyParam) (*TransactionIDResponse, error)

TransferCurrency Transfer between different accounts. Currently support transfers between the following: spot - margin, spot - futures(perpetual), spot - delivery spot - cross margin, spot - options

func (*Gateio) UnlockSubAccount

func (g *Gateio) UnlockSubAccount(ctx context.Context, subAccountUserID int64) error

UnlockSubAccount locks the sub-account

func (*Gateio) Unsubscribe

func (g *Gateio) Unsubscribe(channelsToUnsubscribe []subscription.Subscription) error

Unsubscribe sends a websocket message to stop receiving data from the channel

func (*Gateio) UpdateAPIKeyOfSubAccount

func (g *Gateio) UpdateAPIKeyOfSubAccount(ctx context.Context, subAccountAPIKey string, arg CreateAPIKeySubAccountParams) error

UpdateAPIKeyOfSubAccount update API key of the sub-account

func (*Gateio) UpdateAccountInfo

func (g *Gateio) UpdateAccountInfo(ctx context.Context, a asset.Item) (account.Holdings, error)

UpdateAccountInfo retrieves balances for all enabled currencies for the

func (*Gateio) UpdateDeliveryPositionLeverage

func (g *Gateio) UpdateDeliveryPositionLeverage(ctx context.Context, settle string, contract currency.Pair, leverage float64) (*Position, error)

UpdateDeliveryPositionLeverage updates position leverage

func (*Gateio) UpdateDeliveryPositionMargin

func (g *Gateio) UpdateDeliveryPositionMargin(ctx context.Context, settle string, change float64, contract currency.Pair) (*Position, error)

UpdateDeliveryPositionMargin updates position margin

func (*Gateio) UpdateDeliveryPositionRiskLimit

func (g *Gateio) UpdateDeliveryPositionRiskLimit(ctx context.Context, settle string, contract currency.Pair, riskLimit uint64) (*Position, error)

UpdateDeliveryPositionRiskLimit update position risk limit

func (*Gateio) UpdateFuturesPositionLeverage

func (g *Gateio) UpdateFuturesPositionLeverage(ctx context.Context, settle string, contract currency.Pair, leverage, crossLeverageLimit float64) (*Position, error)

UpdateFuturesPositionLeverage update position leverage

func (*Gateio) UpdateFuturesPositionMargin

func (g *Gateio) UpdateFuturesPositionMargin(ctx context.Context, settle string, change float64, contract currency.Pair) (*Position, error)

UpdateFuturesPositionMargin represents account position margin for a futures contract.

func (*Gateio) UpdateFuturesPositionRiskLimit

func (g *Gateio) UpdateFuturesPositionRiskLimit(ctx context.Context, settle string, contract currency.Pair, riskLimit uint64) (*Position, error)

UpdateFuturesPositionRiskLimit updates the position risk limit

func (*Gateio) UpdateOrderExecutionLimits

func (g *Gateio) UpdateOrderExecutionLimits(ctx context.Context, a asset.Item) error

UpdateOrderExecutionLimits sets exchange executions for a required asset type

func (*Gateio) UpdateOrderbook

func (g *Gateio) UpdateOrderbook(ctx context.Context, p currency.Pair, a asset.Item) (*orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*Gateio) UpdatePositionLeverageInDualMode

func (g *Gateio) UpdatePositionLeverageInDualMode(ctx context.Context, settle string, contract currency.Pair, leverage, crossLeverageLimit float64) (*Position, error)

UpdatePositionLeverageInDualMode update position leverage in dual mode

func (*Gateio) UpdatePositionMarginInDualMode

func (g *Gateio) UpdatePositionMarginInDualMode(ctx context.Context, settle string, contract currency.Pair, change float64, dualSide string) ([]Position, error)

UpdatePositionMarginInDualMode update position margin in dual mode

func (*Gateio) UpdatePositionRiskLimitInDualMode

func (g *Gateio) UpdatePositionRiskLimitInDualMode(ctx context.Context, settle string, contract currency.Pair, riskLimit float64) ([]Position, error)

UpdatePositionRiskLimitInDualMode update position risk limit in dual mode

func (*Gateio) UpdateTicker

func (g *Gateio) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*Gateio) UpdateTickers

func (g *Gateio) UpdateTickers(ctx context.Context, a asset.Item) error

UpdateTickers updates the ticker for all currency pairs of a given asset type

func (*Gateio) UpdateTradablePairs

func (g *Gateio) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error

UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config

func (*Gateio) UpdateUsersAutoRepaymentSetting

func (g *Gateio) UpdateUsersAutoRepaymentSetting(ctx context.Context, statusOn bool) (*OnOffStatus, error)

UpdateUsersAutoRepaymentSetting represents update user's auto repayment setting

func (*Gateio) ValidateAPICredentials

func (g *Gateio) ValidateAPICredentials(ctx context.Context, assetType asset.Item) error

ValidateAPICredentials validates current credentials used for wrapper functionality

func (*Gateio) WithdrawCryptocurrencyFunds

func (g *Gateio) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*Gateio) WithdrawCurrency

func (g *Gateio) WithdrawCurrency(ctx context.Context, arg WithdrawalRequestParam) (*WithdrawalResponse, error)

WithdrawCurrency to withdraw a currency.

func (*Gateio) WithdrawFiatFunds

func (g *Gateio) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*Gateio) WithdrawFiatFundsToInternationalBank

func (g *Gateio) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

func (*Gateio) WsConnect

func (g *Gateio) WsConnect() error

WsConnect initiates a websocket connection

func (*Gateio) WsDeliveryFuturesConnect

func (g *Gateio) WsDeliveryFuturesConnect() error

WsDeliveryFuturesConnect initiates a websocket connection for delivery futures account

func (*Gateio) WsFuturesConnect

func (g *Gateio) WsFuturesConnect() error

WsFuturesConnect initiates a websocket connection for futures account

func (*Gateio) WsOptionsConnect

func (g *Gateio) WsOptionsConnect() error

WsOptionsConnect initiates a websocket connection to options websocket endpoints.

type IndexConstituent

type IndexConstituent struct {
	Index        string `json:"index"`
	Constituents []struct {
		Exchange string   `json:"exchange"`
		Symbols  []string `json:"symbols"`
	} `json:"constituents"`
}

IndexConstituent represents index constituents

type InitFlashSwapOrderPreviewResponse

type InitFlashSwapOrderPreviewResponse struct {
	PreviewID    string       `json:"preview_id"`
	SellCurrency string       `json:"sell_currency"`
	SellAmount   types.Number `json:"sell_amount"`
	BuyCurrency  string       `json:"buy_currency"`
	BuyAmount    types.Number `json:"buy_amount"`
	Price        types.Number `json:"price"`
}

InitFlashSwapOrderPreviewResponse represents the order preview for flash order

type InsuranceBalance

type InsuranceBalance struct {
	Timestamp gateioTime `json:"t"`
	Balance   float64    `json:"b"`
}

InsuranceBalance represents futures insurance balance item.

type InterSubAccountTransferParams

type InterSubAccountTransferParams struct {
	Currency                currency.Code `json:"currency"` // Required
	SubAccountType          string        `json:"sub_account_type"`
	SubAccountFromUserID    string        `json:"sub_account_from"`      // Required
	SubAccountFromAssetType asset.Item    `json:"sub_account_from_type"` // Required
	SubAccountToUserID      string        `json:"sub_account_to"`        // Required
	SubAccountToAssetType   asset.Item    `json:"sub_account_to_type"`   // Required
	Amount                  types.Number  `json:"amount"`                // Required
}

InterSubAccountTransferParams represents parameters to transfer funds between sub-accounts.

type LiquidationHistory

type LiquidationHistory struct {
	Time             gateioTime   `json:"time"`
	Contract         string       `json:"contract"`
	Size             int64        `json:"size"`
	Leverage         string       `json:"leverage"`
	Margin           string       `json:"margin"`
	EntryPrice       types.Number `json:"entry_price"`
	LiquidationPrice types.Number `json:"liq_price"`
	MarkPrice        types.Number `json:"mark_price"`
	OrderID          int64        `json:"order_id"`
	OrderPrice       types.Number `json:"order_price"`
	FillPrice        types.Number `json:"fill_price"`
	Left             int64        `json:"left"`
}

LiquidationHistory represents liquidation history for a specifies settle.

type LiquidationHistoryItem

type LiquidationHistoryItem struct {
	Time       gateioTime   `json:"time"`
	Contract   string       `json:"contract"`
	Size       int64        `json:"size"`
	Leverage   types.Number `json:"leverage"`
	Margin     string       `json:"margin"`
	EntryPrice types.Number `json:"entry_price"`
	MarkPrice  types.Number `json:"mark_price"`
	OrderPrice types.Number `json:"order_price"`
	FillPrice  types.Number `json:"fill_price"`
	LiqPrice   types.Number `json:"liq_price"`
	OrderID    int64        `json:"order_id"`
	Left       int64        `json:"left"`
}

LiquidationHistoryItem liquidation history item

type LoanRecord

type LoanRecord struct {
	ID             string       `json:"id"`
	LoanID         string       `json:"loan_id"`
	CreateTime     gateioTime   `json:"create_time"`
	ExpireTime     gateioTime   `json:"expire_time"`
	Status         string       `json:"status"`
	BorrowUserID   string       `json:"borrow_user_id"`
	Currency       string       `json:"currency"`
	Rate           types.Number `json:"rate"`
	Amount         types.Number `json:"amount"`
	Days           int64        `json:"days"`
	AutoRenew      bool         `json:"auto_renew"`
	Repaid         types.Number `json:"repaid"`
	PaidInterest   types.Number `json:"paid_interest"`
	UnpaidInterest types.Number `json:"unpaid_interest"`
}

LoanRecord represents loan repayment specific record

type LoanRepaymentRecord

type LoanRepaymentRecord struct {
	ID         string     `json:"id"`
	CreateTime gateioTime `json:"create_time"`
	Principal  string     `json:"principal"`
	Interest   string     `json:"interest"`
}

LoanRepaymentRecord represents loan repayment history record item.

type MarginAccountBalanceChangeInfo

type MarginAccountBalanceChangeInfo struct {
	ID            string     `json:"id"`
	Time          gateioTime `json:"time"`
	TimeMs        gateioTime `json:"time_ms"`
	Currency      string     `json:"currency"`
	CurrencyPair  string     `json:"currency_pair"`
	AmountChanged string     `json:"change"`
	Balance       string     `json:"balance"`
}

MarginAccountBalanceChangeInfo represents margin account balance

type MarginAccountItem

type MarginAccountItem struct {
	Locked       bool                      `json:"locked"`
	CurrencyPair string                    `json:"currency_pair"`
	Risk         string                    `json:"risk"`
	Base         AccountBalanceInformation `json:"base"`
	Quote        AccountBalanceInformation `json:"quote"`
}

MarginAccountItem margin account item

type MarginCurrencyBalance

type MarginCurrencyBalance struct {
	Currency       string       `json:"currency"`
	Available      types.Number `json:"available"`
	Locked         types.Number `json:"locked"`
	BorrowedAmount types.Number `json:"borrowed"`
	UnpairInterest types.Number `json:"interest"`
}

MarginCurrencyBalance represents a currency balance detail information.

type MarginCurrencyPairInfo

type MarginCurrencyPairInfo struct {
	ID             string       `json:"id"`
	Base           string       `json:"base"`
	Quote          string       `json:"quote"`
	Leverage       float64      `json:"leverage"`
	MinBaseAmount  types.Number `json:"min_base_amount"`
	MinQuoteAmount types.Number `json:"min_quote_amount"`
	MaxQuoteAmount types.Number `json:"max_quote_amount"`
	Status         int32        `json:"status"`
}

MarginCurrencyPairInfo represents margin currency pair detailed info.

type MarginFundingAccountItem

type MarginFundingAccountItem struct {
	Currency     string       `json:"currency"`
	Available    types.Number `json:"available"`
	LockedAmount types.Number `json:"locked"`
	Lent         string       `json:"lent"`       // Outstanding loan amount yet to be repaid
	TotalLent    string       `json:"total_lent"` // Amount used for lending. total_lent = lent + locked
}

MarginFundingAccountItem represents funding account list item.

type MarginLoanRequestParam

type MarginLoanRequestParam struct {
	Side         string        `json:"side"`
	Currency     currency.Code `json:"currency"`
	Rate         types.Number  `json:"rate,omitempty"`
	Amount       types.Number  `json:"amount,omitempty"`
	Days         int64         `json:"days,omitempty"`
	AutoRenew    bool          `json:"auto_renew,omitempty"`
	CurrencyPair currency.Pair `json:"currency_pair,omitempty"`
	FeeRate      types.Number  `json:"fee_rate,omitempty"`
	OrigID       string        `json:"orig_id,omitempty"`
	Text         string        `json:"text,omitempty"`
}

MarginLoanRequestParam represents margin lend or borrow request param

type MarginLoanResponse

type MarginLoanResponse struct {
	ID             string       `json:"id"`
	OrigID         string       `json:"orig_id,omitempty"`
	Side           string       `json:"side"`
	Currency       string       `json:"currency"`
	Amount         types.Number `json:"amount"`
	Rate           types.Number `json:"rate"`
	Days           int64        `json:"days,omitempty"`
	AutoRenew      bool         `json:"auto_renew,omitempty"`
	CurrencyPair   string       `json:"currency_pair,omitempty"`
	FeeRate        types.Number `json:"fee_rate"`
	Text           string       `json:"text,omitempty"`
	CreateTime     gateioTime   `json:"create_time"`
	ExpireTime     gateioTime   `json:"expire_time"`
	Status         string       `json:"status"`
	Left           types.Number `json:"left"`
	Repaid         types.Number `json:"repaid"`
	PaidInterest   types.Number `json:"paid_interest"`
	UnpaidInterest types.Number `json:"unpaid_interest"`
}

MarginLoanResponse represents lending or borrow response.

type MaxTransferAndLoanAmount

type MaxTransferAndLoanAmount struct {
	Currency     string       `json:"currency"`
	CurrencyPair string       `json:"currency_pair"`
	Amount       types.Number `json:"amount"`
}

MaxTransferAndLoanAmount represents the maximum amount to transfer, borrow, or lend for specific currency and currency pair

type ModifyLoanRequestParam

type ModifyLoanRequestParam struct {
	Currency     currency.Code `json:"currency"`
	Side         string        `json:"side"`
	CurrencyPair currency.Pair `json:"currency_pair"`
	AutoRenew    bool          `json:"auto_renew"`
	LoanID       string        `json:"loan_id"`
}

ModifyLoanRequestParam represents request parameters for modify loan request

type MultiChainAddressItem

type MultiChainAddressItem struct {
	Chain        string `json:"chain"`
	Address      string `json:"address"`
	PaymentID    string `json:"payment_id"`
	PaymentName  string `json:"payment_name"`
	ObtainFailed int64  `json:"obtain_failed"`
}

MultiChainAddressItem represents a multi-chain address item

type MyOptionSettlement

type MyOptionSettlement struct {
	Size         float64      `json:"size"`
	SettleProfit types.Number `json:"settle_profit"`
	Contract     string       `json:"contract"`
	StrikePrice  types.Number `json:"strike_price"`
	Time         gateioTime   `json:"time"`
	SettlePrice  types.Number `json:"settle_price"`
	Underlying   string       `json:"underlying"`
	RealisedPnl  string       `json:"realised_pnl"`
	Fee          types.Number `json:"fee"`
}

MyOptionSettlement represents option private settlement

type OnOffStatus

type OnOffStatus struct {
	Status string `json:"status"`
}

OnOffStatus represents on or off status response status

type OptionAccount

type OptionAccount struct {
	User          int64        `json:"user"`
	Currency      string       `json:"currency"`
	ShortEnabled  bool         `json:"short_enabled"`
	Total         types.Number `json:"total"`
	UnrealisedPnl string       `json:"unrealised_pnl"`
	InitMargin    string       `json:"init_margin"`
	MaintMargin   string       `json:"maint_margin"`
	OrderMargin   string       `json:"order_margin"`
	Available     types.Number `json:"available"`
	Point         string       `json:"point"`
}

OptionAccount represents option account.

type OptionContract

type OptionContract struct {
	Name              string       `json:"name"`
	Tag               string       `json:"tag"`
	IsCall            bool         `json:"is_call"`
	StrikePrice       types.Number `json:"strike_price"`
	LastPrice         types.Number `json:"last_price"`
	MarkPrice         types.Number `json:"mark_price"`
	OrderbookID       int64        `json:"orderbook_id"`
	TradeID           int64        `json:"trade_id"`
	TradeSize         int64        `json:"trade_size"`
	PositionSize      int64        `json:"position_size"`
	Underlying        string       `json:"underlying"`
	UnderlyingPrice   types.Number `json:"underlying_price"`
	Multiplier        string       `json:"multiplier"`
	OrderPriceRound   string       `json:"order_price_round"`
	MarkPriceRound    string       `json:"mark_price_round"`
	MakerFeeRate      string       `json:"maker_fee_rate"`
	TakerFeeRate      string       `json:"taker_fee_rate"`
	PriceLimitFeeRate string       `json:"price_limit_fee_rate"`
	RefDiscountRate   string       `json:"ref_discount_rate"`
	RefRebateRate     string       `json:"ref_rebate_rate"`
	OrderPriceDeviate string       `json:"order_price_deviate"`
	OrderSizeMin      int64        `json:"order_size_min"`
	OrderSizeMax      int64        `json:"order_size_max"`
	OrdersLimit       int64        `json:"orders_limit"`
	CreateTime        gateioTime   `json:"create_time"`
	ExpirationTime    gateioTime   `json:"expiration_time"`
}

OptionContract represents an option contract detail.

type OptionOrderParam

type OptionOrderParam struct {
	OrderSize   float64      `json:"size"`              // Order size. Specify positive number to make a bid, and negative number to ask
	Iceberg     float64      `json:"iceberg,omitempty"` // Display size for iceberg order. 0 for non-iceberg. Note that you will have to pay the taker fee for the hidden size
	Contract    string       `json:"contract"`
	Text        string       `json:"text,omitempty"`
	TimeInForce string       `json:"tif,omitempty"`
	Price       types.Number `json:"price,omitempty"`
	// Close Set as true to close the position, with size set to 0
	Close      bool `json:"close,omitempty"`
	ReduceOnly bool `json:"reduce_only,omitempty"`
}

OptionOrderParam represents option order request body

type OptionOrderResponse

type OptionOrderResponse struct {
	Status               string       `json:"status"`
	Size                 float64      `json:"size"`
	OptionOrderID        int64        `json:"id"`
	Iceberg              int64        `json:"iceberg"`
	IsOrderLiquidation   bool         `json:"is_liq"`
	IsOrderPositionClose bool         `json:"is_close"`
	Contract             string       `json:"contract"`
	Text                 string       `json:"text"`
	FillPrice            types.Number `json:"fill_price"`
	FinishAs             string       `json:"finish_as"` //  finish_as 	filled, cancelled, liquidated, ioc, auto_deleveraged, reduce_only, position_closed, reduce_out
	Left                 float64      `json:"left"`
	TimeInForce          string       `json:"tif"`
	IsReduceOnly         bool         `json:"is_reduce_only"`
	CreateTime           gateioTime   `json:"create_time"`
	FinishTime           gateioTime   `json:"finish_time"`
	Price                types.Number `json:"price"`

	TakerFee        types.Number `json:"tkrf"`
	MakerFee        types.Number `json:"mkrf"`
	ReferenceUserID string       `json:"refu"`
}

OptionOrderResponse represents option order response detail

type OptionSettlement

type OptionSettlement struct {
	Timestamp   gateioTime   `json:"time"`
	Profit      types.Number `json:"profit"`
	Fee         types.Number `json:"fee"`
	SettlePrice types.Number `json:"settle_price"`
	Contract    string       `json:"contract"`
	StrikePrice types.Number `json:"strike_price"`
}

OptionSettlement list settlement history

type OptionTradingHistory

type OptionTradingHistory struct {
	ID              int64        `json:"id"`
	UnderlyingPrice types.Number `json:"underlying_price"`
	Size            float64      `json:"size"`
	Contract        string       `json:"contract"`
	TradeRole       string       `json:"role"`
	CreateTime      gateioTime   `json:"create_time"`
	OrderID         int64        `json:"order_id"`
	Price           types.Number `json:"price"`
}

OptionTradingHistory list personal trading history

type OptionUnderlying

type OptionUnderlying struct {
	Name       string       `json:"name"`
	IndexPrice types.Number `json:"index_price"`
	IndexTime  gateioTime   `json:"index_time"`
}

OptionUnderlying represents option underlying and it's index price.

type OptionsTicker

type OptionsTicker struct {
	Name                  currency.Pair `json:"name"`
	LastPrice             types.Number  `json:"last_price"`
	MarkPrice             types.Number  `json:"mark_price"`
	PositionSize          float64       `json:"position_size"`
	Ask1Size              float64       `json:"ask1_size"`
	Ask1Price             types.Number  `json:"ask1_price"`
	Bid1Size              float64       `json:"bid1_size"`
	Bid1Price             types.Number  `json:"bid1_price"`
	Vega                  string        `json:"vega"`
	Theta                 string        `json:"theta"`
	Rho                   string        `json:"rho"`
	Gamma                 string        `json:"gamma"`
	Delta                 string        `json:"delta"`
	MarkImpliedVolatility types.Number  `json:"mark_iv"`
	BidImpliedVolatility  types.Number  `json:"bid_iv"`
	AskImpliedVolatility  types.Number  `json:"ask_iv"`
	Leverage              types.Number  `json:"leverage"`

	// Added fields for the websocket
	IndexPrice types.Number `json:"index_price"`
}

OptionsTicker represents tickers of options contracts

type OptionsUnderlyingTicker

type OptionsUnderlyingTicker struct {
	TradePut   float64      `json:"trade_put"`
	TradeCall  float64      `json:"trade_call"`
	IndexPrice types.Number `json:"index_price"`
}

OptionsUnderlyingTicker represents underlying ticker

type Order

type Order struct {
	ID                    int64        `json:"id"`
	User                  int64        `json:"user"`
	Contract              string       `json:"contract"`
	CreateTime            gateioTime   `json:"create_time"`
	Size                  float64      `json:"size"`
	Iceberg               int64        `json:"iceberg"`
	RemainingAmount       float64      `json:"left"` // Size left to be traded
	OrderPrice            types.Number `json:"price"`
	FillPrice             types.Number `json:"fill_price"` // Fill price of the order. total filled in quote currency.
	MakerFee              string       `json:"mkfr"`
	TakerFee              string       `json:"tkfr"`
	TimeInForce           string       `json:"tif"`
	ReferenceUserID       int64        `json:"refu"`
	IsReduceOnly          bool         `json:"is_reduce_only"`
	IsClose               bool         `json:"is_close"`
	IsOrderForLiquidation bool         `json:"is_liq"`
	Text                  string       `json:"text"`
	Status                string       `json:"status"`
	FinishTime            gateioTime   `json:"finish_time"`
	FinishAs              string       `json:"finish_as"`
}

Order represents future order response

type OrderCreateParams

type OrderCreateParams struct {
	Contract      currency.Pair `json:"contract"`
	Size          float64       `json:"size"`
	Iceberg       int64         `json:"iceberg"`
	Price         string        `json:"price"` // NOTE: Market orders require string "0"
	TimeInForce   string        `json:"tif"`
	Text          string        `json:"text"`
	ClosePosition bool          `json:"close,omitempty"`
	ReduceOnly    bool          `json:"reduce_only,omitempty"`
	AutoSize      string        `json:"auto_size,omitempty"`
	Settle        string        `json:"-"` // Used in URL.
}

OrderCreateParams represents future order creation parameters

type OrderID

type OrderID struct {
	ID int64 `json:"id"`
}

OrderID represents order creation ID response.

type Orderbook

type Orderbook struct {
	ID      int64           `json:"id"`
	Current gateioTime      `json:"current"` // The timestamp of the response data being generated (in milliseconds)
	Update  gateioTime      `json:"update"`  // The timestamp of when the orderbook last changed (in milliseconds)
	Bids    []OrderbookItem `json:"bids"`
	Asks    []OrderbookItem `json:"asks"`
}

Orderbook stores the orderbook data

type OrderbookData

type OrderbookData struct {
	ID      int64       `json:"id"`
	Current gateioTime  `json:"current"` // The timestamp of the response data being generated (in milliseconds)
	Update  gateioTime  `json:"update"`  // The timestamp of when the orderbook last changed (in milliseconds)
	Asks    [][2]string `json:"asks"`
	Bids    [][2]string `json:"bids"`
}

OrderbookData holds orderbook ask and bid datas.

func (*OrderbookData) MakeOrderbook

func (a *OrderbookData) MakeOrderbook() (*Orderbook, error)

MakeOrderbook parse Orderbook asks/bids Price and Amount and create an Orderbook Instance with asks and bids data in []OrderbookItem.

type OrderbookItem

type OrderbookItem struct {
	Price  types.Number `json:"p"`
	Amount float64      `json:"s"`
}

OrderbookItem stores an orderbook item

type OrderbookOfLendingLoan

type OrderbookOfLendingLoan struct {
	Rate   types.Number `json:"rate"`
	Amount types.Number `json:"amount"`
	Days   int64        `json:"days"`
}

OrderbookOfLendingLoan represents order book of lending loans

type PersonalTradingFee

type PersonalTradingFee struct {
	UserID          int64        `json:"user_id"`
	TakerFee        types.Number `json:"taker_fee"`
	MakerFee        types.Number `json:"maker_fee"`
	GtDiscount      bool         `json:"gt_discount"`
	GtTakerFee      types.Number `json:"gt_taker_fee"`
	GtMakerFee      types.Number `json:"gt_maker_fee"`
	LoanFee         types.Number `json:"loan_fee"`
	PointType       string       `json:"point_type"`
	FuturesTakerFee types.Number `json:"futures_taker_fee"`
	FuturesMakerFee types.Number `json:"futures_maker_fee"`
}

PersonalTradingFee represents personal trading fee for specific currency pair

type Position

type Position struct {
	User            int64        `json:"user"`
	Contract        string       `json:"contract"`
	Size            int64        `json:"size"`
	Leverage        types.Number `json:"leverage"`
	RiskLimit       types.Number `json:"risk_limit"`
	LeverageMax     types.Number `json:"leverage_max"`
	MaintenanceRate types.Number `json:"maintenance_rate"`
	Value           types.Number `json:"value"`
	Margin          types.Number `json:"margin"`
	EntryPrice      types.Number `json:"entry_price"`
	LiqPrice        types.Number `json:"liq_price"`
	MarkPrice       types.Number `json:"mark_price"`
	UnrealisedPnl   types.Number `json:"unrealised_pnl"`
	RealisedPnl     types.Number `json:"realised_pnl"`
	HistoryPnl      types.Number `json:"history_pnl"`
	LastClosePnl    types.Number `json:"last_close_pnl"`
	RealisedPoint   types.Number `json:"realised_point"`
	HistoryPoint    types.Number `json:"history_point"`
	AdlRanking      int64        `json:"adl_ranking"`
	PendingOrders   int64        `json:"pending_orders"`
	CloseOrder      struct {
		ID    int64        `json:"id"`
		Price types.Number `json:"price"`
		IsLiq bool         `json:"is_liq"`
	} `json:"close_order"`
	Mode               string `json:"mode"`
	CrossLeverageLimit string `json:"cross_leverage_limit"`
}

Position represents futures position

type PositionCloseHistoryResponse

type PositionCloseHistoryResponse struct {
	Time          gateioTime   `json:"time"`
	ProfitAndLoss types.Number `json:"pnl"`
	Side          string       `json:"side"`
	Contract      string       `json:"contract"`
	Text          string       `json:"text"`
}

PositionCloseHistoryResponse represents a close position history detail

type PriceAndAmount

type PriceAndAmount struct {
	Amount types.Number `json:"amount,omitempty"`
	Price  types.Number `json:"price,omitempty"`
}

PriceAndAmount used in updating an order

type PriceTriggeredOrder

type PriceTriggeredOrder struct {
	Initial struct {
		Contract string       `json:"contract"`
		Size     float64      `json:"size"`
		Price    types.Number `json:"price"`
	} `json:"initial"`
	Trigger struct {
		StrategyType int64        `json:"strategy_type"`
		PriceType    int64        `json:"price_type"`
		Price        types.Number `json:"price"`
		Rule         int64        `json:"rule"`
		Expiration   int64        `json:"expiration"`
	} `json:"trigger"`
	ID         int64      `json:"id"`
	User       int64      `json:"user"`
	CreateTime gateioTime `json:"create_time"`
	FinishTime gateioTime `json:"finish_time"`
	TradeID    int64      `json:"trade_id"`
	Status     string     `json:"status"`
	FinishAs   string     `json:"finish_as"`
	Reason     string     `json:"reason"`
	OrderType  string     `json:"order_type"`
}

PriceTriggeredOrder represents a future triggered price order response

type PriceTriggeredOrderParam

type PriceTriggeredOrderParam struct {
	Trigger TriggerPriceInfo `json:"trigger"`
	Put     PutOrderData     `json:"put"`
	Market  currency.Pair    `json:"market"`
}

PriceTriggeredOrderParam represents price triggered order request.

type PutOrderData

type PutOrderData struct {
	Type        string       `json:"type"`
	Side        string       `json:"side"`
	Price       types.Number `json:"price"`
	Amount      types.Number `json:"amount"`
	Account     string       `json:"account"`
	TimeInForce string       `json:"time_in_force,omitempty"`
}

PutOrderData represents order detail for price triggered order request

type RateLimitter

type RateLimitter struct {
	SpotDefault               *rate.Limiter
	SpotPrivate               *rate.Limiter
	SpotPlaceOrders           *rate.Limiter
	SpotCancelOrders          *rate.Limiter
	PerpetualSwapDefault      *rate.Limiter
	PerpetualSwapPlaceOrders  *rate.Limiter
	PerpetualSwapPrivate      *rate.Limiter
	PerpetualSwapCancelOrders *rate.Limiter
	Wallet                    *rate.Limiter
	Withdrawal                *rate.Limiter
}

RateLimitter represents a rate limiter structure for gateIO endpoints.

func SetRateLimit

func SetRateLimit() *RateLimitter

SetRateLimit returns the rate limiter for the exchange

func (*RateLimitter) Limit

Limit executes rate limiting functionality implements the request.Limiter interface

type RepayLoanRequestParam

type RepayLoanRequestParam struct {
	CurrencyPair currency.Pair `json:"currency_pair"`
	Currency     currency.Code `json:"currency"`
	Mode         string        `json:"mode"`
	Amount       types.Number  `json:"amount"`
}

RepayLoanRequestParam represents loan repay request parameters

type RepaymentHistoryItem

type RepaymentHistoryItem struct {
	ID         string       `json:"id"`
	CreateTime gateioTime   `json:"create_time"`
	LoanID     string       `json:"loan_id"`
	Currency   string       `json:"currency"`
	Principal  types.Number `json:"principal"`
	Interest   types.Number `json:"interest"`
}

RepaymentHistoryItem represents an item in a repayment history.

type SettlementHistoryItem

type SettlementHistoryItem struct {
	Time        gateioTime   `json:"time"`
	Contract    string       `json:"contract"`
	Size        int64        `json:"size"`
	Leverage    string       `json:"leverage"`
	Margin      string       `json:"margin"`
	EntryPrice  types.Number `json:"entry_price"`
	SettlePrice types.Number `json:"settle_price"`
	Profit      types.Number `json:"profit"`
	Fee         types.Number `json:"fee"`
}

SettlementHistoryItem represents a settlement history item

type SpotAccount

type SpotAccount struct {
	Currency  string       `json:"currency"`
	Available types.Number `json:"available"`
	Locked    types.Number `json:"locked"`
}

SpotAccount represents spot account

type SpotOrder

type SpotOrder struct {
	OrderID            string       `json:"id,omitempty"`
	Text               string       `json:"text,omitempty"`
	Succeeded          bool         `json:"succeeded"`
	ErrorLabel         string       `json:"label,omitempty"`
	Message            string       `json:"message,omitempty"`
	CreateTime         gateioTime   `json:"create_time,omitempty"`
	CreateTimeMs       gateioTime   `json:"create_time_ms,omitempty"`
	UpdateTime         gateioTime   `json:"update_time,omitempty"`
	UpdateTimeMs       gateioTime   `json:"update_time_ms,omitempty"`
	CurrencyPair       string       `json:"currency_pair,omitempty"`
	Status             string       `json:"status,omitempty"`
	Type               string       `json:"type,omitempty"`
	Account            string       `json:"account,omitempty"`
	Side               string       `json:"side,omitempty"`
	Amount             types.Number `json:"amount,omitempty"`
	Price              types.Number `json:"price,omitempty"`
	TimeInForce        string       `json:"time_in_force,omitempty"`
	Iceberg            string       `json:"iceberg,omitempty"`
	AutoRepay          bool         `json:"auto_repay"`
	AutoBorrow         bool         `json:"auto_borrow"`
	Left               types.Number `json:"left"`
	AverageFillPrice   types.Number `json:"avg_deal_price"`
	FeeDeducted        types.Number `json:"fee"`
	FeeCurrency        string       `json:"fee_currency"`
	FillPrice          types.Number `json:"fill_price"`   // Total filled in quote currency. Deprecated in favor of filled_total
	FilledTotal        types.Number `json:"filled_total"` // Total filled in quote currency
	PointFee           types.Number `json:"point_fee"`
	GtFee              string       `json:"gt_fee,omitempty"`
	GtDiscount         bool         `json:"gt_discount"`
	GtMakerFee         types.Number `json:"gt_maker_fee"`
	GtTakerFee         types.Number `json:"gt_taker_fee"`
	RebatedFee         types.Number `json:"rebated_fee"`
	RebatedFeeCurrency string       `json:"rebated_fee_currency"`
}

SpotOrder represents create order response.

type SpotOrdersDetail

type SpotOrdersDetail struct {
	CurrencyPair string      `json:"currency_pair"`
	Total        float64     `json:"total"`
	Orders       []SpotOrder `json:"orders"`
}

SpotOrdersDetail represents list of orders for specific currency pair

type SpotPersonalTradeHistory

type SpotPersonalTradeHistory struct {
	TradeID      string       `json:"id"`
	CreateTime   gateioTime   `json:"create_time"`
	CreateTimeMs gateioTime   `json:"create_time_ms"`
	CurrencyPair string       `json:"currency_pair"`
	OrderID      string       `json:"order_id"`
	Side         string       `json:"side"`
	Role         string       `json:"role"`
	Amount       types.Number `json:"amount"`
	Price        types.Number `json:"price"`
	Fee          types.Number `json:"fee"`
	FeeCurrency  string       `json:"fee_currency"`
	PointFee     string       `json:"point_fee"`
	GtFee        string       `json:"gt_fee"`
}

SpotPersonalTradeHistory represents personal trading history.

type SpotPriceTriggeredOrder

type SpotPriceTriggeredOrder struct {
	Trigger      TriggerPriceInfo `json:"trigger"`
	Put          PutOrderData     `json:"put"`
	AutoOrderID  int64            `json:"id"`
	UserID       int64            `json:"user"`
	CreationTime gateioTime       `json:"ctime"`
	FireTime     gateioTime       `json:"ftime"`
	FiredOrderID int64            `json:"fired_order_id"`
	Status       string           `json:"status"`
	Reason       string           `json:"reason"`
	Market       string           `json:"market"`
}

SpotPriceTriggeredOrder represents spot price triggered order response data.

type SpotTradingFeeRate

type SpotTradingFeeRate struct {
	UserID          int64        `json:"user_id"`
	TakerFee        types.Number `json:"taker_fee"`
	MakerFee        types.Number `json:"maker_fee"`
	GtDiscount      bool         `json:"gt_discount"`
	GtTakerFee      types.Number `json:"gt_taker_fee"`
	GtMakerFee      types.Number `json:"gt_maker_fee"`
	FuturesTakerFee types.Number `json:"futures_taker_fee"`
	FuturesMakerFee types.Number `json:"futures_maker_fee"`
	LoanFee         types.Number `json:"loan_fee"`
	PointType       string       `json:"point_type"`
}

SpotTradingFeeRate user trading fee rates

type SubAccount

type SubAccount struct {
	Remark          string     `json:"remark"`     // custom text
	LoginName       string     `json:"login_name"` // SubAccount login name
	Password        string     `json:"password"`   // The sub-account's password
	SubAccountEmail string     `json:"email"`      // The sub-account's email
	UserID          int64      `json:"user_id"`
	State           int64      `json:"state"`
	CreateTime      gateioTime `json:"create_time"`
}

SubAccount represents a subaccount response

type SubAccountCrossMarginInfo

type SubAccountCrossMarginInfo struct {
	UID       string `json:"uid"`
	Available struct {
		UserID                     int64                         `json:"user_id"`
		Locked                     bool                          `json:"locked"`
		Total                      types.Number                  `json:"total"`
		Borrowed                   types.Number                  `json:"borrowed"`
		Interest                   types.Number                  `json:"interest"` // Total unpaid interests in USDT, i.e., the sum of all currencies' interest*price*discount
		BorrowedNet                string                        `json:"borrowed_net"`
		TotalNetAssets             types.Number                  `json:"net"`
		Leverage                   types.Number                  `json:"leverage"`
		Risk                       string                        `json:"risk"`
		TotalInitialMargin         types.Number                  `json:"total_initial_margin"`
		TotalMarginBalance         types.Number                  `json:"total_margin_balance"`
		TotalMaintenanceMargin     types.Number                  `json:"total_maintenance_margin"`
		TotalInitialMarginRate     types.Number                  `json:"total_initial_margin_rate"`
		TotalMaintenanceMarginRate types.Number                  `json:"total_maintenance_margin_rate"`
		TotalAvailableMargin       types.Number                  `json:"total_available_margin"`
		CurrencyBalances           map[string]CrossMarginBalance `json:"balances"`
	} `json:"available"`
}

SubAccountCrossMarginInfo represents subaccount's cross_margin account info

type SubAccountKey

type SubAccountKey struct {
	APIKeyName  string         `json:"name,omitempty"`
	Permissions []APIV4KeyPerm `json:"perms,omitempty"`
}

SubAccountKey represents sub-account key detail information this is a struct to be used for outbound requests.

type SubAccountMarginBalance

type SubAccountMarginBalance struct {
	UID       string `json:"uid"`
	Available []struct {
		CurrencyPair string                `json:"currency_pair"`
		Locked       bool                  `json:"locked"`
		Risk         string                `json:"risk"`
		Base         MarginCurrencyBalance `json:"base"`
		Quote        MarginCurrencyBalance `json:"quote"`
	} `json:"available"`
}

SubAccountMarginBalance represents sub account margin balance for specific sub account and several currencies

type SubAccountParams

type SubAccountParams struct {
	LoginName string `json:"login_name"`
	Remark    string `json:"remark,omitempty"`
	Email     string `json:"email,omitempty"`    // The sub-account's password.
	Password  string `json:"password,omitempty"` // The sub-account's email address.
}

SubAccountParams represents subaccount creation parameters

type SubAccountTransferParam

type SubAccountTransferParam struct {
	Currency       currency.Code `json:"currency"`
	SubAccount     string        `json:"sub_account"`
	Direction      string        `json:"direction"`
	Amount         types.Number  `json:"amount"`
	SubAccountType string        `json:"sub_account_type"`
}

SubAccountTransferParam represents currency subaccount transfer request param

type SubAccountTransferResponse

type SubAccountTransferResponse struct {
	MainAccountUserID string       `json:"uid"`
	Timestamp         gateioTime   `json:"timest"`
	Source            string       `json:"source"`
	Currency          string       `json:"currency"`
	SubAccount        string       `json:"sub_account"`
	TransferDirection string       `json:"direction"`
	Amount            types.Number `json:"amount"`
	SubAccountType    string       `json:"sub_account_type"`
}

SubAccountTransferResponse represents transfer records between main and sub accounts

type SwapCurrencies

type SwapCurrencies struct {
	Currency  string       `json:"currency"`
	MinAmount types.Number `json:"min_amount"`
	MaxAmount types.Number `json:"max_amount"`
	Swappable []string     `json:"swappable"`
}

SwapCurrencies represents Flash Swap supported currencies

type Ticker

type Ticker struct {
	CurrencyPair     string       `json:"currency_pair"`
	Last             types.Number `json:"last"`
	LowestAsk        types.Number `json:"lowest_ask"`
	HighestBid       types.Number `json:"highest_bid"`
	ChangePercentage string       `json:"change_percentage"`
	ChangeUtc0       string       `json:"change_utc0"`
	ChangeUtc8       string       `json:"change_utc8"`
	BaseVolume       types.Number `json:"base_volume"`
	QuoteVolume      types.Number `json:"quote_volume"`
	High24H          types.Number `json:"high_24h"`
	Low24H           types.Number `json:"low_24h"`
	EtfNetValue      string       `json:"etf_net_value"`
	EtfPreNetValue   string       `json:"etf_pre_net_value"`
	EtfPreTimestamp  gateioTime   `json:"etf_pre_timestamp"`
	EtfLeverage      types.Number `json:"etf_leverage"`
}

Ticker holds detail ticker information for a currency pair

type Trade

type Trade struct {
	ID           int64        `json:"id,string"`
	TradingTime  gateioTime   `json:"create_time"`
	CreateTimeMs gateioTime   `json:"create_time_ms"`
	OrderID      string       `json:"order_id"`
	Side         string       `json:"side"`
	Role         string       `json:"role"`
	Amount       types.Number `json:"amount"`
	Price        types.Number `json:"price"`
	Fee          types.Number `json:"fee"`
	FeeCurrency  string       `json:"fee_currency"`
	PointFee     string       `json:"point_fee"`
	GtFee        string       `json:"gt_fee"`
}

Trade represents market trade.

type TradingHistoryItem

type TradingHistoryItem struct {
	ID         int64        `json:"id"`
	CreateTime gateioTime   `json:"create_time"`
	Contract   string       `json:"contract"`
	Text       string       `json:"text"`
	Size       float64      `json:"size"`
	Price      types.Number `json:"price"`
	// Added for Derived market trade history datas.
	Fee      types.Number `json:"fee"`
	PointFee types.Number `json:"point_fee"`
	Role     string       `json:"role"`
}

TradingHistoryItem represents futures trading history item.

type TransactionIDResponse

type TransactionIDResponse struct {
	TransactionID int64 `json:"tx_id"`
}

TransactionIDResponse represents transaction ID

type TransferCurrencyParam

type TransferCurrencyParam struct {
	Currency     currency.Code `json:"currency"`
	From         string        `json:"from"`
	To           string        `json:"to"`
	Amount       types.Number  `json:"amount"`
	CurrencyPair currency.Pair `json:"currency_pair"`
	Settle       string        `json:"settle"`
}

TransferCurrencyParam represents currency transfer.

type TriggerPriceInfo

type TriggerPriceInfo struct {
	Price      types.Number `json:"price"`
	Rule       string       `json:"rule"`
	Expiration int64        `json:"expiration"`
}

TriggerPriceInfo represents a trigger price and related information for Price triggered order

type TriggerTimeResponse

type TriggerTimeResponse struct {
	TriggerTime gateioTime `json:"trigger_time"`
}

TriggerTimeResponse represents trigger time as a response for countdown candle order response

type UsersAllAccountBalance

type UsersAllAccountBalance struct {
	Details map[string]CurrencyBalanceAmount `json:"details"`
	Total   CurrencyBalanceAmount            `json:"total"`
}

UsersAllAccountBalance represents user all account balances.

type UsersPositionForUnderlying

type UsersPositionForUnderlying struct {
	User          int64        `json:"user"`
	Contract      string       `json:"contract"`
	Size          int64        `json:"size"`
	EntryPrice    types.Number `json:"entry_price"`
	RealisedPnl   types.Number `json:"realised_pnl"`
	MarkPrice     types.Number `json:"mark_price"`
	UnrealisedPnl types.Number `json:"unrealised_pnl"`
	PendingOrders int64        `json:"pending_orders"`
	CloseOrder    struct {
		ID    int64        `json:"id"`
		Price types.Number `json:"price"`
		IsLiq bool         `json:"is_liq"`
	} `json:"close_order"`
}

UsersPositionForUnderlying represents user's position for specified underlying.

type WalletSavedAddress

type WalletSavedAddress struct {
	Currency string `json:"currency"`
	Chain    string `json:"chain"`
	Address  string `json:"address"`
	Name     string `json:"name"`
	Tag      string `json:"tag"`
	Verified string `json:"verified"` // Whether to pass the verification 0-unverified, 1-verified
}

WalletSavedAddress represents currency saved address

type WithdrawalRequestParam

type WithdrawalRequestParam struct {
	Currency currency.Code `json:"currency"`
	Amount   types.Number  `json:"amount"`
	Chain    string        `json:"chain,omitempty"`

	// Optional parameters
	Address string `json:"address,omitempty"`
	Memo    string `json:"memo,omitempty"`
}

WithdrawalRequestParam represents currency withdrawal request param.

type WithdrawalResponse

type WithdrawalResponse struct {
	ID                string       `json:"id"`
	Timestamp         gateioTime   `json:"timestamp"`
	Currency          string       `json:"currency"`
	WithdrawalAddress string       `json:"address"`
	TransactionID     string       `json:"txid"`
	Amount            types.Number `json:"amount"`
	Memo              string       `json:"memo"`
	Status            string       `json:"status"`
	Chain             string       `json:"chain"`
	Fee               types.Number `json:"fee"`
}

WithdrawalResponse represents withdrawal response

type WithdrawalStatus

type WithdrawalStatus struct {
	Currency               string            `json:"currency"`
	CurrencyName           string            `json:"name"`
	CurrencyNameChinese    string            `json:"name_cn"`
	Deposit                types.Number      `json:"deposit"`
	WithdrawPercent        string            `json:"withdraw_percent"`
	FixedWithdrawalFee     types.Number      `json:"withdraw_fix"`
	WithdrawDayLimit       types.Number      `json:"withdraw_day_limit"`
	WithdrawDayLimitRemain types.Number      `json:"withdraw_day_limit_remain"`
	WithdrawAmountMini     types.Number      `json:"withdraw_amount_mini"`
	WithdrawEachTimeLimit  types.Number      `json:"withdraw_eachtime_limit"`
	WithdrawFixOnChains    map[string]string `json:"withdraw_fix_on_chains"`
	AdditionalProperties   string            `json:"additionalProperties"`
}

WithdrawalStatus represents currency withdrawal status

type WsAuthInput

type WsAuthInput struct {
	Method string `json:"method,omitempty"`
	Key    string `json:"KEY,omitempty"`
	Sign   string `json:"SIGN,omitempty"`
}

WsAuthInput represents the authentication information

type WsBalance

type WsBalance struct {
	Timestamp    string `json:"timestamp"`
	TimestampMs  string `json:"timestamp_ms"`
	User         string `json:"user"`
	Currency     string `json:"currency"`
	Change       string `json:"change"`
	Total        string `json:"total"`
	Available    string `json:"available"`
	Freeze       string `json:"freeze"`
	FreezeChange string `json:"freeze_change"`
	ChangeType   string `json:"change_type"`
}

WsBalance represents a options and futures balance push data

type WsCandlesticks

type WsCandlesticks struct {
	Timestamp          int64        `json:"t,string"`
	TotalVolume        types.Number `json:"v"`
	ClosePrice         types.Number `json:"c"`
	HighestPrice       types.Number `json:"h"`
	LowestPrice        types.Number `json:"l"`
	OpenPrice          types.Number `json:"o"`
	NameOfSubscription string       `json:"n"`
}

WsCandlesticks represents the candlestick data for spot, margin and cross margin trades pushed through the websocket channel.

type WsCrossMarginBalance

type WsCrossMarginBalance struct {
	Timestamp   int64        `json:"timestamp,string"`
	TimestampMs types.Number `json:"timestamp_ms"`
	User        string       `json:"user"`
	Currency    string       `json:"currency"`
	Change      string       `json:"change"`
	Total       types.Number `json:"total"`
	Available   types.Number `json:"available"`
}

WsCrossMarginBalance represents a cross margin balance detail

type WsCrossMarginLoan

type WsCrossMarginLoan struct {
	Timestamp gateioTime   `json:"timestamp"`
	User      string       `json:"user"`
	Currency  string       `json:"currency"`
	Change    string       `json:"change"`
	Total     types.Number `json:"total"`
	Available types.Number `json:"available"`
	Borrowed  string       `json:"borrowed"`
	Interest  string       `json:"interest"`
}

WsCrossMarginLoan represents a cross margin loan push data

type WsEventResponse

type WsEventResponse struct {
	Time    int64  `json:"time"`
	ID      int64  `json:"id"`
	Channel string `json:"channel"`
	Event   string `json:"event"`
	Result  *struct {
		Status string `json:"status"`
	} `json:"result"`
	Error *struct {
		Code    int64  `json:"code"`
		Message string `json:"message"`
	}
}

WsEventResponse represents websocket incoming subscription, unsubscription, and update response

type WsFundingBalance

type WsFundingBalance struct {
	Timestamp   int64        `json:"timestamp,string"`
	TimestampMs types.Number `json:"timestamp_ms"`
	User        string       `json:"user"`
	Currency    string       `json:"currency"`
	Change      string       `json:"change"`
	Freeze      string       `json:"freeze"`
	Lent        string       `json:"lent"`
}

WsFundingBalance represents funding balance push data.

type WsFutureTicker

type WsFutureTicker struct {
	Contract              currency.Pair `json:"contract"`
	Last                  types.Number  `json:"last"`
	ChangePercentage      string        `json:"change_percentage"`
	FundingRate           string        `json:"funding_rate"`
	FundingRateIndicative string        `json:"funding_rate_indicative"`
	MarkPrice             types.Number  `json:"mark_price"`
	IndexPrice            types.Number  `json:"index_price"`
	TotalSize             types.Number  `json:"total_size"`
	Volume24H             types.Number  `json:"volume_24h"`
	Volume24HBtc          types.Number  `json:"volume_24h_btc"`
	Volume24HUsd          types.Number  `json:"volume_24h_usd"`
	QuantoBaseRate        string        `json:"quanto_base_rate"`
	Volume24HQuote        types.Number  `json:"volume_24h_quote"`
	Volume24HSettle       string        `json:"volume_24h_settle"`
	Volume24HBase         types.Number  `json:"volume_24h_base"`
	Low24H                types.Number  `json:"low_24h"`
	High24H               types.Number  `json:"high_24h"`
}

WsFutureTicker represents a futures push data.

type WsFuturesAndOptionsOrderbookUpdate

type WsFuturesAndOptionsOrderbookUpdate struct {
	TimestampInMs  int64         `json:"t"`
	ContractName   currency.Pair `json:"s"`
	FirstUpdatedID int64         `json:"U"`
	LastUpdatedID  int64         `json:"u"`
	Bids           []struct {
		Price types.Number `json:"p"`
		Size  float64      `json:"s"`
	} `json:"b"`
	Asks []struct {
		Price types.Number `json:"p"`
		Size  float64      `json:"s"`
	} `json:"a"`
}

WsFuturesAndOptionsOrderbookUpdate represents futures and options account orderbook update push data

type WsFuturesAutoDeleveragesNotification

type WsFuturesAutoDeleveragesNotification struct {
	EntryPrice   float64    `json:"entry_price"`
	FillPrice    float64    `json:"fill_price"`
	PositionSize int64      `json:"position_size"`
	TradeSize    int64      `json:"trade_size"`
	Time         gateioTime `json:"time"`
	TimeMs       gateioTime `json:"time_ms"`
	Contract     string     `json:"contract"`
	User         string     `json:"user"`
}

WsFuturesAutoDeleveragesNotification represents futures auto deleverages push data

type WsFuturesAutoOrder

type WsFuturesAutoOrder struct {
	User    int64 `json:"user"`
	Trigger struct {
		StrategyType int64  `json:"strategy_type"`
		PriceType    int64  `json:"price_type"`
		Price        string `json:"price"`
		Rule         int64  `json:"rule"`
		Expiration   int64  `json:"expiration"`
	} `json:"trigger"`
	Initial struct {
		Contract     string       `json:"contract"`
		Size         int64        `json:"size"`
		Price        types.Number `json:"price"`
		TimeInForce  string       `json:"tif"`
		Text         string       `json:"text"`
		Iceberg      int64        `json:"iceberg"`
		IsClose      bool         `json:"is_close"`
		IsReduceOnly bool         `json:"is_reduce_only"`
	} `json:"initial"`
	ID          int64      `json:"id"`
	TradeID     int64      `json:"trade_id"`
	Status      string     `json:"status"`
	Reason      string     `json:"reason"`
	CreateTime  gateioTime `json:"create_time"`
	Name        string     `json:"name"`
	IsStopOrder bool       `json:"is_stop_order"`
	StopTrigger struct {
		Rule         int64  `json:"rule"`
		TriggerPrice string `json:"trigger_price"`
		OrderPrice   string `json:"order_price"`
	} `json:"stop_trigger"`
}

WsFuturesAutoOrder represents an auto order push data.

type WsFuturesLiquidationNotification

type WsFuturesLiquidationNotification struct {
	EntryPrice int64      `json:"entry_price"`
	FillPrice  float64    `json:"fill_price"`
	Left       float64    `json:"left"`
	Leverage   float64    `json:"leverage"`
	LiqPrice   int64      `json:"liq_price"`
	Margin     float64    `json:"margin"`
	MarkPrice  int64      `json:"mark_price"`
	OrderID    int64      `json:"order_id"`
	OrderPrice float64    `json:"order_price"`
	Size       float64    `json:"size"`
	Time       int64      `json:"time"`
	TimeMs     gateioTime `json:"time_ms"`
	Contract   string     `json:"contract"`
	User       string     `json:"user"`
}

WsFuturesLiquidationNotification represents a liquidation notification push data

type WsFuturesOrder

type WsFuturesOrder struct {
	Contract     currency.Pair `json:"contract"`
	CreateTime   gateioTime    `json:"create_time"`
	CreateTimeMs gateioTime    `json:"create_time_ms"`
	FillPrice    float64       `json:"fill_price"`
	FinishAs     string        `json:"finish_as"`
	FinishTime   int64         `json:"finish_time"`
	FinishTimeMs gateioTime    `json:"finish_time_ms"`
	Iceberg      int64         `json:"iceberg"`
	ID           int64         `json:"id"`
	IsClose      bool          `json:"is_close"`
	IsLiq        bool          `json:"is_liq"`
	IsReduceOnly bool          `json:"is_reduce_only"`
	Left         float64       `json:"left"`
	Mkfr         float64       `json:"mkfr"`
	Price        float64       `json:"price"`
	Refr         int64         `json:"refr"`
	Refu         int64         `json:"refu"`
	Size         float64       `json:"size"`
	Status       string        `json:"status"`
	Text         string        `json:"text"`
	TimeInForce  string        `json:"tif"`
	Tkfr         float64       `json:"tkfr"`
	User         string        `json:"user"`
}

WsFuturesOrder represents futures order

type WsFuturesOrderbookSnapshot

type WsFuturesOrderbookSnapshot struct {
	TimestampInMs gateioTime    `json:"t"`
	Contract      currency.Pair `json:"contract"`
	OrderbookID   int64         `json:"id"`
	Asks          []struct {
		Price types.Number `json:"p"`
		Size  float64      `json:"s"`
	} `json:"asks"`
	Bids []struct {
		Price types.Number `json:"p"`
		Size  float64      `json:"s"`
	} `json:"bids"`
}

WsFuturesOrderbookSnapshot represents a futures orderbook snapshot push data

type WsFuturesOrderbookTicker

type WsFuturesOrderbookTicker struct {
	TimestampMs   gateioTime   `json:"t"`
	UpdateID      int64        `json:"u"`
	CurrencyPair  string       `json:"s"`
	BestBidPrice  types.Number `json:"b"`
	BestBidAmount float64      `json:"B"`
	BestAskPrice  types.Number `json:"a"`
	BestAskAmount float64      `json:"A"`
}

WsFuturesOrderbookTicker represents the orderbook ticker push data

type WsFuturesOrderbookUpdateEvent

type WsFuturesOrderbookUpdateEvent struct {
	Price        types.Number `json:"p"`
	Amount       float64      `json:"s"`
	CurrencyPair string       `json:"c"`
	ID           int64        `json:"id"`
}

WsFuturesOrderbookUpdateEvent represents futures orderbook push data with the event 'update'

type WsFuturesPosition

type WsFuturesPosition struct {
	Contract           string     `json:"contract"`
	CrossLeverageLimit float64    `json:"cross_leverage_limit"`
	EntryPrice         float64    `json:"entry_price"`
	HistoryPnl         float64    `json:"history_pnl"`
	HistoryPoint       int64      `json:"history_point"`
	LastClosePnl       float64    `json:"last_close_pnl"`
	Leverage           float64    `json:"leverage"`
	LeverageMax        float64    `json:"leverage_max"`
	LiqPrice           float64    `json:"liq_price"`
	MaintenanceRate    float64    `json:"maintenance_rate"`
	Margin             float64    `json:"margin"`
	Mode               string     `json:"mode"`
	RealisedPnl        float64    `json:"realised_pnl"`
	RealisedPoint      float64    `json:"realised_point"`
	RiskLimit          float64    `json:"risk_limit"`
	Size               float64    `json:"size"`
	Time               gateioTime `json:"time"`
	TimeMs             gateioTime `json:"time_ms"`
	User               string     `json:"user"`
}

WsFuturesPosition represents futures notify positions update.

type WsFuturesReduceRiskLimitNotification

type WsFuturesReduceRiskLimitNotification struct {
	CancelOrders    int64      `json:"cancel_orders"`
	Contract        string     `json:"contract"`
	LeverageMax     int64      `json:"leverage_max"`
	LiqPrice        float64    `json:"liq_price"`
	MaintenanceRate float64    `json:"maintenance_rate"`
	RiskLimit       int64      `json:"risk_limit"`
	Time            gateioTime `json:"time"`
	TimeMs          gateioTime `json:"time_ms"`
	User            string     `json:"user"`
}

WsFuturesReduceRiskLimitNotification represents a futures reduced risk limit push data

type WsFuturesTrades

type WsFuturesTrades struct {
	Size         float64       `json:"size"`
	ID           int64         `json:"id"`
	CreateTime   gateioTime    `json:"create_time"`
	CreateTimeMs gateioTime    `json:"create_time_ms"`
	Price        types.Number  `json:"price"`
	Contract     currency.Pair `json:"contract"`
}

WsFuturesTrades represents a list of trades push data

type WsFuturesUserTrade

type WsFuturesUserTrade struct {
	ID           string        `json:"id"`
	CreateTime   gateioTime    `json:"create_time"`
	CreateTimeMs gateioTime    `json:"create_time_ms"`
	Contract     currency.Pair `json:"contract"`
	OrderID      string        `json:"order_id"`
	Size         float64       `json:"size"`
	Price        types.Number  `json:"price"`
	Role         string        `json:"role"`
	Text         string        `json:"text"`
	Fee          float64       `json:"fee"`
	PointFee     int64         `json:"point_fee"`
}

WsFuturesUserTrade represents a futures account user trade push data

type WsInput

type WsInput struct {
	Time    int64        `json:"time,omitempty"`
	ID      int64        `json:"id,omitempty"`
	Channel string       `json:"channel,omitempty"`
	Event   string       `json:"event,omitempty"`
	Payload []string     `json:"payload,omitempty"`
	Auth    *WsAuthInput `json:"auth,omitempty"`
}

WsInput represents general structure for websocket requests

type WsMarginBalance

type WsMarginBalance struct {
	Timestamp    types.Number `json:"timestamp"`
	TimestampMs  types.Number `json:"timestamp_ms"`
	User         string       `json:"user"`
	CurrencyPair string       `json:"currency_pair"`
	Currency     string       `json:"currency"`
	Change       types.Number `json:"change"`
	Available    types.Number `json:"available"`
	Freeze       types.Number `json:"freeze"`
	Borrowed     string       `json:"borrowed"`
	Interest     string       `json:"interest"`
}

WsMarginBalance represents margin account balance push data

type WsOptionUnderlyingTicker

type WsOptionUnderlyingTicker struct {
	TradePut   int64  `json:"trade_put"`
	TradeCall  int64  `json:"trade_call"`
	IndexPrice string `json:"index_price"`
	Name       string `json:"name"`
}

WsOptionUnderlyingTicker represents options underlying ticker push data

type WsOptionsContract

type WsOptionsContract struct {
	Contract          string     `json:"contract"`
	CreateTime        gateioTime `json:"create_time"`
	ExpirationTime    int64      `json:"expiration_time"`
	InitMarginHigh    float64    `json:"init_margin_high"`
	InitMarginLow     float64    `json:"init_margin_low"`
	IsCall            bool       `json:"is_call"`
	MaintMarginBase   float64    `json:"maint_margin_base"`
	MakerFeeRate      float64    `json:"maker_fee_rate"`
	MarkPriceRound    float64    `json:"mark_price_round"`
	MinBalanceShort   float64    `json:"min_balance_short"`
	MinOrderMargin    float64    `json:"min_order_margin"`
	Multiplier        float64    `json:"multiplier"`
	OrderPriceDeviate float64    `json:"order_price_deviate"`
	OrderPriceRound   float64    `json:"order_price_round"`
	OrderSizeMax      float64    `json:"order_size_max"`
	OrderSizeMin      float64    `json:"order_size_min"`
	OrdersLimit       float64    `json:"orders_limit"`
	RefDiscountRate   float64    `json:"ref_discount_rate"`
	RefRebateRate     float64    `json:"ref_rebate_rate"`
	StrikePrice       float64    `json:"strike_price"`
	Tag               string     `json:"tag"`
	TakerFeeRate      float64    `json:"taker_fee_rate"`
	Underlying        string     `json:"underlying"`
	Time              gateioTime `json:"time"`
	TimeMs            gateioTime `json:"time_ms"`
}

WsOptionsContract represents an option contract push data.

type WsOptionsContractCandlestick

type WsOptionsContractCandlestick struct {
	Timestamp          int64        `json:"t"`
	TotalVolume        float64      `json:"v"`
	ClosePrice         types.Number `json:"c"`
	HighestPrice       types.Number `json:"h"`
	LowestPrice        types.Number `json:"l"`
	OpenPrice          types.Number `json:"o"`
	Amount             types.Number `json:"a"`
	NameOfSubscription string       `json:"n"` // the format of <interval string>_<currency pair>
}

WsOptionsContractCandlestick represents an options contract candlestick push data.

type WsOptionsLiquidates

type WsOptionsLiquidates struct {
	User        string     `json:"user"`
	InitMargin  float64    `json:"init_margin"`
	MaintMargin float64    `json:"maint_margin"`
	OrderMargin float64    `json:"order_margin"`
	Time        gateioTime `json:"time"`
	TimeMs      gateioTime `json:"time_ms"`
}

WsOptionsLiquidates represents the liquidates push data of option account.

type WsOptionsMarkPrice

type WsOptionsMarkPrice struct {
	Contract     string     `json:"contract"`
	Price        float64    `json:"price"`
	UpdateTimeMs gateioTime `json:"time_ms"`
	UpdateTime   gateioTime `json:"time"`
}

WsOptionsMarkPrice represents options mark price push data.

type WsOptionsOrder

type WsOptionsOrder struct {
	ID                 string `json:"id"`
	Text               string `json:"text"`
	CreateTime         string `json:"create_time"`
	UpdateTime         string `json:"update_time"`
	CurrencyPair       string `json:"currency_pair"`
	Type               string `json:"type"`
	Account            string `json:"account"`
	Side               string `json:"side"`
	Amount             string `json:"amount"`
	Price              string `json:"price"`
	TimeInForce        string `json:"time_in_force"`
	Left               string `json:"left"`
	FilledTotal        string `json:"filled_total"`
	AvgDealPrice       string `json:"avg_deal_price"`
	Fee                string `json:"fee"`
	FeeCurrency        string `json:"fee_currency"`
	PointFee           string `json:"point_fee"`
	GtFee              string `json:"gt_fee"`
	RebatedFee         string `json:"rebated_fee"`
	RebatedFeeCurrency string `json:"rebated_fee_currency"`
	CreateTimeMs       string `json:"create_time_ms"`
	UpdateTimeMs       string `json:"update_time_ms"`
	User               int    `json:"user"`
	Event              string `json:"event"`
	StpID              int    `json:"stp_id"`
	StpAct             string `json:"stp_act"`
	FinishAs           string `json:"finish_as"`
	BizInfo            string `json:"biz_info"`
	AmendText          string `json:"amend_text"`
}

WsOptionsOrder represents options order push data.

type WsOptionsOrderbookSnapshot

type WsOptionsOrderbookSnapshot struct {
	Timestamp gateioTime    `json:"t"`
	Contract  currency.Pair `json:"contract"`
	ID        int64         `json:"id"`
	Asks      []struct {
		Price types.Number `json:"p"`
		Size  float64      `json:"s"`
	} `json:"asks"`
	Bids []struct {
		Price types.Number `json:"p"`
		Size  float64      `json:"s"`
	} `json:"bids"`
}

WsOptionsOrderbookSnapshot represents the options orderbook snapshot push data.

type WsOptionsOrderbookTicker

type WsOptionsOrderbookTicker struct {
	UpdateTimestamp gateioTime   `json:"t"`
	UpdateID        int64        `json:"u"`
	ContractName    string       `json:"s"`
	BidPrice        types.Number `json:"b"`
	BidSize         float64      `json:"B"`
	AskPrice        types.Number `json:"a"`
	AskSize         float64      `json:"A"`
}

WsOptionsOrderbookTicker represents options orderbook ticker push data.

type WsOptionsPosition

type WsOptionsPosition struct {
	EntryPrice   float64    `json:"entry_price"`
	RealisedPnl  float64    `json:"realised_pnl"`
	Size         float64    `json:"size"`
	Contract     string     `json:"contract"`
	User         string     `json:"user"`
	UpdateTime   gateioTime `json:"time"`
	UpdateTimeMs gateioTime `json:"time_ms"`
}

WsOptionsPosition represents positions push data for options account.

type WsOptionsSettlement

type WsOptionsSettlement struct {
	Contract     string     `json:"contract"`
	OrderbookID  int64      `json:"orderbook_id"`
	PositionSize float64    `json:"position_size"`
	Profit       float64    `json:"profit"`
	SettlePrice  float64    `json:"settle_price"`
	StrikePrice  float64    `json:"strike_price"`
	Tag          string     `json:"tag"`
	TradeID      int64      `json:"trade_id"`
	TradeSize    int64      `json:"trade_size"`
	Underlying   string     `json:"underlying"`
	UpdateTime   gateioTime `json:"time"`
	UpdateTimeMs gateioTime `json:"time_ms"`
}

WsOptionsSettlement represents a options settlement push data.

type WsOptionsTrades

type WsOptionsTrades struct {
	ID         int64         `json:"id"`
	CreateTime gateioTime    `json:"create_time"`
	Contract   currency.Pair `json:"contract"`
	Size       float64       `json:"size"`
	Price      float64       `json:"price"`

	// Added in options websocket push data
	CreateTimeMs gateioTime `json:"create_time_ms"`
	Underlying   string     `json:"underlying"`
	IsCall       bool       `json:"is_call"` // added in underlying trades
}

WsOptionsTrades represents options trades for websocket push data.

type WsOptionsUnderlyingPrice

type WsOptionsUnderlyingPrice struct {
	Underlying   string     `json:"underlying"`
	Price        float64    `json:"price"`
	UpdateTime   gateioTime `json:"time"`
	UpdateTimeMs gateioTime `json:"time_ms"`
}

WsOptionsUnderlyingPrice represents the underlying price.

type WsOptionsUserSettlement

type WsOptionsUserSettlement struct {
	User         string     `json:"user"`
	Contract     string     `json:"contract"`
	RealisedPnl  float64    `json:"realised_pnl"`
	SettlePrice  float64    `json:"settle_price"`
	SettleProfit float64    `json:"settle_profit"`
	Size         float64    `json:"size"`
	StrikePrice  float64    `json:"strike_price"`
	Underlying   string     `json:"underlying"`
	SettleTime   gateioTime `json:"time"`
	SettleTimeMs gateioTime `json:"time_ms"`
}

WsOptionsUserSettlement represents user's personal settlements push data of options account.

type WsOptionsUserTrade

type WsOptionsUserTrade struct {
	ID           int    `json:"id"`
	UserID       int    `json:"user_id"`
	OrderID      string `json:"order_id"`
	CurrencyPair string `json:"currency_pair"`
	CreateTime   int    `json:"create_time"`
	CreateTimeMs string `json:"create_time_ms"`
	Side         string `json:"side"`
	Amount       string `json:"amount"`
	Role         string `json:"role"`
	Price        string `json:"price"`
	Fee          string `json:"fee"`
	PointFee     string `json:"point_fee"`
	GtFee        string `json:"gt_fee"`
	Text         string `json:"text"`
}

WsOptionsUserTrade represents user's personal trades of option account.

type WsOrderbookSnapshot

type WsOrderbookSnapshot struct {
	UpdateTimeMs gateioTime    `json:"t"`
	LastUpdateID int64         `json:"lastUpdateId"`
	CurrencyPair currency.Pair `json:"s"`
	Bids         [][2]string   `json:"bids"`
	Asks         [][2]string   `json:"asks"`
}

WsOrderbookSnapshot represents a websocket orderbook snapshot push data

type WsOrderbookTickerData

type WsOrderbookTickerData struct {
	UpdateTimeMS  int64         `json:"t"`
	UpdateOrderID int64         `json:"u"`
	CurrencyPair  currency.Pair `json:"s"`
	BestBidPrice  types.Number  `json:"b"`
	BestBidAmount types.Number  `json:"B"`
	BestAskPrice  types.Number  `json:"a"`
	BestAskAmount types.Number  `json:"A"`
}

WsOrderbookTickerData represents the websocket orderbook best bid or best ask push data

type WsOrderbookUpdate

type WsOrderbookUpdate struct {
	UpdateTimeMs            gateioTime    `json:"t"`
	IgnoreField             string        `json:"e"`
	UpdateTime              gateioTime    `json:"E"`
	CurrencyPair            currency.Pair `json:"s"`
	FirstOrderbookUpdatedID int64         `json:"U"` // First update order book id in this event since last update
	LastOrderbookUpdatedID  int64         `json:"u"`
	Bids                    [][2]string   `json:"b"`
	Asks                    [][2]string   `json:"a"`
}

WsOrderbookUpdate represents websocket orderbook update push data

type WsPositionClose

type WsPositionClose struct {
	Contract      string     `json:"contract"`
	ProfitAndLoss float64    `json:"pnl,omitempty"`
	Side          string     `json:"side"`
	Text          string     `json:"text"`
	Time          gateioTime `json:"time"`
	TimeMs        gateioTime `json:"time_ms"`
	User          string     `json:"user"`

	// Added in options close position push datas
	SettleSize float64 `json:"settle_size,omitempty"`
	Underlying string  `json:"underlying,omitempty"`
}

WsPositionClose represents a close position futures push data

type WsResponse

type WsResponse struct {
	ID      int64           `json:"id"`
	Time    int64           `json:"time"`
	Channel string          `json:"channel"`
	Event   string          `json:"event"`
	Result  json.RawMessage `json:"result"`
}

WsResponse represents generalized websocket push data from the server.

type WsSpotBalance

type WsSpotBalance struct {
	Timestamp   types.Number `json:"timestamp"`
	TimestampMs types.Number `json:"timestamp_ms"`
	User        string       `json:"user"`
	Currency    string       `json:"currency"`
	Change      types.Number `json:"change"`
	Total       types.Number `json:"total"`
	Available   types.Number `json:"available"`
}

WsSpotBalance represents a spot balance.

type WsSpotOrder

type WsSpotOrder struct {
	ID                 string        `json:"id,omitempty"`
	User               int64         `json:"user"`
	Text               string        `json:"text,omitempty"`
	Succeeded          bool          `json:"succeeded,omitempty"`
	Label              string        `json:"label,omitempty"`
	Message            string        `json:"message,omitempty"`
	CurrencyPair       currency.Pair `json:"currency_pair,omitempty"`
	Type               string        `json:"type,omitempty"`
	Account            string        `json:"account,omitempty"`
	Side               string        `json:"side,omitempty"`
	Amount             types.Number  `json:"amount,omitempty"`
	Price              types.Number  `json:"price,omitempty"`
	TimeInForce        string        `json:"time_in_force,omitempty"`
	Iceberg            string        `json:"iceberg,omitempty"`
	Left               types.Number  `json:"left,omitempty"`
	FilledTotal        types.Number  `json:"filled_total,omitempty"`
	Fee                types.Number  `json:"fee,omitempty"`
	FeeCurrency        string        `json:"fee_currency,omitempty"`
	PointFee           string        `json:"point_fee,omitempty"`
	GtFee              string        `json:"gt_fee,omitempty"`
	GtDiscount         bool          `json:"gt_discount,omitempty"`
	RebatedFee         string        `json:"rebated_fee,omitempty"`
	RebatedFeeCurrency string        `json:"rebated_fee_currency,omitempty"`
	Event              string        `json:"event"`
	CreateTime         gateioTime    `json:"create_time,omitempty"`
	CreateTimeMs       gateioTime    `json:"create_time_ms,omitempty"`
	UpdateTime         gateioTime    `json:"update_time,omitempty"`
	UpdateTimeMs       gateioTime    `json:"update_time_ms,omitempty"`
}

WsSpotOrder represents an order push data through the websocket channel.

type WsTicker

type WsTicker struct {
	CurrencyPair     currency.Pair `json:"currency_pair"`
	Last             types.Number  `json:"last"`
	LowestAsk        types.Number  `json:"lowest_ask"`
	HighestBid       types.Number  `json:"highest_bid"`
	ChangePercentage types.Number  `json:"change_percentage"`
	BaseVolume       types.Number  `json:"base_volume"`
	QuoteVolume      types.Number  `json:"quote_volume"`
	High24H          types.Number  `json:"high_24h"`
	Low24H           types.Number  `json:"low_24h"`
}

WsTicker websocket ticker information.

type WsTrade

type WsTrade struct {
	ID           int64         `json:"id"`
	CreateTime   gateioTime    `json:"create_time"`
	CreateTimeMs gateioTime    `json:"create_time_ms"`
	Side         string        `json:"side"`
	CurrencyPair currency.Pair `json:"currency_pair"`
	Amount       types.Number  `json:"amount"`
	Price        types.Number  `json:"price"`
}

WsTrade represents a websocket push data response for a trade

type WsUserPersonalTrade

type WsUserPersonalTrade struct {
	ID           int64         `json:"id"`
	UserID       int64         `json:"user_id"`
	OrderID      string        `json:"order_id"`
	CurrencyPair currency.Pair `json:"currency_pair"`
	CreateTime   int64         `json:"create_time"`
	CreateTimeMs gateioTime    `json:"create_time_ms"`
	Side         string        `json:"side"`
	Amount       types.Number  `json:"amount"`
	Role         string        `json:"role"`
	Price        types.Number  `json:"price"`
	Fee          types.Number  `json:"fee"`
	PointFee     types.Number  `json:"point_fee"`
	GtFee        string        `json:"gt_fee"`
	Text         string        `json:"text"`
}

WsUserPersonalTrade represents a user's personal trade pushed through the websocket connection.

Jump to

Keyboard shortcuts

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