Documentation ¶
Index ¶
- type Client
- func (ep *Client) CancelOrder(symbol string, id uint64) (exchange.Binacancel, error)
- func (ep *Client) DepositHistory(startTime, endTime uint64) (exchange.Binadeposits, error)
- func (ep *Client) GetAccountTradeHistory(base, quote common.Token, fromID string) (exchange.BinaAccountTradeHistory, error)
- func (ep *Client) GetDepositAddress(asset string) (exchange.Binadepositaddress, error)
- func (ep *Client) GetDepthOnePair(baseID, quoteID string) (exchange.Binaresp, error)
- func (ep *Client) GetExchangeInfo() (exchange.BinanceExchangeInfo, error)
- func (ep *Client) GetInfo() (exchange.Binainfo, error)
- func (ep *Client) GetResponse(method string, url string, params map[string]string, signNeeded bool, ...) ([]byte, error)
- func (ep *Client) GetTradeHistory(symbol string) (exchange.BinanceTradeHistory, error)
- func (ep *Client) OpenOrdersForOnePair(pair common.TokenPair) (exchange.Binaorders, error)
- func (ep *Client) OrderStatus(symbol string, id uint64) (exchange.Binaorder, error)
- func (ep *Client) Trade(tradeType string, base, quote common.Token, rate, amount float64) (exchange.Binatrade, error)
- func (ep *Client) UpdateTimeDelta() error
- func (ep *Client) Withdraw(token common.Token, amount *big.Int, address ethereum.Address) (string, error)
- func (ep *Client) WithdrawHistory(startTime, endTime uint64) (exchange.Binawithdrawals, error)
- type Endpoints
- type EndpointsInterface
- type Signer
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.1.2
type Client struct {
// contains filtered or unexported fields
}
Client object stand for Binance endpoint including signer for api call authentication, interf for calling api in different env timedelta to make sure calling api in time
func NewBinanceClient ¶ added in v0.1.2
func NewBinanceClient(signer Signer, interf EndpointsInterface) *Client
NewBinanceClient return new endpoint instance for using binance
func (*Client) CancelOrder ¶ added in v0.1.2
CancelOrder cancel an open order
func (*Client) DepositHistory ¶ added in v0.1.2
func (ep *Client) DepositHistory(startTime, endTime uint64) (exchange.Binadeposits, error)
DepositHistory get deposit history from binance
func (*Client) GetAccountTradeHistory ¶ added in v0.1.2
func (ep *Client) GetAccountTradeHistory( base, quote common.Token, fromID string) (exchange.BinaAccountTradeHistory, error)
GetAccountTradeHistory return trade history from our account on binance
func (*Client) GetDepositAddress ¶ added in v0.1.2
func (ep *Client) GetDepositAddress(asset string) (exchange.Binadepositaddress, error)
GetDepositAddress get deposit address of token from binance
func (*Client) GetDepthOnePair ¶ added in v0.1.2
GetDepthOnePair return list of orderbook for one pair of tokens
func (*Client) GetExchangeInfo ¶ added in v0.1.2
func (ep *Client) GetExchangeInfo() (exchange.BinanceExchangeInfo, error)
GetExchangeInfo return info from exchange include base, quote asset precision min, max price, min notional
func (*Client) GetResponse ¶ added in v0.1.2
func (ep *Client) GetResponse( method string, url string, params map[string]string, signNeeded bool, timepoint uint64) ([]byte, error)
GetResponse function to do the request to binance
func (*Client) GetTradeHistory ¶ added in v0.1.2
func (ep *Client) GetTradeHistory(symbol string) (exchange.BinanceTradeHistory, error)
GetTradeHistory return trade history from an account
func (*Client) OpenOrdersForOnePair ¶ added in v0.1.2
OpenOrdersForOnePair get open orders for one pair of token and quote
func (*Client) OrderStatus ¶ added in v0.1.2
OrderStatus check order status
func (*Client) Trade ¶ added in v0.1.2
func (ep *Client) Trade(tradeType string, base, quote common.Token, rate, amount float64) (exchange.Binatrade, error)
Trade Relevant params: symbol ("%s%s", base, quote) side (BUY/SELL) type (LIMIT/MARKET) timeInForce (GTC/IOC) quantity price
In this version, we only support LIMIT order which means only buy/sell with acceptable price, and GTC time in force which means that the order will be active until it's implicitly canceled
func (*Client) UpdateTimeDelta ¶ added in v0.1.2
UpdateTimeDelta check binance time server then adjust timeDelta params to make sure the request valid
func (*Client) Withdraw ¶ added in v0.1.2
func (ep *Client) Withdraw(token common.Token, amount *big.Int, address ethereum.Address) (string, error)
Withdraw token from binance to our reserve
func (*Client) WithdrawHistory ¶ added in v0.1.2
func (ep *Client) WithdrawHistory(startTime, endTime uint64) (exchange.Binawithdrawals, error)
WithdrawHistory get withdraw history
type Endpoints ¶ added in v0.1.2
type Endpoints struct {
// contains filtered or unexported fields
}
func (*Endpoints) AuthenticatedEndpoint ¶ added in v0.1.2
func (*Endpoints) PublicEndpoint ¶ added in v0.1.2
type EndpointsInterface ¶ added in v0.1.2
type EndpointsInterface interface { // PublicEndpoint returns the endpoint that does not requires authentication. PublicEndpoint() string // AuthenticatedEndpoint returns the endpoint that requires authentication. // In simulation mode, authenticated endpoint is the Binance mock server. AuthenticatedEndpoint() string }
EndpointsInterface is Binance exchange API endpoints interface.
func NewEndpoints ¶ added in v0.1.2
func NewEndpoints(baseURL string) EndpointsInterface
NewEndpoints ...
type Storage ¶ added in v0.1.1
type Storage struct {
// contains filtered or unexported fields
}
Storage storage binance information including trade history
func NewBoltStorage ¶ added in v0.1.1
NewBoltStorage create database and related bucket for binance storage
func (*Storage) GetLastIDTradeHistory ¶ added in v0.1.1
GetLastIDTradeHistory return last id of trade history of a token using for query trade history from binance
func (*Storage) GetTradeHistory ¶ added in v0.1.1
func (bs *Storage) GetTradeHistory(fromTime, toTime uint64) (common.ExchangeTradeHistory, error)
GetTradeHistory return trade history from binance from time to time
func (*Storage) StoreTradeHistory ¶ added in v0.1.1
func (bs *Storage) StoreTradeHistory(data common.ExchangeTradeHistory) error
StoreTradeHistory store binance trade history