spotclient

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MissParameters                 = "miss parameters"
	SymbolEmpty                    = "symbol cannot be empty"
	IntervalEmpty                  = "interval cannot be empty"
	CoinEmpty                      = "coin cannot be empty"
	AddressEmpty                   = "address cannot be empty"
	AmountInvalid                  = "amount cannot less than or equal zero"
	AssetEmpty                     = "asset cannot be empty"
	TimeInForce                    = "timeInForce cannot be empty"
	PriceInvalid                   = "price cannot less than or equal zero"
	StopPriceInvalid               = "stopPrice cannot less than or equal zero"
	QuantityInvalid                = "quantity cannot less than or equal zero"
	QuantityOrQuoteOrderQtyInvalid = "quantity or quoteOrderQty cannot less than or equal zero"
	InvalidParameters              = "invalid parameters"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountDividendRecordResponse

type AccountDividendRecordResponse struct {
	Rows []struct {
		Amount  string `json:"amount"`
		Asset   string `json:"asset"`
		DivTime int64  `json:"divTime"`
		EnInfo  string `json:"enInfo"`
		TranID  int64  `json:"tranId"`
	} `json:"rows"`
	Total int `json:"total"`
}

AccountDividendRecordResponse Query asset dividend record.

type AccountInfoResponse

type AccountInfoResponse struct {
	MakerCommission  int64  `json:"makerCommission"`
	TakerCommission  int64  `json:"takerCommission"`
	BuyerCommission  int64  `json:"buyerCommission"`
	SellerCommission int64  `json:"sellerCommission"`
	CanTrade         bool   `json:"canTrade"`
	CanWithdraw      bool   `json:"canWithdraw"`
	CanDeposit       bool   `json:"canDeposit"`
	UpdateTime       int    `json:"updateTime"`
	AccountType      string `json:"accountType"`
	Balances         []struct {
		Asset  string `json:"asset"`
		Free   string `json:"free"`
		Locked string `json:"locked"`
	} `json:"balances"`
	Permissions []string `json:"permissions"`
}

AccountInfoResponse account information

type AccountSAPIStatusResponse

type AccountSAPIStatusResponse struct {
	Data struct {
		IsLocked           bool `json:"isLocked"`
		PlannedRecoverTime int  `json:"plannedRecoverTime"` // If API trading function is locked, this is the planned recover time
		TriggerCondition   struct {
			GCR  int `json:"GCR"`  // Number of GTC orders
			IFER int `json:"IFER"` // Number of FOK/IOC orders
			UFR  int `json:"UFR"`  // Number of orders
		} `json:"triggerCondition"`
		Indicators map[string][]struct {
			Unfilled     string          `json:"i"` // Unfilled Ratio (UFR)
			Count        int64           `json:"c"` // Count of all order
			Value        decimal.Decimal `json:"v"` // Current value
			TriggerValue decimal.Decimal `json:"t"` // Trigger value
		} `json:"indicators"`
		UpdateTime int64 `json:"updateTime"`
	} `json:"data"`
}

AccountSAPIStatusResponse account API trading status response

type AccountTradesListResponse

type AccountTradesListResponse []struct {
	Symbol          string `json:"symbol"`
	ID              int64  `json:"id"`
	OrderID         int64  `json:"orderId"`
	OrderListID     int64  `json:"orderListId"`
	Price           string `json:"price"`
	Qty             string `json:"qty"`
	QuoteQty        string `json:"quoteQty"`
	Commission      string `json:"commission"`
	CommissionAsset string `json:"commissionAsset"`
	Time            int64  `json:"time"`
	IsBuyer         bool   `json:"isBuyer"`
	IsMaker         bool   `json:"isMaker"`
	IsBestMatch     bool   `json:"isBestMatch"`
}

AccountTradesListResponse account trades list

type AggregateTradeResponse

type AggregateTradeResponse []struct {
	TradeID          int64  `json:"a"` // Aggregate tradeId
	Price            string `json:"p"` // Price
	Quantity         string `json:"q"` // Quantity
	FirstTradeID     int64  `json:"f"` // First tradeId
	LastTradeID      int64  `json:"l"` // Last tradeId
	TimeStamp        int64  `json:"T"` // Timestamp
	IsBuyerMarker    bool   `json:"m"` // Was the buyer the maker?
	IsBestPriceMatch bool   `json:"M"` // Was the trade the best price match?
}

AggregateTradeResponse Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.

type AllCoinInfoResponse

type AllCoinInfoResponse []struct {
	Coin             string `json:"coin"`
	DepositAllEnable bool   `json:"depositAllEnable"`
	Free             string `json:"free"`
	Freeze           string `json:"freeze"`
	IPOAble          string `json:"ipoable"`
	IPOIng           string `json:"ipoing"`
	IsLegalMoney     bool   `json:"isLegalMoney"`
	Locked           string `json:"locked"`
	Name             string `json:"name"`
	NetworkList      []struct {
		AddressRegex            string `json:"addressRegex"`
		Coin                    string `json:"coin"`
		DepositDesc             string `json:"depositDesc,omitempty"`
		DepositEnable           bool   `json:"depositEnable"`
		IsDefault               bool   `json:"isDefault"`
		MemoRegex               string `json:"memoRegex"`
		MinConfirm              int    `json:"minConfirm"`
		Name                    string `json:"name"`
		Network                 string `json:"network"`
		ResetAddressStatus      bool   `json:"resetAddressStatus"`
		SpecialTips             string `json:"specialTips"`
		UnLockConfirm           int    `json:"unLockConfirm"`
		WithdrawDesc            string `json:"withdrawDesc,omitempty"`
		WithdrawEnable          bool   `json:"withdrawEnable"`
		WithdrawFee             string `json:"withdrawFee"`
		WithdrawMin             string `json:"withdrawMin"`
		InsertTime              int64  `json:"insertTime,omitempty"`
		UpdateTime              int64  `json:"updateTime,omitempty"`
		WithdrawIntegerMultiple string `json:"withdrawIntegerMultiple,omitempty"`
	} `json:"networkList"`
	Storage           string `json:"storage"`
	Trading           bool   `json:"trading"`
	WithdrawAllEnable bool   `json:"withdrawAllEnable"`
	Withdrawing       string `json:"withdrawing"`
}

