goods

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ShowLog = true
)

Functions

func RefreshPairList

func RefreshPairList() ([]string, *errs.Error)

func Setup

func Setup() *errs.Error

Types

type AgeFilter

type AgeFilter struct {
	BaseFilter
	Min int `yaml:"min" mapstructure:"min,omitempty"` // 最小上市天数
	Max int `yaml:"max" mapstructure:"max,omitempty"` // 最大上市天数
}

func (*AgeFilter) Filter

func (f *AgeFilter) Filter(symbols []string, tickers map[string]*banexg.Ticker) ([]string, *errs.Error)

type BaseFilter

type BaseFilter struct {
	Name        string `yaml:"name" mapstructure:"name"`
	Disable     bool   `yaml:"disable" mapstructure:"disable"`
	NeedTickers bool
}

func (*BaseFilter) GetName

func (f *BaseFilter) GetName() string

func (*BaseFilter) IsDisable

func (f *BaseFilter) IsDisable() bool

func (*BaseFilter) IsNeedTickers

func (f *BaseFilter) IsNeedTickers() bool

type CorrelationFilter

type CorrelationFilter struct {
	BaseFilter
	Min       float64 `yaml:"min" mapstructure:"min,omitempty"`
	Max       float64 `yaml:"max" mapstructure:"max,omitempty"`
	Timeframe string  `yaml:"timeframe" mapstructure:"timeframe,omitempty"`
	BackNum   int     `yaml:"back_num" mapstructure:"back_num,omitempty"`
	TopN      int     `yaml:"top_n" mapstructure:"top_n"`
	Sort      string  `yaml:"sort" mapstructure:"sort"`
}

func (*CorrelationFilter) Filter

func (f *CorrelationFilter) Filter(symbols []string, tickers map[string]*banexg.Ticker) ([]string, *errs.Error)

type IFilter

type IFilter interface {
	GetName() string
	IsDisable() bool
	IsNeedTickers() bool
	Filter(pairs []string, tickers map[string]*banexg.Ticker) ([]string, *errs.Error)
}

func GetPairFilters

func GetPairFilters(items []*config.CommonPairFilter, withInvalid bool) ([]IFilter, *errs.Error)

type IProducer

type IProducer interface {
	IFilter
	GenSymbols(tickers map[string]*banexg.Ticker) ([]string, *errs.Error)
}

type IdVal added in v0.1.11

type IdVal struct {
	Id  int
	Val float64
}

type OffsetFilter

type OffsetFilter struct {
	BaseFilter
	Reverse bool    `yaml:"reverse" mapstructure:"reverse,omitempty"`
	Offset  int     `yaml:"offset" mapstructure:"offset,omitempty"`
	Limit   int     `yaml:"limit" mapstructure:"limit,omitempty"`
	Rate    float64 `yaml:"rate" mapstructure:"rate,omitempty"`
}

func (*OffsetFilter) Filter

func (f *OffsetFilter) Filter(symbols []string, tickers map[string]*banexg.Ticker) ([]string, *errs.Error)

type PriceFilter

type PriceFilter struct {
	BaseFilter
	MaxUnitValue float64 `yaml:"max_unit_value" mapstructure:"max_unit_value,omitempty"`
	Precision    float64 `yaml:"precision" mapstructure:"precision,omitempty"`
	Min          float64 `yaml:"min" mapstructure:"min,omitempty"`
	Max          float64 `yaml:"max" mapstructure:"max,omitempty"`
}

PriceFilter The price filter configuration 价格过滤器配置结构体 Precision: 0.001,Filter trading pairs by price precision, and the minimum unit of price change is 0.1% by default 按价格精度过滤交易对,默认要求价格变动最小单位是0.1% Min: Lowest price 最低价格 Max: Highest price 最高价格 MaxUnitValue: The value of the maximum allowable unit price change (for the pricing currency, it is generally USDT). 最大允许的单位价格变动对应的价值(针对定价货币,一般是USDT)。

func (*PriceFilter) Filter

func (f *PriceFilter) Filter(symbols []string, tickers map[string]*banexg.Ticker) ([]string, *errs.Error)

