swap

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommiionRateEndPoint = "/fapi/v1/commissionRate"
)
View Source
const (
	IncomeEndPoint = "/fapi/v1/income"
)
View Source
const (
	SwapAPIHost string = "fapi.binance.com"
)
View Source
const (
	UserTradesEndPoint = "/fapi/v1/userTrades"
)

Variables

This section is empty.

Functions

func Init added in v0.3.0

func Init(ctx context.Context) error

func ParseSymbol added in v0.3.0

func ParseSymbol(symbol string) (exchange.SwapSymbol, error)

Types

type CommisionRate added in v0.3.0

type CommisionRate struct {
	Symbol               string
	MakerCommissionRate  decimal.Decimal `json:"makerCommissionRate"`
	TakerCommissioinRate decimal.Decimal `json:"takerCommissionRate"`
}

func (*CommisionRate) Parse added in v0.3.0

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

type ExchangeInfo added in v0.3.0

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

TODO add additinoal field parse

type Filter added in v0.3.0

type Filter struct {
	MinPrice          decimal.Decimal `json:"minPrice"`
	MaxPrice          decimal.Decimal `json:"maxPrice"`
	FilterType        string          `json:"filterType"`
	TickSize          decimal.Decimal `json:"tickSize"`
	StepSize          decimal.Decimal `json:"stepSize"`
	MaxQty            decimal.Decimal `json:"maxQty"`
	MinQty            decimal.Decimal `json:"minQty"`
	Limit             int             `json:"limit"`
	MultiplierDown    decimal.Decimal `json:"multiplierDown"`
	MultiplierUp      decimal.Decimal `json:"multiplierUp"`
	MultiplierDecimal decimal.Decimal `json:"multiplierDecimal"`
}

type Income added in v0.3.0

type Income struct {
	Symbol     string          `json:"symbol"`
	IncomeType IncomeType      `json:"incomeType"`
	Income     decimal.Decimal `json:"income"`
	Asset      string          `json:"asset"`
	Info       string          `json:"info"`
	Time       int64           `json:"time"`
	TranID     int64           `json:"tranId"`
	TradeID    string          `json:"tradeId"`
}

func (*Income) Parse added in v0.3.0

func (ic *Income) Parse() (*exchange.Finance, error)

type IncomeType added in v0.3.0

type IncomeType string
const (
	IncomeTypeNone           IncomeType = ""
	IncomeTypeTransfer       IncomeType = "TRANSFER"
	IncomeTypeWelcomeBonus   IncomeType = "WELCOME_BONUS"
	IncomeTypeRealizedPnl    IncomeType = "REALIZED_PNL"
	IncomeTypeFundingFee     IncomeType = "FUNDING_FEE"
	IncomeTypeCommission     IncomeType = "COMMISSION"
	IncomeTypeInsuranceClear IncomeType = "INSURANCE_CLEAR"
)

func (IncomeType) Parse added in v0.3.0

func (ic IncomeType) Parse() exchange.FinanceType

type RestClient

type RestClient struct {
	*binance.RestClient
}

RestClient struct

func NewRestClient

func NewRestClient(key, secret string) *RestClient

func (*RestClient) CommisionRate added in v0.3.0

func (rc *RestClient) CommisionRate(ctx context.Context, symbol string) (*CommisionRate, error)

func (*RestClient) ExchangeInfo added in v0.3.0

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

func (*RestClient) FeeRate added in v0.3.0

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

func (*RestClient) Finance added in v0.3.0

func (*RestClient) Income added in v0.3.0

func (rc *RestClient) Income(ctx context.Context, symbol string, it IncomeType, st int64, et int64, limit int) ([]Income, error)

func (*RestClient) Property added in v0.3.0

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

func (*RestClient) Symbols

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

func (*RestClient) Trades added in v0.3.0

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

func (*RestClient) UserTrades added in v0.3.0

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

type SwapSymbol

type SwapSymbol struct {
	*exchange.BaseSwapSymbol
	Symbol string
}

func (*SwapSymbol) String

func (s *SwapSymbol) String() string

type Symbol added in v0.3.0

type Symbol struct {
	Symbol                string          `json:"symbol"`
	Status                string          `json:"status"`
	MaintMarginPercent    decimal.Decimal `json:"maintMarginPercent"`
	RequiredMarginPercent decimal.Decimal `json:"requiredMarginPercent"`
	BaseAsset             string          `json:"baseAsset"`
	QuoteAsset            string          `json:"quoteAsset"`
	PricePrecision        int             `json:"pricePrecision"`
	QuantityPrecision     int             `json:"quantityPrecision"`
	BaseAssetPrecision    int             `json:"baseAssetPrecision"`
	QuotePrecision        int             `json:"quotePrecision"`
	UnderlyingType        string          `json:"COIN"`
	Filters               []Filter        `json:"filters"`
	OrderTypes            []string        `json:"orderTypes"`
	TimeInForce           []string        `json:"timeInForce"`
}

func (*Symbol) Parse added in v0.3.0

func (s *Symbol) Parse() (exchange.SwapSymbol, error)

type Trade added in v0.3.0

type Trade struct {
	Symbol          string          `json:"symbol"`
	ID              int64           `json:"id"`
	OrderID         int64           `json:"orderId"`
	Price           decimal.Decimal `json:"price"`
	Qty             decimal.Decimal `json:"qty"`
	QuoteQty        decimal.Decimal `json:"quoteQty"`
	Commission      decimal.Decimal `json:"commission"`
	CommissionAsset string          `json:"commissionAsset"`
	RealizedPnl     decimal.Decimal `json:"realizedPnl"`
	Side            string          `json:"SIDE"`
	PositionSide    string          `json:"positionSide"`
	Time            int64           `json:"time"`
	Maker           bool            `json:"Maker"`
}

func (*Trade) Parse added in v0.3.0

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

Jump to

Keyboard shortcuts

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