AllCoinInfoResponse all coin info response

type CandlestickResponse

type CandlestickResponse []interface{}

CandlestickResponse kline response

type CommonClient

type CommonClient struct {
	Builder *binance.PublicUrlBuilder
}

CommonClient responsible to get common information

func NewCommonClient

func NewCommonClient(host string) *CommonClient

NewCommonClient Initializer

func (*CommonClient) GetSAPISystemStatus

func (c *CommonClient) GetSAPISystemStatus() (interface{}, error)

GetSAPISystemStatus get system status

func (*CommonClient) GetServerTime

func (c *CommonClient) GetServerTime() (int64, error)

GetServerTime get server's time

func (*CommonClient) Ping

func (c *CommonClient) Ping() (interface{}, error)

Ping test server

type CurrentAveragePriceResponse

type CurrentAveragePriceResponse struct {
	Min   int    `json:"mins"`
	Price string `json:"price"`
}

CurrentAveragePriceResponse Current average price for a symbol.

type DeleteOCOResponse

type DeleteOCOResponse struct {
	OrderListID       int64  `json:"orderListId"`
	ContingencyType   string `json:"contingencyType"`
	ListStatusType    string `json:"listStatusType"`
	ListOrderStatus   string `json:"listOrderStatus"`
	ListClientOrderID string `json:"listClientOrderId"`
	TransactionTime   int64  `json:"transactionTime"`
	Symbol            string `json:"symbol"`
	Orders            []struct {
		Symbol        string `json:"symbol"`
		OrderID       int64  `json:"orderId"`
		ClientOrderID string `json:"clientOrderId"`
	} `json:"orders"`
	OrderReports []struct {
		Symbol             string `json:"symbol"`
		OrigClientOrderID  string `json:"origClientOrderId"`
		OrderID            int64  `json:"orderId"`
		OrderListID        int64  `json:"orderListId"`
		ClientOrderID      string `json:"clientOrderId"`
		Price              string `json:"price"`
		OrigQty            string `json:"origQty"`
		ExecutedQty        string `json:"executedQty"`
		CumulativeQuoteQty string `json:"cummulativeQuoteQty"`
		Status             string `json:"status"`
		TimeInForce        string `json:"timeInForce"`
		Type               string `json:"type"`
		Side               string `json:"side"`
		StopPrice          string `json:"stopPrice,omitempty"`
	} `json:"orderReports"`
}

DeleteOCOResponse delete oco order response

type DeleteOpenOrderResponse

type DeleteOpenOrderResponse []struct {
	Symbol             string `json:"symbol"`
	OrigClientOrderID  string `json:"origClientOrderId,omitempty"`
	OrderID            int64  `json:"orderId,omitempty"`
	OrderListID        int64  `json:"orderListId"`
	ClientOrderID      string `json:"clientOrderId,omitempty"`
	Price              string `json:"price,omitempty"`
	OrigQty            string `json:"origQty,omitempty"`
	ExecutedQty        string `json:"executedQty,omitempty"`
	CumulativeQuoteQty string `json:"cummulativeQuoteQty,omitempty"`
	Status             string `json:"status,omitempty"`
	TimeInForce        string `json:"timeInForce,omitempty"`
	Type               string `json:"type,omitempty"`
	Side               string `json:"side,omitempty"`
	ContingencyType    string `json:"contingencyType,omitempty"`
	ListStatusType     string `json:"listStatusType,omitempty"`
	ListOrderStatus    string `json:"listOrderStatus,omitempty"`
	ListClientOrderID  string `json:"listClientOrderId,omitempty"`
	TransactionTime    int64  `json:"transactionTime,omitempty"`
	Orders             []struct {
		Symbol        string `json:"symbol"`
		OrderID       int64  `json:"orderId"`
		ClientOrderID string `json:"clientOrderId"`
	} `json:"orders,omitempty"`
	OrderReports []struct {
		Symbol             string `json:"symbol"`
		OrigClientOrderID  string `json:"origClientOrderId"`
		OrderID            int64  `json:"orderId"`
		OrderListID        int64  `json:"orderListId"`
		ClientOrderID      string `json:"clientOrderId"`
		Price              string `json:"price"`
		OrigQty            string `json:"origQty"`
		ExecutedQty        string `json:"executedQty"`
		CumulativeQuoteQty string `json:"cummulativeQuoteQty"`
		Status             string `json:"status"`
		TimeInForce        string `json:"timeInForce"`
		Type               string `json:"type"`
		Side               string `json:"side"`
		StopPrice          string `json:"stopPrice,omitempty"`
		IcebergQty         string `json:"icebergQty"`
	} `json:"orderReports,omitempty"`
}

DeleteOpenOrderResponse delete all open orders

type DeleteOrderResponse

type DeleteOrderResponse struct {
	Symbol             string `json:"symbol"`
	OrigClientOrderID  string `json:"origClientOrderId"`
	OrderID            int64  `json:"orderId"`
	OrderListID        int64  `json:"orderListId"`
	ClientOrderID      string `json:"clientOrderId"`
	Price              string `json:"price"`
	OrigQty            string `json:"origQty"`
	ExecutedQty        string `json:"executedQty"`
	CumulativeQuoteQty string `json:"cummulativeQuoteQty"`
	Status             string `json:"status"`
	TimeInForce        string `json:"timeInForce"`
	Type               string `json:"type"`
	Side               string `json:"side"`
}

DeleteOrderResponse delete a order

type DepositAddressNetworkResponse

type DepositAddressNetworkResponse struct {
	Address string `json:"address"`
	Coin    string `json:"coin"`
	Tag     string `json:"tag"`
	Url     string `json:"url"`
}

DepositAddressNetworkResponse deposit address response

type DepositAddressResponse

