Documentation
¶
Index ¶
- Variables
- type BalancesResponse
- type DepositAddr
- type Gateio
- func (g *Gateio) AuthenticateWebsocket(_ context.Context) error
- func (g *Gateio) CancelAllExistingOrders(ctx context.Context, orderType int64, symbol string) error
- func (g *Gateio) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.CancelAllResponse, error)
- func (g *Gateio) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error)
- func (g *Gateio) CancelExistingOrder(ctx context.Context, orderID int64, symbol string) (bool, error)
- func (g *Gateio) CancelOrder(ctx context.Context, o *order.Cancel) error
- func (g *Gateio) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
- func (g *Gateio) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
- func (g *Gateio) FetchTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)
- func (g *Gateio) FetchTradablePairs(ctx context.Context, asset asset.Item) ([]string, error)
- func (g *Gateio) FormatExchangeKlineInterval(in kline.Interval) string
- func (g *Gateio) GenerateAuthenticatedSubscriptions() ([]stream.ChannelSubscription, error)
- func (g *Gateio) GenerateDefaultSubscriptions() ([]stream.ChannelSubscription, error)
- func (g *Gateio) GenerateSignature(message string) ([]byte, error)
- func (g *Gateio) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest) ([]order.Detail, error)
- func (g *Gateio) GetAvailableTransferChains(ctx context.Context, cryptocurrency currency.Code) ([]string, error)
- func (g *Gateio) GetBalances(ctx context.Context) (BalancesResponse, error)
- func (g *Gateio) GetCryptoDepositAddress(ctx context.Context, curr string) (*DepositAddr, error)
- func (g *Gateio) GetDefaultConfig() (*config.Exchange, error)
- func (g *Gateio) GetDepositAddress(ctx context.Context, cryptocurrency currency.Code, _, chain string) (*deposit.Address, error)
- func (g *Gateio) GetFee(ctx context.Context, feeBuilder *exchange.FeeBuilder) (fee float64, err error)
- func (g *Gateio) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)
- func (g *Gateio) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error)
- func (g *Gateio) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, ...) (kline.Item, error)
- func (g *Gateio) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, ...) (kline.Item, error)
- func (g *Gateio) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error)
- func (b *Gateio) GetKlines(arg interface{}) ([]*kline.Kline, error)
- func (g *Gateio) GetLatestSpotPrice(ctx context.Context, symbol string) (float64, error)
- func (g *Gateio) GetMarketInfo(ctx context.Context) (MarketInfoResponse, error)
- func (g *Gateio) GetOpenOrders(ctx context.Context, symbol string) (OpenOrdersResponse, error)
- func (g *Gateio) GetOrderHistory(ctx context.Context, req *order.GetOrdersRequest) ([]order.Detail, error)
- func (g *Gateio) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error)
- func (g *Gateio) GetOrderbook(ctx context.Context, symbol string) (Orderbook, error)
- func (g *Gateio) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)
- func (g *Gateio) GetSpotKline(ctx context.Context, arg KlinesRequestParams) (kline.Item, error)
- func (g *Gateio) GetSymbols(ctx context.Context) ([]string, error)
- func (g *Gateio) GetTicker(ctx context.Context, symbol string) (TickerResponse, error)
- func (g *Gateio) GetTickers(ctx context.Context) (map[string]TickerResponse, error)
- func (g *Gateio) GetTradeHistory(ctx context.Context, symbol string) (TradHistoryResponse, error)
- func (g *Gateio) GetTrades(ctx context.Context, symbol string) (TradeHistory, error)
- func (g *Gateio) GetWithdrawalsHistory(ctx context.Context, c currency.Code) (resp []exchange.WithdrawalHistory, err error)
- func (g *Gateio) ModifyOrder(ctx context.Context, action *order.Modify) (order.Modify, error)
- func (g *Gateio) Run()
- func (g *Gateio) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, method, endpoint, param string, ...) error
- func (g *Gateio) SendHTTPRequest(ctx context.Context, ep exchange.URL, path string, result interface{}) error
- func (g *Gateio) SetDefaults()
- func (g *Gateio) Setup(exch *config.Exchange) error
- func (g *Gateio) SpotNewOrder(ctx context.Context, arg SpotNewOrderRequestParams) (SpotNewOrderResponse, error)
- func (g *Gateio) Start(wg *sync.WaitGroup) error
- func (g *Gateio) SubmitOrder(ctx context.Context, s *order.Submit) (order.SubmitResponse, error)
- func (g *Gateio) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error
- func (g *Gateio) Unsubscribe(channelsToUnsubscribe []stream.ChannelSubscription) error
- func (g *Gateio) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
- func (g *Gateio) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
- func (g *Gateio) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)
- func (g *Gateio) UpdateTickers(ctx context.Context, a asset.Item) error
- func (g *Gateio) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error
- func (g *Gateio) ValidateCredentials(ctx context.Context, assetType asset.Item) error
- func (g *Gateio) WithdrawCrypto(ctx context.Context, curr, address, memo, chain string, amount float64) (*withdraw.ExchangeResponse, error)
- func (g *Gateio) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (g *Gateio) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (g *Gateio) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (g *Gateio) WsConnect() error
- type KLineResponse
- type KlinesRequestParams
- type MarketInfoPairsResponse
- type MarketInfoResponse
- type OpenOrder
- type OpenOrdersResponse
- type Orderbook
- type OrderbookItem
- type OrderbookResponse
- type SpotMarketInfoPairsResponse
- type SpotMarketInfoResponse
- type SpotNewOrderRequestParams
- type SpotNewOrderResponse
- type TickerResponse
- type TimeInterval
- type TradHistoryResponse
- type TradeHistory
- type TradeHistoryEntry
- type TradesResponse
- type WebSocketOrderQueryRecords
- type WebSocketOrderQueryResult
- type WebsocketAuthenticationResponse
- type WebsocketBalance
- type WebsocketBalanceCurrency
- type WebsocketError
- type WebsocketRequest
- type WebsocketResponse
- type WebsocketTicker
- type WebsocketTrade
- type WsGetBalanceResponse
- type WsGetBalanceResponseData
Constants ¶
This section is empty.
Variables ¶
var ( TimeIntervalMinute = TimeInterval(60) TimeIntervalThreeMinutes = TimeInterval(60 * 3) TimeIntervalFiveMinutes = TimeInterval(60 * 5) TimeIntervalFifteenMinutes = TimeInterval(60 * 15) TimeIntervalThirtyMinutes = TimeInterval(60 * 30) TimeIntervalHour = TimeInterval(60 * 60) TimeIntervalTwoHours = TimeInterval(2 * 60 * 60) TimeIntervalFourHours = TimeInterval(4 * 60 * 60) TimeIntervalSixHours = TimeInterval(6 * 60 * 60) TimeIntervalDay = TimeInterval(60 * 60 * 24) )
TimeInterval vars
var WithdrawalFees = map[currency.Code]float64{}/* 204 elements not displayed */
WithdrawalFees the large list of predefined withdrawal fees Prone to change
Functions ¶
This section is empty.
Types ¶
type BalancesResponse ¶
type BalancesResponse struct {
Result string `json:"result"`
Available interface{} `json:"available"`
Locked interface{} `json:"locked"`
}
BalancesResponse 用户资产
type DepositAddr ¶
type DepositAddr struct {
Result bool `json:"result,string"`
Code int `json:"code"`
Message string `json:"message"`
Address string `json:"addr"`
Tag string
MultichainAddresses []struct {
Chain string `json:"chain"`
Address string `json:"address"`
PaymentID string `json:"payment_id"`
PaymentName string `json:"payment_name"`
ObtainFailed uint8 `json:"obtain_failed"`
} `json:"multichain_addresses"`
}
DepositAddr stores the deposit address info
type Gateio ¶
Gateio is the overarching type across this package
func (*Gateio) AuthenticateWebsocket ¶
AuthenticateWebsocket sends an authentication message to the websocket
func (*Gateio) CancelAllExistingOrders ¶
CancelAllExistingOrders all orders for a given symbol and side orderType (0: sell,1: buy,-1: unlimited)
func (*Gateio) CancelAllOrders ¶
func (g *Gateio) CancelAllOrders(ctx context.Context, _ *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) CancelExistingOrder ¶
func (g *Gateio) CancelExistingOrder(ctx context.Context, orderID int64, symbol string) (bool, error)
CancelExistingOrder cancels an order given the supplied orderID and symbol orderID order ID number symbol trade pair (ltc_btc)
func (*Gateio) CancelOrder ¶
CancelOrder cancels an order by its corresponding ID number
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 returns the ticker for a currency pair
func (*Gateio) FetchTradablePairs ¶
FetchTradablePairs returns a list of the exchanges tradable pairs
func (*Gateio) FormatExchangeKlineInterval ¶
FormatExchangeKlineInterval returns Interval to exchange formatted string
func (*Gateio) GenerateAuthenticatedSubscriptions ¶
func (g *Gateio) GenerateAuthenticatedSubscriptions() ([]stream.ChannelSubscription, error)
GenerateAuthenticatedSubscriptions returns authenticated subscriptions
func (*Gateio) GenerateDefaultSubscriptions ¶
func (g *Gateio) GenerateDefaultSubscriptions() ([]stream.ChannelSubscription, error)
GenerateDefaultSubscriptions returns default subscriptions
func (*Gateio) GenerateSignature ¶
GenerateSignature returns hash for authenticated requests
func (*Gateio) GetActiveOrders ¶
func (g *Gateio) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest) ([]order.Detail, error)
GetActiveOrders retrieves any orders that are active/open
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) GetBalances ¶
func (g *Gateio) GetBalances(ctx context.Context) (BalancesResponse, error)
GetBalances obtains the users account balance
func (*Gateio) GetCryptoDepositAddress ¶
GetCryptoDepositAddress returns a deposit address for a cryptocurrency
func (*Gateio) GetDefaultConfig ¶
GetDefaultConfig returns a default exchange config
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) 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) GetFundingHistory ¶
GetFundingHistory returns funding history, deposits and withdrawals
func (*Gateio) GetHistoricCandles ¶
func (g *Gateio) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (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, start, end time.Time, interval kline.Interval) (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) GetLatestSpotPrice ¶
GetLatestSpotPrice returns latest spot price of symbol updated every 10 seconds
symbol: string of currency pair
func (*Gateio) GetMarketInfo ¶
func (g *Gateio) GetMarketInfo(ctx context.Context) (MarketInfoResponse, error)
GetMarketInfo returns information about all trading pairs, including transaction fee, minimum order quantity, price accuracy and so on
func (*Gateio) GetOpenOrders ¶
GetOpenOrders retrieves all open orders with an optional symbol filter
func (*Gateio) GetOrderHistory ¶
func (g *Gateio) GetOrderHistory(ctx context.Context, req *order.GetOrdersRequest) ([]order.Detail, 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, assetType asset.Item) (order.Detail, error)
GetOrderInfo returns order information based on order ID
func (*Gateio) GetOrderbook ¶
GetOrderbook returns the orderbook data for a suppled symbol
func (*Gateio) GetRecentTrades ¶
func (g *Gateio) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)
GetRecentTrades returns the most recent trades for a currency and asset
func (*Gateio) GetSpotKline ¶
GetSpotKline returns kline data for the most recent time period
func (*Gateio) GetSymbols ¶
GetSymbols returns all supported symbols
func (*Gateio) GetTicker ¶
GetTicker returns a ticker for the supplied symbol updated every 10 seconds
func (*Gateio) GetTickers ¶
GetTickers returns tickers for all symbols
func (*Gateio) GetTradeHistory ¶
GetTradeHistory retrieves all orders with an optional symbol filter
func (*Gateio) GetWithdrawalsHistory ¶
func (g *Gateio) GetWithdrawalsHistory(ctx context.Context, c currency.Code) (resp []exchange.WithdrawalHistory, err error)
GetWithdrawalsHistory returns previous withdrawals data
func (*Gateio) ModifyOrder ¶
ModifyOrder will allow of changing orderbook placement and limit to market conversion
func (*Gateio) SendAuthenticatedHTTPRequest ¶
func (g *Gateio) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, method, endpoint, param string, 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, 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) SpotNewOrder ¶
func (g *Gateio) SpotNewOrder(ctx context.Context, arg SpotNewOrderRequestParams) (SpotNewOrderResponse, error)
SpotNewOrder places a new order
func (*Gateio) SubmitOrder ¶
SubmitOrder submits a new order TODO: support multiple order types (IOC)
func (*Gateio) Subscribe ¶
func (g *Gateio) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error
Subscribe sends a websocket message to receive data from the channel
func (*Gateio) Unsubscribe ¶
func (g *Gateio) Unsubscribe(channelsToUnsubscribe []stream.ChannelSubscription) error
Unsubscribe sends a websocket message to stop receiving data from the channel
func (*Gateio) UpdateAccountInfo ¶
func (g *Gateio) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
UpdateAccountInfo retrieves balances for all enabled currencies for the ZB exchange
func (*Gateio) UpdateOrderbook ¶
func (g *Gateio) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
UpdateOrderbook updates and returns the orderbook for a currency pair
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 ¶
UpdateTickers updates the ticker for all currency pairs of a given asset type
func (*Gateio) UpdateTradablePairs ¶
UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config
func (*Gateio) ValidateCredentials ¶
ValidateCredentials validates current credentials used for wrapper functionality
func (*Gateio) WithdrawCrypto ¶
func (g *Gateio) WithdrawCrypto(ctx context.Context, curr, address, memo, chain string, amount float64) (*withdraw.ExchangeResponse, error)
WithdrawCrypto withdraws cryptocurrency to your selected wallet
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) 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
type KLineResponse ¶
type KLineResponse struct {
ID float64
KlineTime time.Time
Open float64
Time float64
High float64
Low float64
Close float64
Volume float64
Amount float64 `db:"amount"`
}
KLineResponse K线返回类型
type KlinesRequestParams ¶
type KlinesRequestParams struct {
Symbol string //必填项,交易对:LTCBTC,BTCUSDT
HourSize int //多少个小时内的数据
GroupSec string
}
KlinesRequestParams represents Klines request data.
type MarketInfoPairsResponse ¶
type MarketInfoPairsResponse struct {
Symbol string
// DecimalPlaces 价格精度
DecimalPlaces float64
// MinAmount 最小下单量
MinAmount float64
// Fee 交易费
Fee float64
}
MarketInfoPairsResponse 交易市场的参数信息-交易对
type MarketInfoResponse ¶
type MarketInfoResponse struct {
Result string `json:"result"`
Pairs []MarketInfoPairsResponse `json:"pairs"`
}
MarketInfoResponse holds the market info data
type OpenOrder ¶
type OpenOrder struct {
Amount float64 `json:"amount,string"`
CurrencyPair string `json:"currencyPair"`
FilledAmount float64 `json:"filledAmount,string"`
FilledRate float64 `json:"filledRate"`
InitialAmount float64 `json:"initialAmount"`
InitialRate float64 `json:"initialRate"`
OrderNumber string `json:"orderNumber"`
Rate float64 `json:"rate"`
Status string `json:"status"`
Timestamp int64 `json:"timestamp"`
Total float64 `json:"total,string"`
Type string `json:"type"`
}
OpenOrder details each open order
type OpenOrdersResponse ¶
type OpenOrdersResponse struct {
Code int `json:"code"`
Elapsed string `json:"elapsed"`
Message string `json:"message"`
Orders []OpenOrder `json:"orders"`
Result string `json:"result"`
}
OpenOrdersResponse the main response from GetOpenOrders
type Orderbook ¶
type Orderbook struct {
Result string
Elapsed string
Bids []OrderbookItem
Asks []OrderbookItem
}
Orderbook stores the orderbook data
type OrderbookItem ¶
OrderbookItem stores an orderbook item
type OrderbookResponse ¶
type OrderbookResponse struct {
Result string `json:"result"`
Elapsed string `json:"elapsed"`
Asks [][]string
Bids [][]string
}
OrderbookResponse stores the orderbook data
type SpotMarketInfoPairsResponse ¶
type SpotMarketInfoPairsResponse struct {
Symbol currency.Pair
// DecimalPlaces 价格精度
DecimalPlaces float64
// DecimalPlaces 价格精度
AmountDecimalPlaces float64
// MinAmount 最小下单量
MinAmount float64
// MinAmountA 最小下单量
MinAmountA float64
// MinAmountB 最小下单量
MinAmountB float64
// Fee 交易费
Fee float64
// TradeDisabled 是否禁止交易
TradeDisabled bool
// BuyDisabled 是否禁止买
BuyDisabled bool
// BuyDisabled 是否禁止卖
SellDisabled bool
}
SpotMarketInfoPairsResponse 交易市场的参数信息-交易对
type SpotMarketInfoResponse ¶
type SpotMarketInfoResponse struct {
Result string `json:"result"`
Pairs []SpotMarketInfoPairsResponse `json:"pairs"`
}
SpotMarketInfoResponse holds the market info data
type SpotNewOrderRequestParams ¶
type SpotNewOrderRequestParams struct {
Amount float64 `json:"amount"` // Order quantity
Price float64 `json:"price"` // Order price
Symbol string `json:"symbol"` // Trading pair; btc_usdt, eth_btc......
Type string `json:"type"` // Order type (buy or sell),
}
SpotNewOrderRequestParams 下单买入/卖出请求参数
type SpotNewOrderResponse ¶
type SpotNewOrderResponse struct {
OrderNumber int64 `json:"orderNumber"` // OrderID number
Price float64 `json:"rate,string"` // Order price
LeftAmount float64 `json:"leftAmount,string"` // The remaining amount to fill
FilledAmount float64 `json:"filledAmount,string"` // The filled amount
Filledrate interface{} `json:"filledRate"` // FilledPrice. if we send a market order, the exchange returns float64.
}
SpotNewOrderResponse 下单买入/卖出返回的类型
type TickerResponse ¶
type TickerResponse struct {
Period int64 `json:"period"`
BaseVolume float64 `json:"baseVolume,string"`
Change float64 `json:"change,string"`
Close float64 `json:"close,string"`
High float64 `json:"high,string"`
Last float64 `json:"last,string"`
Low float64 `json:"low,string"`
Open float64 `json:"open,string"`
QuoteVolume float64 `json:"quoteVolume,string"`
}
TickerResponse holds the ticker response data
type TradHistoryResponse ¶
type TradHistoryResponse struct {
Code int `json:"code,omitempty"`
Elapsed string `json:"elapsed,omitempty"`
Message string `json:"message"`
Trades []TradesResponse `json:"trades"`
Result string `json:"result"`
}
TradHistoryResponse The full response for retrieving all user trade history
type TradeHistory ¶
type TradeHistory struct {
Elapsed string `json:"elapsed"`
Result bool `json:"result,string"`
Data []TradeHistoryEntry `json:"data"`
}
TradeHistory contains trade history data
type TradeHistoryEntry ¶
type TradeHistoryEntry struct {
Amount float64 `json:"amount,string"`
Date string `json:"date"`
Rate float64 `json:"rate,string"`
Timestamp int64 `json:"timestamp,string"`
Total float64 `json:"total,string"`
TradeID string `json:"tradeID"`
Type string `json:"type"`
}
TradeHistoryEntry contains an individual trade
type TradesResponse ¶
type TradesResponse struct {
ID int64 `json:"tradeID"`
OrderID int64 `json:"orderNumber"`
Pair string `json:"pair"`
Type string `json:"type"`
Side string `json:"side"`
Rate float64 `json:"rate,string"`
Amount float64 `json:"amount,string"`
Total float64 `json:"total"`
Time string `json:"date"`
TimeUnix int64 `json:"time_unix"`
}
TradesResponse details trade history
type WebSocketOrderQueryRecords ¶
type WebSocketOrderQueryRecords struct {
ID int64 `json:"id"`
Market string `json:"market"`
User int64 `json:"user"`
Ctime float64 `json:"ctime"`
Mtime float64 `json:"mtime"`
Price float64 `json:"price,string"`
Amount float64 `json:"amount,string"`
Left float64 `json:"left,string"`
DealFee float64 `json:"dealFee,string"`
OrderType int64 `json:"orderType"`
Type int64 `json:"type"`
FilledAmount float64 `json:"filledAmount,string"`
FilledTotal float64 `json:"filledTotal,string"`
}
WebSocketOrderQueryRecords contains order information from a order.query websocket request
type WebSocketOrderQueryResult ¶
type WebSocketOrderQueryResult struct {
Error WebsocketError `json:"error"`
Limit int `json:"limit"`
Offset int `json:"offset"`
Total int `json:"total"`
WebSocketOrderQueryRecords []WebSocketOrderQueryRecords `json:"records"`
}
WebSocketOrderQueryResult data returned from a websocket ordre query holds slice of WebSocketOrderQueryRecords
type WebsocketAuthenticationResponse ¶
type WebsocketAuthenticationResponse struct {
Error struct {
Code int `json:"code"`
Message string `json:"message"`
} `json:"error"`
Result struct {
Status string `json:"status"`
} `json:"result"`
ID int64 `json:"id"`
}
WebsocketAuthenticationResponse contains the result of a login request
type WebsocketBalance ¶
type WebsocketBalance struct {
Currency []WebsocketBalanceCurrency
}
WebsocketBalance holds a slice of WebsocketBalanceCurrency
type WebsocketBalanceCurrency ¶
type WebsocketBalanceCurrency struct {
Currency string
Available string `json:"available"`
Locked string `json:"freeze"`
}
WebsocketBalanceCurrency contains currency name funds available and frozen
type WebsocketError ¶
WebsocketError defines a websocket error type
type WebsocketRequest ¶
type WebsocketRequest struct {
ID int64 `json:"id"`
Method string `json:"method"`
Params []interface{} `json:"params"`
Channels []stream.ChannelSubscription `json:"-"` // used for tracking associated channel subs on batched requests
}
WebsocketRequest defines the initial request in JSON
type WebsocketResponse ¶
type WebsocketResponse struct {
Time int64 `json:"time"`
Channel string `json:"channel"`
Error WebsocketError `json:"error"`
Result json.RawMessage `json:"result"`
ID int64 `json:"id"`
Method string `json:"method"`
Params []json.RawMessage `json:"params"`
}
WebsocketResponse defines a websocket response from gateio
type WebsocketTicker ¶
type WebsocketTicker struct {
Period int64 `json:"period"`
Open float64 `json:"open,string"`
Close float64 `json:"close,string"`
High float64 `json:"high,string"`
Low float64 `json:"Low,string"`
Last float64 `json:"last,string"`
Change float64 `json:"change,string"`
QuoteVolume float64 `json:"quoteVolume,string"`
BaseVolume float64 `json:"baseVolume,string"`
}
WebsocketTicker defines ticker data
type WebsocketTrade ¶
type WebsocketTrade struct {
ID int64 `json:"id"`
Time float64 `json:"time"`
Price float64 `json:"price,string"`
Amount float64 `json:"amount,string"`
Type string `json:"type"`
}
WebsocketTrade defines trade data
type WsGetBalanceResponse ¶
type WsGetBalanceResponse struct {
Error WebsocketError `json:"error"`
Result map[string]WsGetBalanceResponseData `json:"result"`
ID int64 `json:"id"`
}
WsGetBalanceResponse stores WS GetBalance response
type WsGetBalanceResponseData ¶
type WsGetBalanceResponseData struct {
Available float64 `json:"available,string"`
Freeze float64 `json:"freeze,string"`
}
WsGetBalanceResponseData contains currency data