Documentation
¶
Index ¶
- Constants
- Variables
- type Account
- type CloseOrders
- type ClosedOrdersQuery
- func (param *ClosedOrdersQuery) Check() error
- func (param *ClosedOrdersQuery) WithEnd(end int64) *ClosedOrdersQuery
- func (param *ClosedOrdersQuery) WithLimit(limit uint32) *ClosedOrdersQuery
- func (param *ClosedOrdersQuery) WithOffset(offset uint32) *ClosedOrdersQuery
- func (param *ClosedOrdersQuery) WithSide(side string) *ClosedOrdersQuery
- func (param *ClosedOrdersQuery) WithStart(start int64) *ClosedOrdersQuery
- func (param *ClosedOrdersQuery) WithSymbol(baseAssetSymbol, quoteAssetSymbol string) *ClosedOrdersQuery
- type Coin
- type DepthQuery
- type Kline
- type KlineQuery
- type MarketDepth
- type MarketsQuery
- type NodeInfo
- type NodeInfoOther
- type OpenOrders
- type OpenOrdersQuery
- type Order
- type QueryClient
- type ResultStatus
- type SymbolPair
- type SyncInfo
- type Ticker24h
- type Ticker24hQuery
- type Time
- type Token
- type Trade
- type Trades
- type TradesQuery
- type ValidatorInfo
Constants ¶
View Source
const ( SideBuy = "BUY" SideSell = "SELL" )
Variables ¶
View Source
var ( // Param error AddressMissingError = errors.New("Address is required ") SymbolMissingError = errors.New("Symbol is required ") OffsetOutOfRangeError = errors.New("offset out of range ") LimitOutOfRangeError = errors.New("limit out of range ") TradeSideMisMatchError = errors.New("Trade side is invalid ") StartTimeOutOfRangeError = errors.New("start time out of range ") EndTimeOutOfRangeError = errors.New("end time out of range ") IntervalMissingError = errors.New("interval is required ") EndTimeLessThanStartTimeError = errors.New("end time should great than start time") OrderIdMissingError = errors.New("order id is required ") )
View Source
var OrderSide = struct { BUY string SELL string }{ "BUY", "SELL", }
OrderSide enum
View Source
var OrderStatus = struct { ACK string PARTIALLY_FILLED string IOC_NO_FILL string FULLY_FILLED string CANCELED string EXPIRED string UNKNOWN string }{ "ACK", "PARTIALLY_FILLED", "IOC_NO_FILL", "FULLY_FILLED", "CANCELED", "EXPIRED", "UNKNOWN", }
OrderStatus enum
View Source
var OrderType = struct { LIMIT string MARKET string STOP_LOSS string STOP_LOSS_LIMIT string TAKE_PROFIT string TAKE_PROFIT_LIMIT string LIMIT_MAKER string }{ "LIMIT", "MARKET", "STOP_LOSS", "STOP_LOSS_LIMIT", "TAKE_PROFIT", "TAKE_PROFIT_LIMIT", "LIMIT_MAKER", }
OrderType enum
View Source
var TimeInForce = struct { GTC string IOC string }{"GTC", "IOC"}
TimeInForce enum
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
Number int64 `json:"account_number"`
Address string `json:"address"`
Balances []Coin `json:"balances"`
PublicKey []uint8 `json:"public_key"`
Sequence int64 `json:"sequence"`
}
Account definition
type CloseOrders ¶
type ClosedOrdersQuery ¶
type ClosedOrdersQuery struct {
SenderAddress string `json:"address"` // required
Symbol string `json:"symbol,omitempty"` //option
Offset *uint32 `json:"offset,omitempty,string"` //option
Limit *uint32 `json:"limit,omitempty,string"` //option
Start *int64 `json:"start,omitempty,string"` //option
End *int64 `json:"end,omitempty,string"` //option
Side string `json:"side,omitempty"` //option
Total int `json:"total,string"` //0 for not required and 1 for required; default not required, return total=-1 in response
}
func NewClosedOrdersQuery ¶
func NewClosedOrdersQuery(senderAddress string, withTotal bool) *ClosedOrdersQuery
func (*ClosedOrdersQuery) Check ¶
func (param *ClosedOrdersQuery) Check() error
func (*ClosedOrdersQuery) WithEnd ¶
func (param *ClosedOrdersQuery) WithEnd(end int64) *ClosedOrdersQuery
func (*ClosedOrdersQuery) WithLimit ¶
func (param *ClosedOrdersQuery) WithLimit(limit uint32) *ClosedOrdersQuery
func (*ClosedOrdersQuery) WithOffset ¶
func (param *ClosedOrdersQuery) WithOffset(offset uint32) *ClosedOrdersQuery
func (*ClosedOrdersQuery) WithSide ¶
func (param *ClosedOrdersQuery) WithSide(side string) *ClosedOrdersQuery
func (*ClosedOrdersQuery) WithStart ¶
func (param *ClosedOrdersQuery) WithStart(start int64) *ClosedOrdersQuery
func (*ClosedOrdersQuery) WithSymbol ¶
func (param *ClosedOrdersQuery) WithSymbol(baseAssetSymbol, quoteAssetSymbol string) *ClosedOrdersQuery
type Coin ¶
type Coin struct {
Symbol string `json:"symbol"` // ex: BNB
Free string `json:"free"` // in decimal, ex: 0.00000000
Locked string `json:"locked"` // in decimal, ex: 0.00000000
Frozen string `json:"frozen"` // in decimal, ex: 0.00000000
}
Coin def
type DepthQuery ¶
type DepthQuery struct {
Symbol string `json:"symbol"`
Limit *uint32 `json:"limit,omitempty,string"`
}
DepthQuery
func NewDepthQuery ¶
func NewDepthQuery(baseAssetSymbol, quoteAssetSymbol string) *DepthQuery
func (*DepthQuery) Check ¶
func (param *DepthQuery) Check() error
func (*DepthQuery) WithLimit ¶
func (param *DepthQuery) WithLimit(limit uint32) *DepthQuery
type Kline ¶
type Kline struct {
Close float64 `json:"close,string"`
CloseTime int64 `json:"closeTime"`
High float64 `json:"high,string"`
Low float64 `json:"low,string"`
NumberOfTrades int32 `json:"numberOfTrades"`
Open float64 `json:"open,string"`
OpenTime int64 `json:"openTime"`
QuoteAssetVolume float64 `json:"quoteAssetVolume,string"`
Volume float64 `json:"volume,string"`
}
Kline def
type KlineQuery ¶
type KlineQuery struct {
Symbol string `json:"symbol"` // required
Interval string `json:"interval"` // required, interval (5m, 1h, 1d, 1w, etc.)
Limit *uint32 `json:"limit,omitempty,string"`
StartTime *int64 `json:"start_time,omitempty,string"`
EndTime *int64 `json:"end_time,omitempty,string"`
}
KlineQuery def
func NewKlineQuery ¶
func NewKlineQuery(baseAssetSymbol, quoteAssetSymbol, interval string) *KlineQuery
func (*KlineQuery) Check ¶
func (param *KlineQuery) Check() error
func (*KlineQuery) WithEndTime ¶
func (param *KlineQuery) WithEndTime(end int64) *KlineQuery
func (*KlineQuery) WithLimit ¶
func (param *KlineQuery) WithLimit(limit uint32) *KlineQuery
func (*KlineQuery) WithStartTime ¶
func (param *KlineQuery) WithStartTime(start int64) *KlineQuery
type MarketDepth ¶
type MarketDepth struct {
Bids [][]string `json:"bids"` // "bids": [ [ "0.0024", "10" ] ]
Asks [][]string `json:"asks"` // "asks": [ [ "0.0024", "10" ] ]
Height int64 `json:"height"`
}
MarketDepth broad caste to the user
type MarketsQuery ¶
type MarketsQuery struct {
Offset *uint32 `json:"offset,omitempty,string"` //Option
Limit *uint32 `json:"limit,omitempty,string"` //Option
}
func NewMarketsQuery ¶
func NewMarketsQuery() *MarketsQuery
func (*MarketsQuery) Check ¶
func (param *MarketsQuery) Check() error
func (*MarketsQuery) WithLimit ¶
func (param *MarketsQuery) WithLimit(limit uint32) *MarketsQuery
func (*MarketsQuery) WithOffset ¶
func (param *MarketsQuery) WithOffset(offset uint32) *MarketsQuery
type NodeInfo ¶
type NodeInfo struct {
// Authenticate
// TODO: replace with NetAddress
ID string `json:"id"` // authenticated identifier
ListenAddr string `json:"listen_addr"` // accepting incoming
// Check compatibility.
// Channels are HexBytes so easier to read as JSON
Network string `json:"network"` // network/chain ID
Version string `json:"version"` // major.minor.revision
Channels crypto.HexBytes `json:"channels"` // channels this node knows about
// ASCIIText fields
Moniker string `json:"moniker"` // arbitrary moniker
Other NodeInfoOther `json:"other"` // other application specific data
}
type NodeInfoOther ¶
type OpenOrders ¶
type OpenOrdersQuery ¶
type OpenOrdersQuery struct {
SenderAddress string `json:"address"` // required
Symbol string `json:"symbol,omitempty"`
Offset *uint32 `json:"offset,omitempty,string"`
Limit *uint32 `json:"limit,omitempty,string"`
Total int `json:"total,string"` //0 for not required and 1 for required; default not required, return total=-1 in response
}
OpenOrdersQuery def
func NewOpenOrdersQuery ¶
func NewOpenOrdersQuery(senderAddress string, withTotal bool) *OpenOrdersQuery
func (*OpenOrdersQuery) Check ¶
func (param *OpenOrdersQuery) Check() error
func (*OpenOrdersQuery) WithLimit ¶
func (param *OpenOrdersQuery) WithLimit(limit uint32) *OpenOrdersQuery
func (*OpenOrdersQuery) WithOffset ¶
func (param *OpenOrdersQuery) WithOffset(offset uint32) *OpenOrdersQuery
func (*OpenOrdersQuery) WithSymbol ¶
func (param *OpenOrdersQuery) WithSymbol(symbol string) *OpenOrdersQuery
type Order ¶
type Order struct {
ID string `json:"orderId"`
Owner string `json:"owner"`
Symbol string `json:"symbol"`
Price string `json:"price"`
Quantity string `json:"quantity"`
CumulateQuantity string `json:"cumulateQuantity"`
Fee string `json:"fee"`
Side int `json:"side"` // BUY or SELL
Status string `json:"status"`
TimeInForce int `json:"timeInForce"`
Type int `json:"type"`
TradeId string `json:"tradeId"`
LastExecutedPrice string `json:"last_executed_price"`
LastExecutedQuantity string `json:"lastExecutedQuantity"`
TransactionHash string `json:"transactionHash"`
OrderCreateTime string `json:"orderCreateTime"`
TransactionTime string `json:"transactionTime"`
}
Order def
type QueryClient ¶
type QueryClient interface {
GetClosedOrders(query *ClosedOrdersQuery) (*CloseOrders, error)
GetDepth(query *DepthQuery) (*MarketDepth, error)
GetKlines(query *KlineQuery) ([]Kline, error)
GetMarkets(query *MarketsQuery) ([]SymbolPair, error)
GetOrder(orderID string) (*Order, error)
GetOpenOrders(query *OpenOrdersQuery) (*OpenOrders, error)
GetTicker24h(query *Ticker24hQuery) ([]Ticker24h, error)
GetTrades(query *TradesQuery) (*Trades, error)
GetAccount(string) (*Account, error)
GetTime() (*Time, error)
GetTokens() ([]Token, error)
GetNodeInfo() (*ResultStatus, error)
}
func NewClient ¶
func NewClient(c basic.BasicClient) QueryClient
type ResultStatus ¶
type ResultStatus struct {
NodeInfo NodeInfo `json:"node_info"`
SyncInfo SyncInfo `json:"sync_info"`
ValidatorInfo ValidatorInfo `json:"validator_info"`
}
Account definition
type SymbolPair ¶
type SymbolPair struct {
TradeAsset string `json:"base_asset_symbol"`
QuoteAsset string `json:"quote_asset_symbol"`
Price string `json:"price"`
TickSize string `json:"tick_size"`
LotSize string `json:"lot_size"`
}
SymbolPair definition
type Ticker24h ¶
type Ticker24h struct {
Symbol string `json:"symbol"`
AskPrice string `json:"askPrice"` // In decimal form, e.g. 1.00000000
AskQuantity string `json:"askQuantity"` // In decimal form, e.g. 1.00000000
BidPrice string `json:"bidPrice"` // In decimal form, e.g. 1.00000000
BidQuantity string `json:"bidQuantity"` // In decimal form, e.g. 1.00000000
CloseTime int64 `json:"closeTime"`
Count int64 `json:"count"`
FirstID string `json:"firstId"`
HighPrice string `json:"highPrice"` // In decimal form, e.g. 1.00000000
LastID string `json:"lastId"`
LastPrice string `json:"lastPrice"` // In decimal form, e.g. 1.00000000
LastQuantity string `json:"lastQuantity"` // In decimal form, e.g. 1.00000000
LowPrice string `json:"lowPrice"` // In decimal form, e.g. 1.00000000
OpenPrice string `json:"openPrice"` // In decimal form, e.g. 1.00000000
OpenTime int64 `json:"openTime"`
PrevClosePrice string `json:"prevClosePrice"` // In decimal form, e.g. 1.00000000
PriceChange string `json:"priceChange"` // In decimal form, e.g. 1.00000000
PriceChangePercent string `json:"priceChangePercent"`
QuoteVolume string `json:"quoteVolume"` // In decimal form, e.g. 1.00000000
Volume string `json:"volume"` // In decimal form, e.g. 1.00000000
WeightedAvgPrice string `json:"weightedAvgPrice"` // In decimal form, e.g. 1.00000000
}
Ticker24h def
type Ticker24hQuery ¶
type Ticker24hQuery struct {
Symbol string `json:"symbol,omitempty"`
}
func NewTicker24hQuery ¶
func NewTicker24hQuery() *Ticker24hQuery
func (*Ticker24hQuery) WithSymbol ¶
func (param *Ticker24hQuery) WithSymbol(baseAssetSymbol, quoteAssetSymbol string) *Ticker24hQuery
type Token ¶
type Token struct {
Name string `json:"name"`
Symbol string `json:"symbol"`
TotalSupply string `json:"total_supply"`
Owner string `json:"owner"`
OriginalSymbol string `json:"original_symbol"`
}
Token definition
type Trade ¶
type Trade struct {
BuyerOrderID string `json:"buyerOrderId"`
BuyFee string `json:"buyFee"`
BuyerId string `json:"buyerId"`
Price string `json:"price"`
Quantity string `json:"quantity"`
SellFee string `json:"sellFee"`
SellerId string `json:"sellerId"`
SellerOrderID string `json:"sellerOrderId"`
Symbol string `json:"symbol"`
Time int64 `json:"time"`
TradeID string `json:"tradeId"`
BlockHeight int64 `json:"blockHeight"`
BaseAsset string `json:"baseAsset"`
QuoteAsset string `json:"quoteAsset"`
}
Trade def
type TradesQuery ¶
type TradesQuery = ClosedOrdersQuery
TradesQuery def
func NewTradesQuery ¶
func NewTradesQuery(senderAddres string, withTotal bool) *TradesQuery
Click to show internal directories.
Click to hide internal directories.