type RateOfChangeFilter

type RateOfChangeFilter struct {
	BaseFilter
	BackDays      int     `yaml:"back_days" mapstructure:"back_days,omitempty"`           // 回顾的K线天数
	Min           float64 `yaml:"min" mapstructure:"min,omitempty"`                       // 最小价格变动比率
	Max           float64 `yaml:"max" mapstructure:"max,omitempty"`                       // 最大价格变动比率
	RefreshPeriod int     `yaml:"refresh_period" mapstructure:"refresh_period,omitempty"` // 缓存时间,秒
}

RateOfChangeFilter 一段时间内(high-low)/low比值

func (*RateOfChangeFilter) Filter

func (f *RateOfChangeFilter) Filter(symbols []string, tickers map[string]*banexg.Ticker) ([]string, *errs.Error)

type ShuffleFilter

type ShuffleFilter struct {
	BaseFilter
	Seed int `yaml:"seed" mapstructure:"seed,omitempty"`
}

func (*ShuffleFilter) Filter

func (f *ShuffleFilter) Filter(symbols []string, tickers map[string]*banexg.Ticker) ([]string, *errs.Error)

type SpreadFilter

type SpreadFilter struct {
	BaseFilter
	MaxRatio float32 `yaml:"max_ratio" mapstructure:"max_ratio,omitempty"` // 公式:1-bid/ask,买卖价差占价格的最大比率
}

流动性过滤器。

func (*SpreadFilter) Filter

func (f *SpreadFilter) Filter(symbols []string, tickers map[string]*banexg.Ticker) ([]string, *errs.Error)

type SymbolVol

type SymbolVol struct {
	Symbol string
	Vol    float64
	Price  float64
}

type VolatilityFilter

type VolatilityFilter struct {
	BaseFilter
	BackDays      int     `yaml:"back_days" mapstructure:"back_days,omitempty"`           // 回顾的K线天数
	Max           float64 `yaml:"max" mapstructure:"max,omitempty"`                       // 波动分数最大值
	Min           float64 `yaml:"min" mapstructure:"min,omitempty"`                       // 波动分数最小值
	RefreshPeriod int     `yaml:"refresh_period" mapstructure:"refresh_period,omitempty"` // 缓存时间
}

VolatilityFilter StdDev(ln(close / prev_close)) * sqrt(num)

func (*VolatilityFilter) Filter

func (f *VolatilityFilter) Filter(symbols []string, tickers map[string]*banexg.Ticker) ([]string, *errs.Error)

type VolumePairFilter

type VolumePairFilter struct {
	BaseFilter
	Limit         int     `yaml:"limit" mapstructure:"limit,omitempty"` // The number of returned results is limited to the first 100 返回结果的数量限制,取前100个
	LimitRate     float64 `yaml:"limit_rate" mapstructure:"limit_rate"`
	MinValue      float64 `yaml:"min_value" mapstructure:"min_value,omitempty"`           // Minimum volume value 最低成交量价值
	RefreshSecs   int     `yaml:"refresh_secs" mapstructure:"refresh_secs,omitempty"`     // Cache time, in seconds 缓存时间,以秒为单位
	BackTimeframe string  `yaml:"back_timeframe" mapstructure:"back_timeframe,omitempty"` // The time period for calculating the volume, which is set to days by default 计算成交量的时间周期,默认为天
	BackPeriod    int     `yaml:"back_period" mapstructure:"back_period,omitempty"`       // The multiplier for the time range obtained by multiplying it by the BackTimeframe 与BackTimeframe相乘得到的时间范围的乘数
}

VolumePairFilter Used to represent a configuration that sorts all trading pairs in reverse order by volume value 用于表示按成交量价值倒序排序所有交易对的配置

func (*VolumePairFilter) Filter

func (f *VolumePairFilter) Filter(symbols []string, tickers map[string]*banexg.Ticker) ([]string, *errs.Error)

func (*VolumePairFilter) GenSymbols

func (f *VolumePairFilter) GenSymbols(tickers map[string]*banexg.Ticker) ([]string, *errs.Error)

Jump to

Keyboard shortcuts

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