type DepositAddressResponse struct {
	Address    string `json:"address"`
	Success    bool   `json:"success"`
	AddressTag string `json:"addressTag"`
	Asset      string `json:"asset"`
}

DepositAddressResponse deposit address response

type DepositHistoryNetworkResponse

type DepositHistoryNetworkResponse []struct {
	Amount       string `json:"amount"`
	Coin         string `json:"coin"`
	Network      string `json:"network"`
	Status       int    `json:"status"`
	Address      string `json:"address"`
	AddressTag   string `json:"addressTag"`
	TxID         string `json:"txId"`
	InsertTime   int64  `json:"insertTime"`
	TransferType int    `json:"transferType"`
	ConfirmTimes string `json:"confirmTimes"`
}

DepositHistoryNetworkResponse DepositHistoryNetwork response

type DepositHistoryResponse

type DepositHistoryResponse struct {
	DepositList []struct {
		InsertTime int64           `json:"insertTime"`
		Amount     decimal.Decimal `json:"amount"`
		Asset      string          `json:"asset"`
		Address    string          `json:"address"`
		TxID       string          `json:"txId"`
		Status     int             `json:"status"`
		AddressTag string          `json:"addressTag,omitempty"`
	} `json:"depositList"`
	Success bool `json:"success"`
}

DepositHistoryResponse DepositHistory response

type DustLogSAPIResponse

type DustLogSAPIResponse struct {
	Total             int `json:"total"`
	UserAssetDriblets []struct {
		TotalTransferredAmount   string `json:"totalTransferedAmount"`
		TotalServiceChargeAmount string `json:"totalServiceChargeAmount"`
		TransId                  int64  `json:"transId"`
		UserAssetDribletDetails  []struct {
			TransId             int         `json:"transId"`
			ServiceChargeAmount string      `json:"serviceChargeAmount"`
			Amount              string      `json:"amount"`
			OperateTime         interface{} `json:"operateTime"`
			TransferredAmount   string      `json:"transferedAmount"`
			FromAsset           string      `json:"fromAsset"`
		} `json:"userAssetDribbletDetails"`
		OperateTime int64 `json:"operateTime,omitempty"`
	} `json:"userAssetDribblets"`
}

DustLogSAPIResponse Fetch small amounts of assets exchanged BNB records

type DustTransferResponse

type DustTransferResponse struct {
	TotalServiceCharge string `json:"totalServiceCharge"`
	TotalTransferred   string `json:"totalTransfered"`
	TransferResult     []struct {
		Amount              string `json:"amount"`
		FromAsset           string `json:"fromAsset"`
		OperateTime         int64  `json:"operateTime"`
		ServiceChargeAmount string `json:"serviceChargeAmount"`
		TranId              int64  `json:"tranId"`
		TransferredAmount   string `json:"transferedAmount"`
	} `json:"transferResult"`
}

DustTransferResponse Convert dust assets to BNB.

type ExchangeInfoResponse

type ExchangeInfoResponse struct {
	TimeZone   string `json:"timezone"`   // timezone
	ServerTime int64  `json:"serverTime"` // server time
	RateLimits []struct {
		RateLimitType string `json:"rateLimitType"` // rateLimitType
		Interval      string `json:"interval"`      // interval
		IntervalNum   int64  `json:"intervalNum"`   // intervalNum
		Limit         int64  `json:"limit"`         // limit
	} `json:"rateLimits"` // rate limits
	ExchangeFilters []interface{} `json:"exchangeFilters"` // exchangeFilters
	Symbols         []struct {
		Symbol                 string                   `json:"symbol"`                 // symbol
		Status                 string                   `json:"status"`                 // status
		BaseAsset              string                   `json:"baseAsset"`              // baseAsset
		BaseAssetPrecision     int64                    `json:"baseAssetPrecision"`     // baseAssetPrecision
		QuoteAsset             string                   `json:"quoteAsset"`             // quoteAsset
		QuotePrecision         int64                    `json:"quotePrecision"`         // quotePrecision
		QuoteAssetPrecision    int64                    `json:"quoteAssetPrecision"`    // quoteAssetPrecision
		OrderTypes             []string                 `json:"orderTypes"`             // order types
		IcebergAllowed         bool                     `json:"icebergAllowed"`         // icebergAllowed
		OCOAllowed             bool                     `json:"ocoAllowed"`             // ocoAllowed
		IsSpotTradingAllowed   bool                     `json:"isSpotTradingAllowed"`   // isSpotTradingAllowed
		IsMarginTradingAllowed bool                     `json:"isMarginTradingAllowed"` // isMarginTradingAllowed
		Filters                []map[string]interface{} `json:"filters"`                // Filters
		Permissions            []string                 `json:"permissions"`            // Permissions
	} `json:"symbols"` // symbols
}

ExchangeInfoResponse Current exchange trading rules and symbol information

type FuturesSnapshotResponse

type FuturesSnapshotResponse struct {
	Code        int    `json:"code"`
	Msg         string `json:"msg"`
	SnapshotVos []struct {
		Data struct {
			Assets []struct {
				Asset         string `json:"asset"`
				MarginBalance string `json:"marginBalance"`
				WalletBalance string `json:"walletBalance"`
			} `json:"assets"`
			Position []struct {
				EntryPrice       string `json:"entryPrice"`
				MarkPrice        string `json:"markPrice"`
				PositionAmt      string `json:"positionAmt"`
				Symbol           string `json:"symbol"`
				UnRealizedProfit string `json:"unRealizedProfit"`
			} `json:"position"`
		} `json:"data"`
		Type       string `json:"type"`
		UpdateTime int64  `json:"updateTime"`
	} `json:"snapshotVos"`
}

FuturesSnapshotResponse futures snapshot response

type GetAllOCOResponse

