core

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package core 核心逻辑实现

Index

Constants

This section is empty.

Variables

View Source
var DefaultCheckerOptions = CheckerOptions{
	MinROE:               8.0,
	CheckYears:           5,
	NoCheckYearsROE:      20.0,
	MaxDebtAssetRatio:    60.0,
	MaxHV:                1.0,
	MinTotalMarketCap:    100.0,
	BankMinROA:           0.5,
	BankMinZBCZL:         8.0,
	BankMaxBLDKL:         3.0,
	BankMinBLDKBBFGL:     100.0,
	IsCheckJLLStability:  false,
	IsCheckMLLStability:  false,
	IsCheckPriceByCalc:   true,
	MaxPEG:               1.5,
	MinBYYSRatio:         0.9,
	MaxBYYSRatio:         1.1,
	MinFZLDB:             1,
	IsCheckCashflow:      false,
	IsCheckMLLGrow:       false,
	IsCheckJLLGrow:       false,
	IsCheckEPSGrow:       true,
	IsCheckRevGrow:       true,
	IsCheckNetprofitGrow: true,
	MinGxl:               0.0,
}

DefaultCheckerOptions 默认检测值

Functions

This section is empty.

Types

type CheckResult

type CheckResult map[string]map[string]string

CheckResult 检测结果 key 为检测项,value为描述map {"ROE": {"desc": "高于8.0", "ok":"true"}}

type Checker

type Checker struct {
	Options CheckerOptions
}

Checker 检测器实例

func NewChecker

func NewChecker(ctx context.Context, opts CheckerOptions) *Checker

NewChecker 创建检查器实例

func (Checker) CheckFundStocks

func (c Checker) CheckFundStocks(ctx context.Context, fund *models.Fund) (results FundStocksCheckResult, err error)

CheckFundStocks 检测基金持仓股票 返回结果 {"stockname": {"ROE": "xx", "EPS": ""}}

func (Checker) CheckFundamentals

func (c Checker) CheckFundamentals(ctx context.Context, stock models.Stock) (result CheckResult, ok bool)

CheckFundamentals 检测股票基本面 [[检测失败项, 原因], ...]

func (Checker) GetFundStocksSimilarity

func (c Checker) GetFundStocksSimilarity(ctx context.Context, codes []string) ([]FundStocksSimilarity, error)

GetFundStocksSimilarity 返回基金持仓相似度

type CheckerOptions

