spot

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubAccountListEndPoint                    = "/sapi/v1/sub-account/list"
	SubAccountTransferHistoryEndPoint         = "/sapi/v1/sub-account/sub/transfer/history"
	SubAccountFuturesInternalTransferEndPoint = "/sapi/v1/sub-account/futures/internalTransfer"
	SubAccountAssetEndPoint                   = "/sapi/v3/sub-account/assets"

	TransferHistoryLimit = 500
)
View Source
const (
	AccountEndPoint = "/api/v3/account"
)
View Source
const (
	DepositHisrecEndPoint = "/sapi/v1/capital/deposit/hisrec"
)
View Source
const (
	MyTradesEndPoint = "/api/v3/myTrades"
)
View Source
const (
	TradeFeeEndPoint = "/wapi/v3/tradeFee.html"
)

Variables

View Source
var (
	ErrPair = errors.New("symbol pair not support")
)

Functions

func Init

func Init(ctx context.Context) error

func NewSymbol

func NewSymbol(base, quote string) exchange.SpotSymbol

func ParseSymbol

func ParseSymbol(sym string) (exchange.SpotSymbol, error)

Types

type AccountBalance added in v0.5.4

type AccountBalance struct {
	Asset  string          `json:"asset"`
	Free   decimal.Decimal `json:"free"`
	Locked decimal.Decimal `json:"locked"`
}

type AccountReq added in v0.5.4

type AccountReq struct {
	*binance.RestReq
}

func NewAccountReq added in v0.5.4

func NewAccountReq() *AccountReq

type AccountResp added in v0.5.4

type AccountResp struct {
	MakerCommision int              `json:"makerCommision"`
	Balances       []AccountBalance `json:"balances"`
}

type DepositHisrecRecord added in v0.5.4

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

type DepositHisrecReq added in v0.5.4

type DepositHisrecReq struct {
	*binance.RestReq
}

func NewDepositHisrecReq added in v0.5.4

func NewDepositHisrecReq() *DepositHisrecReq

type ExchangeInfo

type ExchangeInfo struct {
	Symbols []Symbol `json:"symbols"`
}

type RestClient

type RestClient struct {
	*binance.RestClient
}

func NewRestClient

func NewRestClient(key, secret string) *RestClient

func (*RestClient) Account added in v0.5.4

func (rc *RestClient) Account(ctx context.Context, req *AccountReq) (*AccountResp, error)

func (*RestClient) DepositHisrec added in v0.5.4

func (rc *RestClient) DepositHisrec(ctx context.Context, req *DepositHisrecReq) ([]DepositHisrecRecord, error)

func (*RestClient) ExchangeInfo

func (rc *RestClient) ExchangeInfo(ctx context.Context) (*ExchangeInfo, error)

func (*RestClient) FeeRate

func (rc *RestClient) FeeRate(ctx context.Context, symbols []exchange.Symbol) ([]*exchange.TradeFee, error)

func (*RestClient) MyTrades

func (rc *RestClient) MyTrades(ctx context.Context, symbol string, st int64, et int64, fid int64, limit int) ([]Trade, error)

func (*RestClient) Property

func (rc *RestClient) Property() exchange.Property

func (*RestClient) SubAccountAsset added in v0.5.4

func (rc *RestClient) SubAccountAsset(ctx context.Context, req *SubAccountAssetReq) (*SubAccountAssetResp, error)

func (*RestClient) SubAccountFuturesInternalTransfer added in v0.5.4

func (*RestClient) SubAccountList added in v0.5.4

func (rc *RestClient) SubAccountList(ctx context.Context, req *SubAccountReq) (*SubAccountResp, error)

func (*RestClient) SubAccountTransferHistory added in v0.5.4

func (rc *RestClient) SubAccountTransferHistory(ctx context.Context, req *SubAccountTransferHistoryReq) ([]SubAccountTransferHistory, error)

func (*RestClient) Symbols

func (rc *RestClient) Symbols(ctx context.Context) ([]exchange.SpotSymbol, error)

func (*RestClient) TradeFee

func (rc *RestClient) TradeFee(ctx context.Context, symbol string) ([]TradeFee, error)

func (*RestClient) Trades

func (rc *RestClient) Trades(ctx context.Context, req *exchange.TradeReqParam) ([]exchange.Trade, error)

type SpotSymbol

type SpotSymbol struct {
	*exchange.BaseSpotSymbol
	Symbol string
}

func (*SpotSymbol) String

func (ss *SpotSymbol) String() string

type SubAccount added in v0.5.4

type SubAccount struct {
	Email      string `json:"email"`
	IsFreeze   bool   `json:"isFreeze"`
	CreateTime int64  `json:"createTime"`
}

type SubAccountAssetReq added in v0.5.4

type SubAccountAssetReq struct {
	*binance.RestReq
}