type GetAllOCOResponse []struct {
	OrderListID       int64  `json:"orderListId"`
	ContingencyType   string `json:"contingencyType"`
	ListStatusType    string `json:"listStatusType"`
	ListOrderStatus   string `json:"listOrderStatus"`
	ListClientOrderID string `json:"listClientOrderId"`
	TransactionTime   int64  `json:"transactionTime"`
	Symbol            string `json:"symbol"`
	Orders            []struct {
		Symbol        string `json:"symbol"`
		OrderID       int64  `json:"orderId"`
		ClientOrderID string `json:"clientOrderId"`
	} `json:"orders"`
}

GetAllOCOResponse get all oco orders

type GetAllOrdersResponse

type GetAllOrdersResponse []struct {
	Symbol             string `json:"symbol"`
	OrderID            int64  `json:"orderId"`
	OrderListID        int64  `json:"orderListId"`
	ClientOrderID      string `json:"clientOrderId"`
	Price              string `json:"price"`
	OrigQty            string `json:"origQty"`
	ExecutedQty        string `json:"executedQty"`
	CumulativeQuoteQty string `json:"cummulativeQuoteQty"`
	Status             string `json:"status"`
	TimeInForce        string `json:"timeInForce"`
	Type               string `json:"type"`
	Side               string `json:"side"`
	StopPrice          string `json:"stopPrice"`
	IcebergQty         string `json:"icebergQty"`
	Time               int64  `json:"time"`
	UpdateTime         int64  `json:"updateTime"`
	IsWorking          bool   `json:"isWorking"`
	OrigQuoteOrderQty  string `json:"origQuoteOrderQty"`
}

GetAllOrdersResponse get all orders

type GetOCOResponse

type GetOCOResponse struct {
	OrderListID       int64  `json:"orderListId"`
	ContingencyType   string `json:"contingencyType"`
	ListStatusType    string `json:"listStatusType"`
	ListOrderStatus   string `json:"listOrderStatus"`
	ListClientOrderID string `json:"listClientOrderId"`
	TransactionTime   int64  `json:"transactionTime"`
	Symbol            string `json:"symbol"`
	Orders            []struct {
		Symbol        string `json:"symbol"`
		OrderID       int64  `json:"orderId"`
		ClientOrderID string `json:"clientOrderId"`
	} `json:"orders"`
}

GetOCOResponse get oco order

type GetOpenOCOResponse

type GetOpenOCOResponse []struct {
	OrderListID       int64  `json:"orderListId"`
	ContingencyType   string `json:"contingencyType"`
	ListStatusType    string `json:"listStatusType"`
	ListOrderStatus   string `json:"listOrderStatus"`
	ListClientOrderID string `json:"listClientOrderId"`
	TransactionTime   int64  `json:"transactionTime"`
	Symbol            string `json:"symbol"`
	Orders            []struct {
		Symbol        string `json:"symbol"`
		OrderID       int64  `json:"orderId"`
		ClientOrderID string `json:"clientOrderId"`
	} `json:"orders"`
}

GetOpenOCOResponse get open oco orders

type GetOpenOrdersResponse

type GetOpenOrdersResponse []struct {
	Symbol             string `json:"symbol"`
	OrderID            int64  `json:"orderId"`
	OrderListID        int64  `json:"orderListId"`
	ClientOrderID      string `json:"clientOrderId"`
	Price              string `json:"price"`
	OrigQty            string `json:"origQty"`
	ExecutedQty        string `json:"executedQty"`
	CumulativeQuoteQty string `json:"cummulativeQuoteQty"`
	Status             string `json:"status"`
	TimeInForce        string `json:"timeInForce"`
	Type               string `json:"type"`
	Side               string `json:"side"`
	StopPrice          string `json:"stopPrice"`
	IcebergQty         string `json:"icebergQty"`
	Time               int64  `json:"time"`
	UpdateTime         int64  `json:"updateTime"`
	IsWorking          bool   `json:"isWorking"`
	OrigQuoteOrderQty  string `json:"origQuoteOrderQty"`
}

GetOpenOrdersResponse get all open orders

type GetOrderResponse

type GetOrderResponse struct {
	Symbol             string `json:"symbol"`
	OrderID            int64  `json:"orderId"`
	OrderListID        int64  `json:"orderListId"`
	ClientOrderID      string `json:"clientOrderId"`
	Price              string `json:"price"`
	OrigQty            string `json:"origQty"`
	ExecutedQty        string `json:"executedQty"`
	CumulativeQuoteQty string `json:"cummulativeQuoteQty"`
	Status             string `json:"status"`
	TimeInForce        string `json:"timeInForce"`
	Type               string `json:"type"`
	Side               string `json:"side"`
	StopPrice          string `json:"stopPrice"`
	IcebergQty         string `json:"icebergQty"`
	Time               int64  `json:"time"`
	UpdateTime         int64  `json:"updateTime"`
	IsWorking          bool   `json:"isWorking"`
	OrigQuoteOrderQty  string `json:"origQuoteOrderQty"`
}

GetOrderResponse get order info

type MarginSnapshotResponse

type MarginSnapshotResponse struct {
	Code        int    `json:"code"`
	Msg         string `json:"msg"`
	SnapshotVos []struct {
		Data struct {
			MarginLevel         string `json:"marginLevel"`
			TotalAssetOfBtc     string `json:"totalAssetOfBtc"`
			TotalLiabilityOfBtc string `json:"totalLiabilityOfBtc"`
			TotalNetAssetOfBtc  string `json:"totalNetAssetOfBtc"`
			UserAssets          []struct {
				Asset    string `json:"asset"`
				Borrowed string `json:"borrowed"`
				Free     string `json:"free"`
				Interest string `json:"interest"`
				Locked   string `json:"locked"`
				NetAsset string `json:"netAsset"`
			} `json:"userAssets"`
		} `json:"data"`
		Type       string `json:"type"`
		UpdateTime int64  `json:"updateTime"`
	} `json:"snapshotVos"`
}

MarginSnapshotResponse margin snapshot response

type MarketClient

type MarketClient struct {
	Builder *binance.PublicUrlBuilder
	AppKey  string
}

MarketClient responsible to get market information

func NewMarketClient

func NewMarketClient(host, appKey string) *MarketClient

