symbols

package
v0.0.0-...-0a93553 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusDisable status = 0
	StatusEnable  status = 1
)

Variables

This section is empty.

Functions

func Init

func Init(db *xorm.Engine, rdc *redis.Client)

Types

type Pairs

type Pairs struct {
	Id     int    `xorm:"pk autoincr int" json:"-"`
	Symbol string `xorm:"varchar(100) notnull unique(symbol)" json:"symbol"`
	Name   string `xorm:"varchar(250) notnull" json:"name"`

	TargetSymbolId   int `xorm:"default(0) unique(symbol_base)" json:"target_symbol_id"`   //交易物品
	StandardSymbolId int `xorm:"default(0) unique(symbol_base)" json:"standard_symbol_id"` //支付货币

	PricePrec      int             `xorm:"default(2)" json:"price_prec"`
	QtyPrec        int             `xorm:"default(0)" json:"qty_prec"`
	AllowMinQty    types.NumberStr `xorm:"decimal(40,20) notnull" json:"allow_min_qty"`
	AllowMaxQty    types.NumberStr `xorm:"decimal(40,20) notnull" json:"allow_max_qty"`
	AllowMinAmount types.NumberStr `xorm:"decimal(40,20) notnull" json:"allow_min_amount"`
	AllowMaxAmount types.NumberStr `xorm:"decimal(40,20) notnull" json:"allow_max_amount"`
	FeeRate        types.NumberStr `xorm:"decimal(40,20) notnull default(0)" json:"fee_rate"`

	Status     status    `xorm:"default(0) notnull" json:"-"`
	CreateTime time.Time `xorm:"timestamp created" json:"-"`
	UpdateTime time.Time `xorm:"timestamp updated" json:"-"`

	Target   Symbol `xorm:"-" json:"target"`
	Standard Symbol `xorm:"-" json:"standard"`
}

func GetPairBySymbol

func GetPairBySymbol(symbol string) (*Pairs, error)

func (*Pairs) FormatAmount

func (t *Pairs) FormatAmount(a string) string

func (*Pairs) FormatQty

func (t *Pairs) FormatQty(qty string) string

type Symbol

type Symbol struct {
	Id           int       `xorm:"pk autoincr int" json:"id"`
	Symbol       string    `xorm:"varchar(100) notnull unique(symbol)" json:"symbol"`
	Name         string    `xorm:"varchar(250) notnull" json:"name"`
	ShowPrec     int       `xorm:"default(0)" json:"show_prec"`
	MinPrecision int       `xorm:"default(0)" json:"min_precision"`
	Standard     bool      `xorm:"default(0)" json:"standard"` //是否为本位币
	Status       status    `xorm:"default(0) notnull" json:"-"`
	CreateTime   time.Time `xorm:"timestamp created" json:"-"`
	UpdateTime   time.Time `xorm:"timestamp updated" json:"-"`
}

func GetSymbolInfo

func GetSymbolInfo(id int) Symbol

func GetSymbolInfoBySymbol

func GetSymbolInfoBySymbol(symbol string) (*Symbol, error)

func (*Symbol) FormatNumber

func (s *Symbol) FormatNumber(n string) string

Jump to

Keyboard shortcuts

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