binance

package
v0.0.0-...-5ed304f Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyTarget = fmt.Errorf("nil target after marshalling")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	MakerCommission  int    `json:"makerCommission"`
	TakerCommission  int    `json:"takerCommission"`
	BuyerCommission  int    `json:"buyerCommission"`
	SellerCommission int    `json:"sellerCommission"`
	CanDeposit       bool   `json:"canDeposit"`
	CanTrade         bool   `json:"canTrade"`
	CanWithdraw      bool   `json:"canWithdraw"`
	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"`
}

type Address

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

type Asset

type Asset struct {
	MinWithdrawAmount string `json:"minWithdrawAmount"`
	DepositStatus     bool   `json:"depositStatus"`
	WithdrawFee       int    `json:"withdrawFee"`
	WithdrawStatus    bool   `json:"withdrawStatus"`
	DepositTip        string `json:"depositTip"`
}

type Client

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

func New

func New(apiKey, secretKey string) *Client

func (*Client) CancelTradeByID

func (c *Client) CancelTradeByID(market, tradeID string) error

func (*Client) CreateTrade

func (c *Client) CreateTrade(market string, direction types.TradeDirection, quantity float64) (string, error)

func (*Client) CreateWithdrawal

func (c *Client) CreateWithdrawal(chain, address string, quantity float64) (string, error)

func (*Client) GenerateTradePath

func (c *Client) GenerateTradePath(fromChain, toChain string) ([]*types.Trade, error)

func (*Client) GetAccountStatus

func (c *Client) GetAccountStatus() error

func (*Client) GetDepositAddress

func (c *Client) GetDepositAddress(chain string) (string, error)

func (*Client) GetDepositByID

func (c *Client) GetDepositByID(chain, depositID string) (*types.Deposit, error)

func (*Client) GetDepositByTxID

func (c *Client) GetDepositByTxID(chain, txid string) (*types.Deposit, error)

func (*Client) GetHistoricalRates

func (c *Client) GetHistoricalRates(
	market string,
	startTime, endTime time.Time,
	invert bool,
) (map[time.Time]float64, error)

func (*Client) GetOutputThresholds

func (c *Client) GetOutputThresholds() map[string]*big.Int

func (*Client) GetPrices

func (c *Client) GetPrices(
	inputPaths map[string]map[string]*big.Int,
) (map[string]map[string]float64, error)

func (*Client) GetRate

func (c *Client) GetRate(market string) (float64, error)

func (*Client) GetTradeByID

func (c *Client) GetTradeByID(market, tradeID string, inputValue float64) (*types.Trade, error)

func (*Client) GetTradeTimeout

func (c *Client) GetTradeTimeout() time.Duration

func (*Client) GetWalletBalance

func (c *Client) GetWalletBalance(chain string) (float64, float64, error)

func (*Client) GetWalletStatus

func (c *Client) GetWalletStatus(chain string) (bool, bool, error)

func (*Client) GetWithdrawalByID

func (c *Client) GetWithdrawalByID(chain, withdrawalID string) (*types.Withdrawal, error)

func (*Client) ID

func (c *Client) ID() types.ExchangeID

func (*Client) NeedsWithdrawalFeeSubtraction

func (c *Client) NeedsWithdrawalFeeSubtraction() bool

func (*Client) TransferToMainAccount

func (c *Client) TransferToMainAccount(chain string, value float64) error

func (*Client) TransferToTradeAccount

func (c *Client) TransferToTradeAccount(chain string, value float64) error

type Deposit

type Deposit 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    string `json:"insertTime"`
	TransferType  int    `json:"transferType"`
	UnlockConfirm string `json:"unlockConfirm"`
	ConfirmTimes  string `json:"confirmTimes"`
}

type ExchangeInformation

type ExchangeInformation struct {
	Timezone   string    `json:"timezone"`
	ServerTime int64     `json:"serverTime"`
	Symbols    []*Symbol `json:"symbols"`
}

type Order

type Order 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               int    `json:"time"`
	UpdateTime         int    `json:"updateTime"`
	IsWorking          bool   `json:"isWorking"`
	OrigQuoteOrderQty  string `json:"origQuoteOrderQty"`
}

type Rate

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

type Symbol

type Symbol struct {
	Symbol                     string   `json:"symbol"`
	Status                     string   `json:"status"`
	BaseAsset                  string   `json:"baseAsset"`
	BaseAssetPrecision         int      `json:"baseAssetPrecision"`
	QuoteAsset                 string   `json:"quoteAsset"`
	QuotePrecision             string   `json:"quotePrecision"`
	QuoteAssetPrecision        string   `json:"quoteAssetPrecision"`
	QuoteCommissionPrecision   string   `json:"quoteCommissionPrecision"`
	OrderTypes                 []string `json:"orderTypes"`
	IcebergAllowed             bool     `json:"icebergAllowed"`
	OcoAllowed                 bool     `json:"ocoAllowed"`
	QuoteOrderQtyMarketAllowed bool     `json:"quoteOrderQtyMarketAllowed"`
	AllowTrailingStop          bool     `json:"allowTrailingStop"`
	CancelReplaceAllowed       bool     `json:"cancelReplaceAllowed"`
	IsSpotTradingAllowed       bool     `json:"isSpotTradingAllowed"`
	IsMarginTradingAllowed     bool     `json:"isMarginTradingAllowed"`
}

type TradeFee

type TradeFee struct {
	Symbol          string `json:"symbol"`
	MakerCommission string `json:"makerCommission"`
	TakerCommission string `json:"takerCommission"`
}

type Withdrawal

type Withdrawal 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"`
	Network         string `json:"network"`
	TransferType    int    `json:"transferType"`
	Status          int    `json:"status"`
	TransactionFee  string `json:"transactionFee"`
	ConfirmNo       int    `json:"confirmNo"`
	Info            string `json:"info"`
	TxID            string `json:"txId"`
}

Jump to

Keyboard shortcuts

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