NewMarketClient Initializer

func (*MarketClient) Get24hTickerPriceChange

func (m *MarketClient) Get24hTickerPriceChange(symbol string) (interface{}, error)

Get24hTickerPriceChange 24 hour rolling window price change statistics. Careful when accessing this with no symbol.

func (*MarketClient) GetAggregateTrades

func (m *MarketClient) GetAggregateTrades(symbol string, limit int32, formID, startTime, endTime int64) (interface{}, error)

GetAggregateTrades Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.

func (*MarketClient) GetAveragePrice

func (m *MarketClient) GetAveragePrice(symbol string) (interface{}, error)

GetAveragePrice Current average price for a symbol.

func (*MarketClient) GetCandlestick

func (m *MarketClient) GetCandlestick(symbol, interval string, limit int32, startTime, endTime int64) (interface{}, error)

GetCandlestick Kline/candlestick bars for a symbol and are uniquely identified by their open time. It is not recommended to use this method, this method may have type errors, please use websocket subscription to obtain data.

func (*MarketClient) GetExchangeInfo

func (m *MarketClient) GetExchangeInfo() (interface{}, error)

GetExchangeInfo Current exchange trading rules and symbol information

func (*MarketClient) GetOldTradeLookUp

func (m *MarketClient) GetOldTradeLookUp(symbol string, limit int32, formID int64) (interface{}, error)

GetOldTradeLookUp Get older market trades.

func (*MarketClient) GetOrderBook

func (m *MarketClient) GetOrderBook(symbol string, limit int32) (interface{}, error)

GetOrderBook get depth info Valid limits:[5, 10, 20, 50, 100, 500, 1000, 5000]

func (*MarketClient) GetRecentTrades

func (m *MarketClient) GetRecentTrades(symbol string, limit int32) (interface{}, error)

GetRecentTrades Get recent trades.

func (*MarketClient) GetSymbolOrderBookTicker

func (m *MarketClient) GetSymbolOrderBookTicker(symbol string) (interface{}, error)

GetSymbolOrderBookTicker Best price/qty on the order book for a symbol or symbols.

func (*MarketClient) GetSymbolTickerPrice

func (m *MarketClient) GetSymbolTickerPrice(symbol string) (interface{}, error)

GetSymbolTickerPrice Latest price for a symbol or symbols.

type NewOCOOrderResponse

type NewOCOOrderResponse struct {
	OrderListID       int64  `json:"orderListId"`
	ContingencyType   string `json:"contingencyType"`
	ListStatusType    string `json:"listStatusType"`
	ListOrderStatus   string `json:"listOrderStatus"`
	ListClientOrderID string `json:"listClientOrderId"`
	TransactionTime   int64  `json:"transactionTime"`
	Symbol            string `json:"symbol"`
	Orders            []struct {
		Symbol        string `json:"symbol"`
		OrderID       int64  `json:"orderId"`
		ClientOrderID string `json:"clientOrderId"`
	} `json:"orders"`
	OrderReports []struct {
		Symbol             string `json:"symbol"`
		OrderID            int64  `json:"orderId"`
		OrderListID        int64  `json:"orderListId"`
		ClientOrderID      string `json:"clientOrderId"`
		TransactTime       int64  `json:"transactTime"`
		Price              string `json:"price"`
		OrigQty            string `json:"origQty"`
		ExecutedQty        string `json:"executedQty"`
		CumulativeQuoteQty string `json:"cummulativeQuoteQty"`
		Status             string `json:"status"`
		TimeInForce        string `json:"timeInForce"`
		Type               string `json:"type"`
		Side               string `json:"side"`
		StopPrice          string `json:"stopPrice,omitempty"`
	} `json:"orderReports"`
}

NewOCOOrderResponse new oco order

type NewOrderResponseACK

type NewOrderResponseACK struct {
	Symbol        string `json:"symbol"`
	OrderID       int64  `json:"orderId"`
	OrderListID   int64  `json:"orderListId"`
	ClientOrderID string `json:"clientOrderId"`
	TransactTime  int64  `json:"transactTime"`
}

NewOrderResponseACK Send in a new order.

type NewOrderResponseFull

type NewOrderResponseFull struct {
	Symbol             string `json:"symbol"`
	OrderID            int64  `json:"orderId"`
	OrderListID        int64  `json:"orderListId"`
	ClientOrderID      string `json:"clientOrderId"`
	TransactTime       int64  `json:"transactTime"`
	Price              string `json:"price"`
	OrigQTY            string `json:"origQty"`
	ExecutedQty        string `json:"executedQty"`
	CumulativeQuoteQTY string `json:"cummulativeQuoteQty"`
	Status             string `json:"status"`
	TimeInForce        string `json:"timeInForce"`
	Type               string `json:"type"`
	Side               string `json:"side"`
	Fills              []struct {
		Price           string `json:"price"`
		QTY             string `json:"qty"`
		Commission      string `json:"commission"`
		CommissionAsset string `json:"commissionAsset"`
	} `json:"fills"`
}

NewOrderResponseFull send in a new order.

type NewOrderResponseResult

type NewOrderResponseResult struct {
	Symbol             string `json:"symbol"`
	OrderID            int64  `json:"orderId"`
	OrderListID        int64  `json:"orderListId"`
	ClientOrderID      string `json:"clientOrderId"`
	TransactTime       int64  `json:"transactTime"`
	Price              string `json:"price"`
	OrigQty            string `json:"origQty"`
	ExecutedQty        string `json:"executedQty"`
	CumulativeQuoteQTY string `json:"cummulativeQuoteQty"`
	Status             string `json:"status"`
	TimeInForce        string `json:"timeInForce"`
	Type               string `json:"type"`
	Side               string `json:"side"`
}

NewOrderResponseResult Send in a new order.

type OlderTradeLookUpResponse

type OlderTradeLookUpResponse []struct {
	ID           int64  `json:"id"`
	Price        string `json:"price"`
	Qty          string `json:"qty"`
	QuoteQty     string `json:"quoteQty"`
	Time         int64  `json:"time"`
	IsBuyerMaker bool   `json:"isBuyerMaker"`
	IsBestMatch  bool   `json:"isBestMatch"`
}

