spot

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

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 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) 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) 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 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