q

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirectVectors

func DirectVectors(p map[D]P) (TriArr map[T][3]bool)

func DsToInstruments

func DsToInstruments(ds []D, duoSym map[D]string) (instruments []string)

func ExpireTime deprecated

func ExpireTime(bl any, old Bbo) int64

Deprecated: by chan

func GetEdgesMap

func GetEdgesMap(vs map[T][3]bool) map[D]bool

Types

type Attr

type Attr struct {
	// OrderLimit uint32
	MultiOrder, Round bool
}

type Bbo

type Bbo struct {
	Bid, BidSize float64
	Pair         string
	Ask, AskSize float64
	Updated      int64
}

Bbo ticker

func (Bbo) SideRatio

func (bb Bbo) SideRatio(sell bool) float64

func (Bbo) SideRatioAmount

func (bb Bbo) SideRatioAmount(sell bool) (ratio float64, amount float64)

func (Bbo) Valid

func (bb Bbo) Valid() bool

type D

type D struct {
	Base, Quote string
}

func GetEdges

func GetEdges(vs map[T][3]bool) (ds []D)

func (D) Check

func (d D) Check(v Bbo, BBOs *sync.Map) bool

func (D) Clip

func (d D) Clip(s string) string

func (D) Contains

func (d D) Contains(currency string) bool

func (D) GetRelatedVs

func (d D) GetRelatedVs(cl any, ok bool) (relatedVs map[T][3]bool, err error)

func (D) Onward

func (d D) Onward(side bool) D

func (D) QuoteContains

func (d D) QuoteContains(currency string) bool

func (D) Reverse

func (d D) Reverse() D

func (D) String added in v0.1.1

func (d D) String() string

func (D) ToInstrument

func (d D) ToInstrument(duoSym map[D]string) string

func (D) Valid

func (d D) Valid() bool

type NetworkWithdraw

type NetworkWithdraw struct {
	AddressRegex            string `json:"addressRegex"`
	Coin                    string `json:"coin"`
	DepositDesc             string `json:"depositDesc"` // shown only when "depositEnable" is false.
	DepositEnable           bool   `json:"depositEnable"`
	FeeDollar               float64
	IsDefault               bool    `json:"isDefault"`
	MemoRegex               string  `json:"memoRegex"`
	MinConfirm              float64 `json:"minConfirm"` // min number for balance confirmation
	Name                    string  `json:"name"`
	Network                 string  `json:"network"`
	ResetAddressStatus      bool    `json:"resetAddressStatus"`
	SpecialTips             string  `json:"specialTips"`
	UnLockConfirm           float64 `json:"unLockConfirm"` // confirmation number for balance unlock
	WithdrawDesc            string  `json:"withdrawDesc"`  // shown only when "withdrawEnable" is false.
	WithdrawEnable          bool    `json:"withdrawEnable"`
	WithdrawIntegerMultiple float64 `json:"withdrawIntegerMultiple"`
	ExFee                   float64
	ExMin                   float64
	Fee                     float64 `json:"withdrawFee"`
	Max                     float64 `json:"withdrawMax"`
	Min                     float64 `json:"withdrawMin"`
	SameAddress             bool    `json:"sameAddress"` // If the coin needs to provide memo to withdraw
	EstimatedArrivalTime    float64 `json:"estimatedArrivalTime"`
	Busy                    bool    `json:"busy"`
}

type Order

type Order struct {
	Price        float64
	Amount       float64
	SAmount      string
	OrderID2     string
	Symbol       string
	Limit        bool
	Sell         bool
	Real         bool
	Err          error
	OrderID      int //deprecated
	Side         cons.TradeSide
	Type         string //limit / market
	OrderType    int    //0:default,1:gtc,2:fok,3:ioc
	OrderTime    int    // create  timestamp
	FinishedTime int64  //finished timestamp
	Currency     cons.CurrencyPair
	Cid          string //客户端自定义ID
	I            int
	Status       cons.TradeStatus
	AvgPrice     float64
	DealAmount   float64
	Fee          float64
}

func (Order) HasErrPrefix

func (o Order) HasErrPrefix(suffix string) bool

func (Order) Speak

func (o Order) Speak() string

func (Order) Summarize

func (o Order) Summarize() Place

type P

type P struct {
	Base, BaseLimit, Quote, Price float64 //step
	// BaseN, BaseLimitN, QuoteN, PriceN int
	MinBase, MinBaseLimit, MinQuote float64
	TakerNett, MakerNett            float64
}

func DefaultPrecision

func DefaultPrecision() P

func NoFeePrecision

func NoFeePrecision() P

func (P) GetFixedSize

func (prec P) GetFixedSize(ratio, spend float64, sell bool) (sAmount string, fixedBaseSize, fixedQuoteSize, fixedLost float64, isForceMarket bool, err error)

func (P) GetMinSpend

func (p P) GetMinSpend(bid bool) map[bool]float64

type Place

type Place struct {
	Price, Amount   float64
	SAmount, Symbol string
	Sell            bool
	Err             error
}

type T

type T [3]string

func (T) Contain

func (t T) Contain(d D) bool

func (T) Edge

func (t T) Edge(i int, s bool) D

func (T) Foreach

func (t T) Foreach(v [3]bool, f func(D))

func (T) Has

func (t T) Has(s string) bool

func (T) Reverse

func (t T) Reverse() T

func (T) String

func (t T) String() string

type Trade

type Trade struct {
	Tid    int64             `json:"tid"`
	Type   cons.TradeSide    `json:"type"`
	Amount float64           `json:"amount,string"`
	Price  float64           `json:"price,string"`
	Date   int64             `json:"date_ms"`
	Pair   cons.CurrencyPair `json:"omitempty"`
}

type TradeFee

type TradeFee struct {
	MakerFee, TakerFee float64
}

Jump to

Keyboard shortcuts

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