OlderTradeLookUpResponse Get older market trades.

type OrderBookResponse

type OrderBookResponse struct {
	LastUpdateId int64      `json:"lastUpdateId"`
	Bids         [][]string `json:"bids"`
	Asks         [][]string `json:"asks"`
}

OrderBookResponse order book (depth) info The first in the array is price and the second is qty

type RecentTradesListResponse

type RecentTradesListResponse []struct {
	ID           int64  `json:"id"`
	Price        string `json:"price"`
	Qty          string `json:"qty"`
	QuoteQty     string `json:"quoteQty"`
	Time         int64  `json:"time"`
	IsBuyerMaker bool   `json:"isBuyerMaker"`
	IsBestMatch  bool   `json:"isBestMatch"`
}

RecentTradesListResponse Get recent trades.

type SAPIAccountResponse

type SAPIAccountResponse struct {
	Data string `json:"data"`
}

SAPIAccountResponse account response

type SAPIAssetDetailResponse

type SAPIAssetDetailResponse map[string]struct {
	MinWithdrawAmount string `json:"minWithdrawAmount"`
	DepositStatus     bool   `json:"depositStatus"`
	WithdrawFee       string `json:"withdrawFee"`
	WithdrawStatus    bool   `json:"withdrawStatus"`
	DepositTip        string `json:"depositTip"`
}

SAPIAssetDetailResponse Fetch details of assets supported on Binance.

type SAPITradeFeeResponse

type SAPITradeFeeResponse []struct {
	Symbol          string          `json:"symbol"`
	MakerCommission decimal.Decimal `json:"makerCommission"`
	TakerCommission decimal.Decimal `json:"takerCommission"`
}

SAPITradeFeeResponse Fetch trade fee, values in percentage.

type SAPIWithdrawResponse

type SAPIWithdrawResponse struct {
	ID string `json:"id"`
}

SAPIWithdrawResponse sapi withdraw response

type SpotSnapshotResponse

type SpotSnapshotResponse struct {
	Code        int    `json:"code"`
	Msg         string `json:"msg"`
	SnapshotVos []struct {
		Data struct {
			Balances []struct {
				Asset  string `json:"asset"`
				Free   string `json:"free"`
				Locked string `json:"locked"`
			} `json:"balances"`
			TotalAssetOfBtc string `json:"totalAssetOfBtc"`
		} `json:"data"`
		Type       string `json:"type"`
		UpdateTime int64  `json:"updateTime"`
	} `json:"snapshotVos"`
}

SpotSnapshotResponse spot snapshot response

type SymbolOrderBookTickerResponse

type SymbolOrderBookTickerResponse struct {
	Symbol   string `json:"symbol"`
	BidPrice string `json:"bidPrice"`
	BidQTY   string `json:"bidQty"`
	AskPrice string `json:"askPrice"`
	AskQTY   string `json:"askQty"`
}

SymbolOrderBookTickerResponse Best price/qty on the order book for a symbol or symbols.

type SymbolPriceTickerResponse

type SymbolPriceTickerResponse struct {
	Symbol string `json:"symbol"`
	Price  string `json:"price"`
}

SymbolPriceTickerResponse Latest price for a symbol or symbols.

type SystemStatusResponse

type SystemStatusResponse struct {
	Status  int    `json:"status"` // Status 0 is normal 1 system maintenance
	Message string `json:"msg"`
}

SystemStatusResponse system status

type TickerPriceChangeStatisticsResponse

type TickerPriceChangeStatisticsResponse struct {
	Symbol             string `json:"symbol"`
	PriceChange        string `json:"priceChange"`
	PriceChangePercent string `json:"priceChangePercent"`
	WeightedAvgPrice   string `json:"weightedAvgPrice"`
	PrevClosePrice     string `json:"prevClosePrice"`
	LastPrice          string `json:"lastPrice"`
	LastQTY            string `json:"lastQty"`
	BidPrice           string `json:"bidPrice"`
	AskPrice           string `json:"askPrice"`
	OpenPrice          string `json:"openPrice"`
	HighPrice          string `json:"highPrice"`
	LowPrice           string `json:"lowPrice"`
	Volume             string `json:"volume"`
	QuoteVolume        string `json:"quoteVolume"`
	OpenTime           int64  `json:"openTime"`
	CloseTime          int64  `json:"closeTime"`
	FirstID            int64  `json:"firstId"`
	LastID             int64  `json:"lastId"`
	Count              int    `json:"count"`
}

TickerPriceChangeStatisticsResponse 24 hour rolling window price change statistics. Careful when accessing this with no symbol.

type TradeClient

type TradeClient struct {
	Builder *binance.PrivateUrlBuilder
}

TradeClient responsible to trading information

func NewTradeClient

func NewTradeClient(host, appKey, appSecret string) *TradeClient

NewTradeClient Initializer

func (*TradeClient) DeleteOCO

func (t *TradeClient) DeleteOCO(symbol, listClientOrderID, newClientOrderID string, orderListID int64, recv time.Duration) (interface{}, error)

DeleteOCO delete oco order

func (*TradeClient) DeleteOpenOrders

func (t *TradeClient) DeleteOpenOrders(symbol string, recv time.Duration) (interface{}, error)

DeleteOpenOrders delete all open orders

func (*TradeClient) DeleteOrder

func (t *TradeClient) DeleteOrder(symbol, origClientOrderID, newClientOrderID string, orderID int64, recv time.Duration) (interface{}, error)

DeleteOrder delete a order

func (*TradeClient) GetAccountInfo

func (t *TradeClient) GetAccountInfo(recv time.Duration) (interface{}, error)

GetAccountInfo get account information

func (*TradeClient) GetAccountTradeList

func (t *TradeClient) GetAccountTradeList(symbol string, startTime, endTime, formID int64, limit int32, recv time.Duration) (interface{}, error)