func NewSubAccountAssetReq added in v0.5.4

func NewSubAccountAssetReq(email string) *SubAccountAssetReq

type SubAccountAssetResp added in v0.5.4

type SubAccountAssetResp struct {
	Balances []SubAccountBalance `json:"balances"`
}

type SubAccountBalance added in v0.5.4

type SubAccountBalance struct {
	Asset  string  `json:"asset"`
	Free   float64 `json:"free"`
	Locked float64 `json:"locked"`
}

type SubAccountFuturesInternalTransfer added in v0.5.4

type SubAccountFuturesInternalTransfer struct {
	From   string `json:"from"`
	To     string `json:"to"`
	Asset  string `json:"asset"`
	Qty    string `json:"qty"`
	TranID int    `json:"tranId"`
	Time   int64  `json:"time"`
}

type SubAccountFuturesInternalTransferReq added in v0.5.4

type SubAccountFuturesInternalTransferReq struct {
	*binance.RestReq
}

func NewSubAccountFuturesInternalTransferReq added in v0.5.4

func NewSubAccountFuturesInternalTransferReq(email string, typ int) *SubAccountFuturesInternalTransferReq

func (*SubAccountFuturesInternalTransferReq) EndTime added in v0.5.4

func (*SubAccountFuturesInternalTransferReq) Limit added in v0.5.4

func (*SubAccountFuturesInternalTransferReq) Page added in v0.5.4

func (*SubAccountFuturesInternalTransferReq) StartTime added in v0.5.4

type SubAccountFuturesInternalTransferResp added in v0.5.4

type SubAccountFuturesInternalTransferResp struct {
	Success     bool                                `json:"success"`
	FuturesType int                                 `json:"futuresType"`
	Transfers   []SubAccountFuturesInternalTransfer `json:"transfers"`
}

type SubAccountReq added in v0.5.4

type SubAccountReq struct {
	*binance.RestReq
}

func NewSubAccountReq added in v0.5.4

func NewSubAccountReq() *SubAccountReq

func (*SubAccountReq) Email added in v0.5.4

func (sr *SubAccountReq) Email(email string) *SubAccountReq

func (*SubAccountReq) IsFreeze added in v0.5.4

func (sr *SubAccountReq) IsFreeze(freeze bool) *SubAccountReq

func (*SubAccountReq) Limit added in v0.5.4

func (sr *SubAccountReq) Limit(limit int) *SubAccountReq

func (*SubAccountReq) Page added in v0.5.4

func (sr *SubAccountReq) Page(page int) *SubAccountReq

type SubAccountResp added in v0.5.4

type SubAccountResp struct {
	SubAccounts []SubAccount `json:"subAccounts"`
}

type SubAccountTransferHistory added in v0.5.4

type SubAccountTransferHistory struct {
	From   string `json:"from"`
	To     string `json:"to"`
	Asset  string `json:"asset"`
	Qty    string `json:"qty"`
	Status string `json:"status"`
	TranID int    `json:"tranId"`
	Time   int64  `json:"time"`
}

type SubAccountTransferHistoryReq added in v0.5.4

type SubAccountTransferHistoryReq struct {
	*binance.RestReq
}

func NewSubAccountTransferHistoryReq added in v0.5.4

func NewSubAccountTransferHistoryReq() *SubAccountTransferHistoryReq

func (*SubAccountTransferHistoryReq) EndTime added in v0.5.4

func (*SubAccountTransferHistoryReq) FromEmail added in v0.5.4

func (*SubAccountTransferHistoryReq) Limit added in v0.5.4

func (*SubAccountTransferHistoryReq) Page added in v0.5.4

func (*SubAccountTransferHistoryReq) StartTime added in v0.5.4

func (*SubAccountTransferHistoryReq) ToEmail added in v0.5.4

type Symbol

type Symbol struct {
	Symbol              string `json:"symbol"`
	BaseAsset           string `json:"baseAsset"`
	QuoteAsset          string `json:"quoteAsset"`
	BaseAssetPrecision  int    `json:"baseAssetPrecision"`
	QuoteAssetPrecision int    `json:"quoteAssetPrecision"`
}

Symbol info TODO: refactor Symbol add more info pricePrecison ...

func (*Symbol) Parse

func (sym *Symbol) Parse() (exchange.SpotSymbol, error)

type Trade

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

func (*Trade) Parse

func (t *Trade) Parse() (*exchange.Trade, error)

type TradeFee

type TradeFee struct {
	Symbol string
	Maker  decimal.Decimal
	Taker  decimal.Decimal
}

func (*TradeFee) Parse

func (tf *TradeFee) Parse() (*exchange.TradeFee, error)

type TradeFeeResp

type TradeFeeResp struct {
	TradeFee []TradeFee `json:"tradeFee"`
	Success  bool       `json:"success"`
}

Jump to

Keyboard shortcuts

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