type CheckerOptions struct {
	// 最新一期 ROE 不低于该值
	MinROE float64 `json:"min_roe"                 form:"checker_min_roe"`
	// 连续增长年数
	CheckYears int `json:"check_years"             form:"checker_check_years"`
	// ROE 高于该值时不做连续增长检查
	NoCheckYearsROE float64 `json:"no_check_years_roe"      form:"checker_no_check_years_roe"`
	// 最大资产负债率百分比(%)
	MaxDebtAssetRatio float64 `json:"max_debt_asset_ratio"    form:"checker_max_debt_asset_ratio"`
	// 最大历史波动率
	MaxHV float64 `json:"max_hv"                  form:"checker_max_hv"`
	// 最小市值(亿)
	MinTotalMarketCap float64 `json:"min_total_market_cap"    form:"checker_min_total_market_cap"`
	// 银行股最小 ROA
	BankMinROA float64 `json:"bank_min_roa"            form:"checker_bank_min_roa"`
	// 银行股最小资本充足率
	BankMinZBCZL float64 `json:"bank_min_zbczl"          form:"checker_bank_min_zbczl"`
	// 银行股最大不良贷款率
	BankMaxBLDKL float64 `json:"bank_max_bldkl"          form:"checker_bank_max_bldkl"`
	// 银行股最低不良贷款拨备覆盖率
	BankMinBLDKBBFGL float64 `json:"bank_min_bldkbbfgl"      form:"checker_bank_min_bldkbbfgl"`
	// 是否检测毛利率稳定性
	IsCheckMLLStability bool `json:"is_check_mll_stability"  form:"checker_is_check_mll_stability"`
	// 是否检测净利率稳定性
	IsCheckJLLStability bool `json:"is_check_jll_stability"  form:"checker_is_check_jll_stability"`
	// 是否使用估算合理价进行检测,高于估算价将被过滤
	IsCheckPriceByCalc bool `json:"is_check_price_by_calc"  form:"checker_is_check_price_by_calc"`
	// 最大 PEG
	MaxPEG float64 `json:"max_peg"                 form:"checker_max_peg"`
	// 最小本业营收比
	MinBYYSRatio float64 `json:"min_byys_ratio"          form:"checker_min_byys_ratio"`
	// 最大本业营收比
	MaxBYYSRatio float64 `json:"max_byys_ratio"          form:"checker_max_byys_ratio"`
	// 最小负债流动比
	MinFZLDB float64 `json:"min_fzldb"               form:"checker_min_fzldb"`
	// 是否检测现金流量
	IsCheckCashflow bool `json:"is_check_cashflow"       form:"checker_is_check_cashflow"`
	// 是否检测毛利率逐年递增
	IsCheckMLLGrow bool `json:"is_check_mll_grow"       form:"checker_is_check_mll_grow"`
	// 是否检测净利率逐年递增
	IsCheckJLLGrow bool `json:"is_check_jll_grow"       form:"checker_is_check_jll_grow"`
	// 是否检测EPS逐年递增
	IsCheckEPSGrow bool `json:"is_check_eps_grow"       form:"checker_is_check_eps_grow"`
	// 是否检测营收逐年递增
	IsCheckRevGrow bool `json:"is_check_rev_grow"       form:"checker_is_check_rev_grow"`
	// 是否检测净利润逐年递增
	IsCheckNetprofitGrow bool `json:"is_check_netprofit_grow" form:"checker_is_check_netprofit_grow"`
	// 最低股息率
	MinGxl float64 `json:"min_gxl"                 form:"checker_min_gxl"`
}

CheckerOptions 检测条件选项

type FundStocksCheckResult

type FundStocksCheckResult struct {
	Names                   []string      `json:"names"`
	CheckResults            []CheckResult `json:"check_results"`
	FinaReportNames         []string      `json:"fina_report_names"`
	FinaAppointPublishDates []string      `json:"fina_appoint_publish_dates"`
}

FundStocksCheckResult 股票持仓检测结果

type FundStocksSimilarity

type FundStocksSimilarity struct {
	Fund *models.Fund `json:"fund"`
	// 1:完全相同 0:完全不同
	SimilarityValue float64  `json:"similarity_value"`
	SameStocks      []string `json:"same_stocks"`
}

FundStocksSimilarity 基金持仓相似度

type Searcher

type Searcher struct{}

Searcher 搜索器实例

func NewSearcher

func NewSearcher(ctx context.Context) Searcher

NewSearcher 创建搜索器实例

func (Searcher) SearchFundByStock

func (s Searcher) SearchFundByStock(ctx context.Context, stockNames ...string) ([]eastmoney.HoldStockFund, error)

SearchFundByStock 根据股票名称查询持有该股票的基金

func (Searcher) SearchFunds

func (s Searcher) SearchFunds(ctx context.Context, fundCodes []string) (map[string]*models.Fund, error)

SearchFunds 按基金代码搜索基金

func (Searcher) SearchStocks

func (s Searcher) SearchStocks(ctx context.Context, keywords []string) (map[string]models.Stock, error)

SearchStocks 按股票名或代码搜索股票

type Selector

type Selector struct {
	Filter  eastmoney.Filter
	Checker *Checker
}

Selector 选股器

func NewSelector

func NewSelector(ctx context.Context, filter eastmoney.Filter, checker *Checker) Selector

NewSelector 创建选股器

func (Selector) AutoFilterStocks

func (s Selector) AutoFilterStocks(ctx context.Context) (result models.StockList, err error)

AutoFilterStocks 按默认设置自动筛选股票

Jump to

Keyboard shortcuts

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