GetAccountTradeList get account trade list

func (*TradeClient) GetAllOCOOrder

func (t *TradeClient) GetAllOCOOrder(formID, startTime, endTime int64, limit int32, recv time.Duration) (interface{}, error)

GetAllOCOOrder get all oco orders info

func (*TradeClient) GetAllOrder

func (t *TradeClient) GetAllOrder(symbol string, orderID, startTime, endTime int64, limit int32, recv time.Duration) (interface{}, error)

GetAllOrder get all orders

func (*TradeClient) GetOCOOrder

func (t *TradeClient) GetOCOOrder(origClientOrderID string, orderListID int64, recv time.Duration) (interface{}, error)

GetOCOOrder get a oco order info

func (*TradeClient) GetOpenOCOOrder

func (t *TradeClient) GetOpenOCOOrder(recv time.Duration) (interface{}, error)

GetOpenOCOOrder get open oco order

func (*TradeClient) GetOpenOrder

func (t *TradeClient) GetOpenOrder(symbol string, recv time.Duration) (interface{}, error)

GetOpenOrder get all open orders

func (*TradeClient) GetOrder

func (t *TradeClient) GetOrder(symbol, origClientOrderID string, orderID int64, recv time.Duration) (interface{}, error)

GetOrder get a order info

func (*TradeClient) NewOCO

func (t *TradeClient) NewOCO(symbol, listClientOrderID, side, limitClientOrderId, stopClientOrderId, stopLimitTimeInForce, newOrderRespType string, quantity, price, limitIcebergQty, stopPrice, stopLimitPrice, stopIcebergQty decimal.Decimal, recv time.Duration) (interface{}, error)

NewOCO new oco order

func (*TradeClient) NewOrder

func (t *TradeClient) NewOrder(symbol, side, orderType, timeInForce, newClientOderID, newOrderRespType string, quantity, quoteOrderQTY, price, stopPrice, icebergQTY decimal.Decimal, recv time.Duration) (interface{}, error)

NewOrder Send in a new order.

func (*TradeClient) TestNewOrder

func (t *TradeClient) TestNewOrder(symbol, side, orderType, timeInForce, newClientOderID, newOrderRespType string, quantity, quoteOrderQTY, price, stopPrice, icebergQTY decimal.Decimal, recv time.Duration) (interface{}, error)

TestNewOrder Test new order creation and signature/recvWindow long. Creates and validates a new order but does not send it into the matching engine.

type UniversalTransferRecordResponse

type UniversalTransferRecordResponse struct {
	Total int `json:"total"`
	Rows  []struct {
		Asset     string `json:"asset"`
		Amount    string `json:"amount"`
		Type      string `json:"type"`
		Status    string `json:"status"`
		TranID    int64  `json:"tranId"`
		Timestamp int64  `json:"timestamp"`
	} `json:"rows"`
}

UniversalTransferRecordResponse universal transfer record

type UniversalTransferResponse

type UniversalTransferResponse struct {
	TranID int64 `json:"tranId"`
}

UniversalTransferResponse universal transfer

type WalletClient

type WalletClient struct {
	Builder *binance.PrivateUrlBuilder
}

WalletClient responsible to get wallet information

func NewWalletClient

func NewWalletClient(host, appKey, appSecret string) *WalletClient

NewWalletClient Initializer

func (*WalletClient) AccountDividendRecord

func (w *WalletClient) AccountDividendRecord(asset string, startTime, endTime int64, limit int, recv time.Duration) (interface{}, error)

AccountDividendRecord Query asset dividend record.

func (*WalletClient) DepositAddressNetwork

func (w *WalletClient) DepositAddressNetwork(coin, network string, recv time.Duration) (interface{}, error)

DepositAddressNetwork deposit address supporting network

func (*WalletClient) DepositHistoryNetwork

func (w *WalletClient) DepositHistoryNetwork(coin string, status, offset, limit int32, startTime, endTime int64, recv time.Duration) (interface{}, error)

DepositHistoryNetwork deposit history supporting network set status exclude [0,6,1] to use default.

func (*WalletClient) DustTransfer

func (w *WalletClient) DustTransfer(asset []string, recv time.Duration) (interface{}, error)

DustTransfer Convert dust assets to BNB.

func (*WalletClient) FastWithdrawSwitch

func (w *WalletClient) FastWithdrawSwitch(status bool, recv time.Duration) (interface{}, error)

FastWithdrawSwitch enabled/disabled fast withdraw Todo wait verified

func (*WalletClient) GetAllCoinsInfo

func (w *WalletClient) GetAllCoinsInfo(recv time.Duration) (interface{}, error)

GetAllCoinsInfo all coins information

func (*WalletClient) GetFuturesSnapshot

func (w *WalletClient) GetFuturesSnapshot(startTime, endTime int64, limit int32, recv time.Duration) (interface{}, error)

GetFuturesSnapshot get daily account snapshot

func (*WalletClient) GetMarginSnapshot

func (w *WalletClient) GetMarginSnapshot(startTime, endTime int64, limit int32, recv time.Duration) (interface{}, error)

GetMarginSnapshot get daily account snapshot

func (*WalletClient) GetSpotSnapshot

func (w *WalletClient) GetSpotSnapshot(startTime, endTime int64, limit int32, recv time.Duration) (interface{}, error)

GetSpotSnapshot get daily account snapshot

func (*WalletClient) SAPIAccountAPIStatus

func (w *WalletClient) SAPIAccountAPIStatus(recv time.Duration) (interface{}, error)

SAPIAccountAPIStatus account API status

func (*WalletClient) SAPIAccountStatus

func (w *WalletClient) SAPIAccountStatus(recv time.Duration) (interface{}, error)

SAPIAccountStatus account status

func (*WalletClient) SAPIAssetDetail

func (w *WalletClient) SAPIAssetDetail(recv time.Duration) (interface{}, error)

SAPIAssetDetail Fetch details of assets supported on Binance.

func (*WalletClient) SAPIDustLog

func (w *WalletClient) SAPIDustLog(recv time.Duration) (interface{}, error)

