binance

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2019 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DevInterface

type DevInterface struct{}

func NewDevInterface

func NewDevInterface() *DevInterface

func (*DevInterface) AuthenticatedEndpoint

func (di *DevInterface) AuthenticatedEndpoint() string

func (*DevInterface) PublicEndpoint

func (di *DevInterface) PublicEndpoint() string

type Endpoint added in v0.1.1

type Endpoint struct {
	// contains filtered or unexported fields
}

Endpoint 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 NewBinanceEndpoint

func NewBinanceEndpoint(signer Signer, interf Interface) *Endpoint

NewBinanceEndpoint return new endpoint instance for using binance

func (*Endpoint) CancelOrder added in v0.1.1

func (ep *Endpoint) CancelOrder(symbol string, id uint64) (exchange.Binacancel, error)

func (*Endpoint) DepositHistory added in v0.1.1

func (ep *Endpoint) DepositHistory(startTime, endTime uint64) (exchange.Binadeposits, error)

func (*Endpoint) GetAccountTradeHistory added in v0.1.1

func (ep *Endpoint) GetAccountTradeHistory(
	base, quote common.Token,
	fromID string) (exchange.BinaAccountTradeHistory, error)

func (*Endpoint) GetDepositAddress added in v0.1.1

func (ep *Endpoint) GetDepositAddress(asset string) (exchange.Binadepositaddress, error)

func (*Endpoint) GetDepthOnePair added in v0.1.1

func (ep *Endpoint) GetDepthOnePair(baseID, quoteID string) (exchange.Binaresp, error)

func (*Endpoint) GetExchangeInfo added in v0.1.1

func (ep *Endpoint) GetExchangeInfo() (exchange.BinanceExchangeInfo, error)

func (*Endpoint) GetInfo added in v0.1.1

func (ep *Endpoint) GetInfo() (exchange.Binainfo, error)

func (*Endpoint) GetResponse added in v0.1.1

func (ep *Endpoint) GetResponse(
	method string, url string,
	params map[string]string, signNeeded bool, timepoint uint64) ([]byte, error)

func (*Endpoint) GetTradeHistory added in v0.1.1

func (ep *Endpoint) GetTradeHistory(symbol string) (exchange.BinanceTradeHistory, error)

func (*Endpoint) OpenOrdersForOnePair added in v0.1.1

func (ep *Endpoint) OpenOrdersForOnePair(pair common.TokenPair) (exchange.Binaorders, error)

func (*Endpoint) OrderStatus added in v0.1.1

func (ep *Endpoint) OrderStatus(symbol string, id uint64) (exchange.Binaorder, error)

func (*Endpoint) Trade added in v0.1.1

func (ep *Endpoint) 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 (*Endpoint) UpdateTimeDelta added in v0.1.1

func (ep *Endpoint) UpdateTimeDelta() error

func (*Endpoint) Withdraw added in v0.1.1

func (ep *Endpoint) Withdraw(token common.Token, amount *big.Int, address ethereum.Address) (string, error)

func (*Endpoint) WithdrawHistory added in v0.1.1

func (ep *Endpoint) WithdrawHistory(startTime, endTime uint64) (exchange.Binawithdrawals, error)

type Interface

type Interface 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
}

Interface is Binance exchange API endpoints interface.

type KovanInterface

type KovanInterface struct {
	// contains filtered or unexported fields
}

func NewKovanInterface

func NewKovanInterface(flagVariable string) *KovanInterface

func (*KovanInterface) AuthenticatedEndpoint

func (ki *KovanInterface) AuthenticatedEndpoint() string

func (*KovanInterface) PublicEndpoint

func (ki *KovanInterface) PublicEndpoint() string

type RealInterface

type RealInterface struct{}

func NewRealInterface

func NewRealInterface() *RealInterface

func (*RealInterface) AuthenticatedEndpoint

func (r *RealInterface) AuthenticatedEndpoint() string

func (*RealInterface) PublicEndpoint

func (r *RealInterface) PublicEndpoint() string

type RopstenInterface added in v0.1.1

type RopstenInterface struct {
	// contains filtered or unexported fields
}

func NewRopstenInterface added in v0.1.1

func NewRopstenInterface(flagVariable string) *RopstenInterface

func (*RopstenInterface) AuthenticatedEndpoint added in v0.1.1

func (ri *RopstenInterface) AuthenticatedEndpoint() string

func (*RopstenInterface) PublicEndpoint added in v0.1.1

func (ri *RopstenInterface) PublicEndpoint() string

type Signer

type Signer struct {
	Key    string `json:"binance_key"`
	Secret string `json:"binance_secret"`
}

func NewSigner added in v0.1.1

func NewSigner(key, secret string) *Signer

func NewSignerFromFile added in v0.1.1

func NewSignerFromFile(path string) Signer

func (Signer) GetKey added in v0.1.1

func (s Signer) GetKey() string

func (Signer) Sign added in v0.1.1

func (s Signer) Sign(msg string) string

type SimulatedInterface

type SimulatedInterface struct {
	// contains filtered or unexported fields
}

func NewSimulatedInterface

func NewSimulatedInterface(flagVariable string) *SimulatedInterface

func (*SimulatedInterface) AuthenticatedEndpoint

func (si *SimulatedInterface) AuthenticatedEndpoint() string

func (*SimulatedInterface) PublicEndpoint

func (si *SimulatedInterface) PublicEndpoint() string

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

func NewBoltStorage(path string) (*Storage, error)

NewBoltStorage create database and related bucket for binance storage

func (*Storage) GetLastIDTradeHistory added in v0.1.1

func (bs *Storage) GetLastIDTradeHistory(pair string) (string, error)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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