Documentation ¶
Overview ¶
Package models 定义数据库 model
Index ¶
- Constants
- Variables
- func InitFund4433List() error
- func InitFundAllList() error
- func InitFundManagers() error
- func InitFundTypeList() error
- func InitGlobalVars()
- func InitIndustryList() error
- type ExportorData
- type ExportorDataList
- type Fund
- type FundList
- type FundSortType
- type ParamFundListFilter
- type Stock
- type StockList
Constants ¶
View Source
const ( // FundSortTypeWeek 按最近一周收益率排序 FundSortTypeWeek = iota // FundSortTypeMonth1 按最近一月收益率排序 FundSortTypeMonth1 // FundSortTypeMonth3 按最新三月收益率排序 FundSortTypeMonth3 // FundSortTypeMonth6 按最新六月收益率排序 FundSortTypeMonth6 // FundSortTypeYear1 按最近一年收益率排序 FundSortTypeYear1 // FundSortTypeYear2 按最近两年收益率排序 FundSortTypeYear2 // FundSortTypeYear3 按最近三年收益率排序 FundSortTypeYear3 // FundSortTypeYear5 按最近五年收益率排序 FundSortTypeYear5 // FundSortTypeThisYear 按今年来收益率排序 FundSortTypeThisYear // FundSortTypeHistorical 按成立来收益率排序 FundSortTypeHistorical // FundSortTypeStddev135Avg 按1,3,5年波动率平均值排序 FundSortTypeStddev135Avg // FundSortTypeMaxRetr135Avg 按1,3,5年最大回撤率平均值排序 FundSortTypeMaxRetr135Avg // FundSortTypeSharp135Avg 按1,3,5年夏普比率平均值排序 FundSortTypeSharp135Avg )
Variables ¶
View Source
var ( // StockIndustryList 东方财富股票行业列表 StockIndustryList []string // FundTypeList 基金类型列表 FundTypeList []string // Fund4433TypeList 4433基金类型列表 Fund4433TypeList []string // FundAllList 全量基金列表 FundAllList FundList // Fund4433List 满足4433法则的基金列表 Fund4433List FundList // FundManagers 基金经理列表 FundManagers eastmoney.FundManagerInfoList // SyncFundTime 基金数据同步时间 SyncFundTime = time.Now() // RawFundAllListFilename api返回的原始结果 RawFundAllListFilename = "./eastmoney_funds_list.json" // FundAllListFilename 基金列表数据文件 FundAllListFilename = "./fund_all_list.json" // Fund4433ListFilename 4433基金列表数据文件 Fund4433ListFilename = "./fund_4433_list.json" // IndustryListFilename 行业列表数据文件 IndustryListFilename = "./industry_list.json" // FundTypeListFilename 基金类型数据文件 FundTypeListFilename = "./fund_type_list.json" // FundManagersFilename 基金经理数据文件 FundManagersFilename = "./fund_managers.json" // AAACompanyBondSyl AAA公司债当期收益率 AAACompanyBondSyl = -1.0 // datacenter.ChinaBond.QueryAAACompanyBondSyl(context.Background()) )
Functions ¶
func InitFund4433List ¶ added in v1.2.47
func InitFund4433List() error
InitFund4433List 从json文件加载基金列表
func InitFundTypeList ¶ added in v1.2.47
func InitFundTypeList() error
InitFundTypeList 从json文件加载基金类型
Types ¶
type ExportorData ¶
type ExportorData struct { // 股票名 Name string `json:"name" csv:"股票名"` // 股票代码 Code string `json:"code" csv:"股票代码"` // 所属行业 Industry string `json:"industry" csv:"所属行业"` // 题材关键词 Keywords string `json:"keywords" csv:"题材关键词"` // 公司信息 CompanyProfile string `json:"company_profile" csv:"公司信息"` // 主营构成 MainForms string `json:"main_forms" csv:"主营构成"` // 本业营收比 BYYSRatio float64 `json:"byys_ration" csv:"本业营收比"` // 财报年份-类型 ReportDateName string `json:"report_date_name" csv:"数据源"` // 财报审计意见 ReportOpinion interface{} `json:"report_opinion" csv:"财报审计意见"` // 价值评估 JZPG string `json:"jzpg" csv:"价值评估"` // 当前 ROE LatestROE float64 `json:"latest_roe" csv:"当前 ROE"` // 最近财报 ROE LatestFinaROE float64 `json:"latest_fina_roe" csv:"最新财报 ROE"` // ROE 同比增长 ROETBZZ float64 `json:"roe_tbzz" csv:"ROE 同比增长 (%)"` // 近五年 ROE ROE5Y []float64 `json:"roe_5y" csv:"近五年 ROE"` // 最新一期 EPS LatestEPS float64 `json:"latest_eps" csv:"最新一期 EPS"` // EPS 同比增长 EPSTBZZ float64 `json:"eps_tbzz" csv:"EPS 同比增长 (%)"` // 近五年 EPS EPS5Y []float64 `json:"eps_5y" csv:"近五年 EPS"` // 营业总收入 TotalIncome interface{} `json:"total_income" csv:"营业总收入"` // 营业总收入同比增长 TotalIncomeTBZZ float64 `json:"total_income_tbzz" csv:"营业总收入同比增长 (%)"` // 近五年营收 TotalIncome5Y []float64 `json:"total_income_5y" csv:"近五年营收"` // 归属净利润 NetProfit interface{} `json:"net_profit" csv:"归属净利润(元)"` // 归属净利润同比增长 (%) NetProfitTBZZ float64 `json:"net_profit_tbzz" csv:"归属净利润同比增长 (%)"` // 近五年净利润 NetProfit5Y []float64 `json:"net_profit_5y" csv:"近五年净利润"` // 最新股息率 (%) ZXGXL float64 `json:"zxgxl" csv:"最新股息率 (%)"` // 财报披露日期 FinaReportDate string `json:"fina_report_date" csv:"财报披露日期"` // 预约财报披露日期 FinaAppointPublishDate string `json:"fina_appoint_publish_date" csv:"预约财报披露日期"` // 实际财报披露日期 FinaActualPublishDate string `json:"fina_actual_publish_date" csv:"实际财报披露日期"` // 总市值(字符串) TotalMarketCap interface{} `json:"total_market_cap" csv:"总市值"` // 当时价格 Price float64 `json:"price" csv:"价格"` // 估算合理价格 RightPrice interface{} `json:"right_price" csv:"估算合理价格"` // 合理价格与当时价的价格差(%) PriceSpace interface{} `json:"price_space" csv:"合理价差"` // 历史波动率 HV float64 `json:"hv" csv:"历史波动率"` // 最新负债率 (%) ZXFZL float64 `json:"zxfzl" csv:"最新负债率 (%)"` // 负债流动比 FZLDB float64 `json:"fzldb" csv:"负债流动比"` // 净利润 3 年复合增长率 (%) NetprofitGrowthrate3Y float64 `json:"netprofit_growthrate_3_y" csv:"净利润 3 年复合增长率 (%)"` // 营收 3 年复合增长率 (%) IncomeGrowthrate3Y float64 `json:"income_growthrate_3_y" csv:"营收 3 年复合增长率 (%)"` // 上市以来年化收益率 (%) ListingYieldYear float64 `json:"listing_yield_year" csv:"上市以来年化收益率 (%)"` // 上市以来年化波动率 (%) ListingVolatilityYear float64 `json:"listing_volatility_year" csv:"年化波动率 (%)"` // 市盈率 PE float64 `json:"pe" csv:"市盈率"` // PEG PEG float64 `json:"peg" csv:"PEG"` // 机构评级 OrgRating string `json:"org_rating" csv:"机构评级"` // 盈利预测 ProfitPredict string `json:"profit_predict" csv:"盈利预测"` // 市盈率估值 ValuationSYL string `json:"valuation_syl" csv:"市盈率估值"` // 市净率估值 ValuationSJL string `json:"valuation_sjl" csv:"市净率估值"` // 市销率估值 ValuationSXOL string `json:"valuation_sxol" csv:"市销率估值"` // 市现率估值 ValuationSXNL string `json:"valuation_sxnl" csv:"市现率估值"` // 行业均值水平 HYJZSP string `json:"hyjzsp" csv:"行业均值水平"` // 整体质地 ZTZD string `json:"ztzd" csv:"整体质地"` // 近五年毛利率 MLL5Y []float64 `json:"mll_5y" csv:"近五年毛利率"` // 近五年净利率 JLL5Y []float64 `json:"jll_5y" csv:"近五年净利率"` // 上市时间 ListingDate string `json:"listing_date" csv:"上市时间"` // 最新经营活动产生的现金流量净额 NetcashOperate string `json:"netcash_operate" csv:"经营现金流净额"` // 最新投资活动产生的现金流量净额 NetcashInvest string `json:"netcash_invest" csv:"投资现金流净额"` // 最新筹资活动产生的现金流量净额 NetcashFinance string `json:"netcash_finance" csv:"筹资现金流净额"` // 自由现金流 NetcashFree string `json:"netcash_free" csv:"自由现金流"` // 十大流通股东 FreeHoldersTop10 string `json:"free_holders_top_10" csv:"十大流通股东"` // 主力净流入 MainMoneyNetInflows string `json:"main_money_net_inflows" csv:"主力资金净流入"` }
ExportorData 数据模板
func NewExportorData ¶
func NewExportorData(ctx context.Context, stock Stock) ExportorData
NewExportorData 创建 ExportotData 对象
func (ExportorData) GetHeaderValueMap ¶
func (d ExportorData) GetHeaderValueMap() map[string]interface{}
GetHeaderValueMap 获取以 csv tag 为 key 的 Data map
func (ExportorData) GetHeaders ¶
func (d ExportorData) GetHeaders() []string
GetHeaders 获取 csv tag 列表
type ExportorDataList ¶
type ExportorDataList []ExportorData
ExportorDataList 要导出的数据列表
func NewExportorDataList ¶
func NewExportorDataList(ctx context.Context, stocks StockList) (result ExportorDataList)
NewExportorDataList 创建要导出的数据列表
func (ExportorDataList) ChunkedBySize ¶
func (d ExportorDataList) ChunkedBySize(chunkSize int) []ExportorDataList
ChunkedBySize 将 stock 列表按大小切割分组
func (ExportorDataList) GetIndustryList ¶
func (d ExportorDataList) GetIndustryList() []string
GetIndustryList 获取行业分类列表
func (ExportorDataList) SortByZXGXL ¶
func (d ExportorDataList) SortByZXGXL()
SortByZXGXL 股票列表按最新股息率排序
type Fund ¶
type Fund struct { // 基金代码 Code string `json:"code"` // 基金名称 Name string `json:"name"` // 基金类型 Type string `json:"type"` // 成立时间 EstablishedDate string `json:"established_date"` // 最新基金净资产规模(元) NetAssetsScale float64 `json:"net_assets_scale"` // 跟踪标的代码 IndexCode string `json:"index_code"` // 跟踪标的名称 IndexName string `json:"index_name"` // 购买费率 Rate string `json:"rate"` // 定投状态 FixedInvestmentStatus string `json:"fixed_investment_status"` // 波动率 Stddev fundStddev `json:"stddev"` // 最大回撤率 MaxRetracement fundMaxRetracement `json:"max_retracement"` // 夏普比率 Sharp fundSharp `json:"sharp"` // 绩效 Performance fundPerformance `json:"performance"` // 持仓股票 Stocks []fundStock `json:"stocks"` // 基金经理 Manager fundManager `json:"manager"` // 历史分红送配 HistoricalDividends []fundDividend `json:"historical_dividends"` // 资产占比 AssetsProportion fundAssetsProportion `json:"assets_proportion"` // 行业占比 IndustryProportions []fundIndustryProportion `json:"industry_proportions"` }
Fund 基金
func NewFund ¶
func NewFund(ctx context.Context, efund *eastmoney.RespFundInfo) *Fund
NewFund 创建 Fund 实例
func (Fund) NetAssetsScaleHuman ¶
NetAssetsScaleHuman 净资产数字转换为亿、万单位
type FundList ¶
type FundList []*Fund
FundList list
func (FundList) Filter ¶
func (f FundList) Filter(ctx context.Context, p ParamFundListFilter) FundList
Filter 按参数过滤
func (FundList) FilterByType ¶
FilterByType 按 type 字段过滤
type ParamFundListFilter ¶
type ParamFundListFilter struct { // 类型 Types []string `json:"types" form:"types"` // 基金规模最小值(亿) MinScale float64 `json:"min_scale" form:"min_scale"` // 基金规模最大值(亿) MaxScale float64 `json:"max_scale" form:"max_scale"` // 基金经理管理该基金最低年限 MinManagerYears float64 `json:"min_manager_years" form:"min_manager_years"` // 最近一年收益率排名比 Year1RankRatio float64 `json:"year_1_rank_ratio" form:"year_1_rank_ratio"` // 今年来、最近两年、最近三年、最近五年收益率排名比 ThisYear235RankRatio float64 `json:"this_year_235_rank_ratio" form:"this_year_235_rank_ratio"` // 最近六月收益率排名比 Month6RankRatio float64 `json:"month_6_rank_ratio" form:"month_6_rank_ratio"` // 最近三月收益率排名比 Month3RankRatio float64 `json:"month_3_rank_ratio" form:"month_3_rank_ratio"` // 1,3,5年波动率平均值的最大值 Max135AvgStddev float64 `json:"max_135_avg_stddev" form:"max_135_avg_stddev"` // 1,3,5年夏普比率平均值的最小值 Min135AvgSharp float64 `json:"min_135_avg_sharp" form:"min_135_avg_sharp"` // 1,3,5年最大回撤率平均值的最大值 Max135AvgRetr float64 `json:"max_135_avg_retr" form:"max_135_avg_retr"` // 最低成立年限 MinEstabYears float64 `json:"min_estab_years" form:"min_estab_years"` }
ParamFundListFilter Filter 参数
type Stock ¶
type Stock struct { // 东方财富接口返回的基本信息 BaseInfo eastmoney.StockInfo `json:"base_info"` // 历史财报信息 HistoricalFinaMainData eastmoney.HistoricalFinaMainData `json:"historical_fina_main_data"` // 市盈率、市净率、市销率、市现率估值 ValuationMap map[string]string `json:"valuation_map"` // 历史市盈率 HistoricalPEList eastmoney.HistoricalPEList `json:"historical_pe_list"` // 合理价格(年报):历史市盈率中位数 * (去年EPS * (1 + 今年各期财报的平均营收增长比)) RightPrice float64 `json:"right_price"` // 合理价差(%) PriceSpace float64 `json:"price_space"` // 按前年年报算去年的合理价格:历史市盈率中位数 * (前年EPS * (1 + 去年各期财报的平均营收增长比)) LastYearRightPrice float64 `json:"last_year_right_price"` // 历史股价 HistoricalPrice eniu.RespHistoricalStockPrice `json:"historical_price"` // 历史波动率 HistoricalVolatility float64 `json:"historical_volatility"` // 公司资料 CompanyProfile eastmoney.CompanyProfile `json:"company_profile"` // 预约财报披露日期 FinaAppointPublishDate string `json:"fina_appoint_publish_date"` // 实际财报披露日期 FinaActualPublishDate string `json:"fina_actual_publish_date"` // 财报披露日期 FinaReportDate string `json:"fina_report_date"` // 机构评级 OrgRatingList eastmoney.OrgRatingList `json:"org_rating_list"` // 盈利预测 ProfitPredictList eastmoney.ProfitPredictList `json:"profit_predict_list"` // 价值评估 JZPG eastmoney.JZPG `json:"jzpg"` // PEG=PE/净利润复合增长率 PEG float64 `json:"peg"` // 历史利润表 HistoricalGincomeList eastmoney.GincomeDataList `json:"historical_gincome_list"` // 本业营收比=营业利润/(营业利润+营业外收入) BYYSRatio float64 `json:"byys_ratio"` // 最新财报审计意见 FinaReportOpinion string `json:"fina_report_opinion"` // 历史现金流量表 HistoricalCashflowList eastmoney.CashflowDataList `json:"historical_cashdlow_list"` // 最新经营活动产生的现金流量净额 NetcashOperate float64 `json:"netcash_operate"` // 最新投资活动产生的现金流量净额 NetcashInvest float64 `json:"netcash_invest"` // 最新筹资活动产生的现金流量净额 NetcashFinance float64 `json:"netcash_finance"` // 自由现金流 NetcashFree float64 `json:"netcash_free"` // 十大流通股东 FreeHoldersTop10 eastmoney.FreeHolderList `json:"free_holders_top_10"` // 主力资金净流入 MainMoneyNetInflows zszx.NetInflowList `json:"main_money_net_inflows"` }
Stock 接口返回的股票信息结构
Click to show internal directories.
Click to hide internal directories.