SAPIDustLog Fetch small amounts of assets exchanged BNB records

func (*WalletClient) SAPITradeFee

func (w *WalletClient) SAPITradeFee(symbol string, recv time.Duration) (interface{}, error)

SAPITradeFee Fetch trade fee, values in percentage.

func (*WalletClient) SAPIWithdraw

func (w *WalletClient) SAPIWithdraw(coin, clientID, network, address, addressTag, name string, amount decimal.Decimal, transactionFeeFlag bool, recv time.Duration) (interface{}, error)

SAPIWithdraw withdraw

func (*WalletClient) UniversalTransfer

func (w *WalletClient) UniversalTransfer(typeName, asset, amount string, recv time.Duration) (interface{}, error)

UniversalTransfer You need to enable Permits Universal Transfer option for the api key which requests this endpoint.

typeName:

MAIN_C2C Spot account transfer to C2C account
MAIN_UMFUTURE Spot account transfer to USDⓈ-M Futures account
MAIN_CMFUTURE Spot account transfer to COIN-M Futures account
MAIN_MARGIN Spot account transfer to Margin(cross)account
MAIN_MINING Spot account transfer to Mining account
C2C_MAIN C2C account transfer to Spot account
C2C_UMFUTURE C2C account transfer to USDⓈ-M Futures account
C2C_MINING C2C account transfer to Mining account
C2C_MARGIN C2C account transfer to Margin(cross) account
UMFUTURE_MAIN USDⓈ-M Futures account transfer to Spot account
UMFUTURE_C2C USDⓈ-M Futures account transfer to C2C account
UMFUTURE_MARGIN USDⓈ-M Futures account transfer to Margin(cross)account
CMFUTURE_MAIN COIN-M Futures account transfer to Spot account
CMFUTURE_MARGIN COIN-M Futures account transfer to Margin(cross) account
MARGIN_MAIN Margin(cross)account transfer to Spot account
MARGIN_UMFUTURE Margin(cross)account transfer to USDⓈ-M Futures
MARGIN_CMFUTURE Margin(cross)account transfer to COIN-M Futures
MARGIN_MINING Margin(cross)account transfer to Mining account
MARGIN_C2C Margin(cross)account transfer to C2C account
MINING_MAIN Mining account transfer to Spot account
MINING_UMFUTURE Mining account transfer to USDⓈ-M Futures account
MINING_C2C Mining account transfer to C2C account
MINING_MARGIN Mining account transfer to Margin(cross) account

func (*WalletClient) UniversalTransferRecord

func (w *WalletClient) UniversalTransferRecord(typeName string, startTime, endTime int64, current, size int32, recv time.Duration) (interface{}, error)

UniversalTransferRecord universal transfer record

typeName:

MAIN_C2C Spot account transfer to C2C account
MAIN_UMFUTURE Spot account transfer to USDⓈ-M Futures account
MAIN_CMFUTURE Spot account transfer to COIN-M Futures account
MAIN_MARGIN Spot account transfer to Margin(cross)account
MAIN_MINING Spot account transfer to Mining account
C2C_MAIN C2C account transfer to Spot account
C2C_UMFUTURE C2C account transfer to USDⓈ-M Futures account
C2C_MINING C2C account transfer to Mining account
C2C_MARGIN C2C account transfer to Margin(cross) account
UMFUTURE_MAIN USDⓈ-M Futures account transfer to Spot account
UMFUTURE_C2C USDⓈ-M Futures account transfer to C2C account
UMFUTURE_MARGIN USDⓈ-M Futures account transfer to Margin(cross)account
CMFUTURE_MAIN COIN-M Futures account transfer to Spot account
CMFUTURE_MARGIN COIN-M Futures account transfer to Margin(cross) account
MARGIN_MAIN Margin(cross)account transfer to Spot account
MARGIN_UMFUTURE Margin(cross)account transfer to USDⓈ-M Futures
MARGIN_CMFUTURE Margin(cross)account transfer to COIN-M Futures
MARGIN_MINING Margin(cross)account transfer to Mining account
MARGIN_C2C Margin(cross)account transfer to C2C account
MINING_MAIN Mining account transfer to Spot account
MINING_UMFUTURE Mining account transfer to USDⓈ-M Futures account
MINING_C2C Mining account transfer to C2C account
MINING_MARGIN Mining account transfer to Margin(cross) account

func (*WalletClient) WithdrawHistoryNetwork

func (w *WalletClient) WithdrawHistoryNetwork(coin string, status, offset, limit int32, startTime, endTime int64, recv time.Duration) (interface{}, error)

WithdrawHistoryNetwork withdraw history supporting network set status exclude [0,6,1] to use default.

type WithdrawHistoryNetworkResponse

type WithdrawHistoryNetworkResponse []struct {
	Address         string `json:"address"`
	Amount          string `json:"amount"`
	ApplyTime       string `json:"applyTime"`
	Coin            string `json:"coin"`
	ID              string `json:"id"`
	WithdrawOrderID string `json:"withdrawOrderId,omitempty"`
	Network         string `json:"network"`
	TransferType    int    `json:"transferType,omitempty"`
	Status          int    `json:"status"`
	TxID            string `json:"txId"`
}

WithdrawHistoryNetworkResponse withdraw network response

type WithdrawHistoryResponse

type WithdrawHistoryResponse struct {
	WithdrawList []struct {
		ID              string          `json:"id"`
		WithdrawOrderID interface{}     `json:"withdrawOrderId"`
		Amount          decimal.Decimal `json:"amount"`
		TransactionFee  decimal.Decimal `json:"transactionFee"`
		Address         string          `json:"address"`
		Asset           string          `json:"asset"`
		TxID            string          `json:"txId"`
		ApplyTime       int64           `json:"applyTime"`
		Status          int             `json:"status"`
		AddressTag      string          `json:"addressTag,omitempty"`
	} `json:"withdrawList"`
	Success bool `json:"success"`
}

WithdrawHistoryResponse withdraw response

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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