Documentation
¶
Index ¶
- Constants
- func AllScan(barIndex *int, model models.Strategy)
- func BackTesting(strategyNo uint64, countDays, countTopN int)
- func BlockTypeName(blockCode string) string
- func CheckStrategy(strategyCode uint64, securityCode, testDate string)
- func ExecuteStrategy(model models.Strategy, barIndex *int)
- func GetBlockList() []string
- func MarketSentiment()
- func OutputTable(model models.Strategy, stockSnapshots []factors.QuoteSnapshot)
- func ScanAllSectors(barIndex *int, model models.Strategy)
- func ScanSectorForTick(barIndex *int) []string
- func SectorSortForHead(a, b factors.QuoteSnapshot) bool
- func SectorSortForTick(a, b factors.QuoteSnapshot) bool
- func StockSort(a, b factors.QuoteSnapshot) bool
- func TopBlockWithType(pbarIndex *int, rule *config.StrategyParameter) map[securities.BlockType][]SectorInfo
- func Tracker(strategyNumbers ...uint64)
- type GoodCase
- type SampleFeature
- type SectorInfo
Constants ¶
View Source
const ( StoreSnapshotTimeBegin = "09:25:00" // 缓存快照数据的开始时间 StoreSnapshotTimeEnd = "09:29:59" // 缓存快照数据的结束时间 SectorMinChangeRate = 0.10 // 板块开盘最小涨幅 SectorMinVolume = 1e8 // 板块开盘最低成交金额 )
策略常量
View Source
const (
SecurityUnknown = "unknown"
)
Variables ¶
This section is empty.
Functions ¶
func BackTesting ¶
BackTesting 执行策略回测,计算指定策略在指定日期范围内的表现
参数:
strategyNo: 策略编号 countDays: 回测天数 countTopN: 每日选取的标的数量
功能:
- 获取指定日期范围内的交易日数据
- 加载策略模型和交易规则
- 对每个交易日执行以下操作: - 加载标的特征数据 - 过滤符合条件的标的 - 计算各项指标(Alpha/Beta/溢价率等) - 输出每日回测结果
- 汇总统计整体回测表现
输出:
- 控制台输出每日回测结果表格
- 生成CSV文件保存详细回测数据
- 计算并输出平均收益率、胜率等汇总指标
func BlockTypeName ¶ added in v1.1.6
func CheckStrategy ¶ added in v1.0.2
CheckStrategy 检查当前交易日中个股在策略中的执行情况
func ExecuteStrategy ¶ added in v1.2.2
ExecuteStrategy 执行策略
func GetBlockList ¶ added in v1.1.6
func GetBlockList() []string
func OutputTable ¶ added in v1.1.6
func OutputTable(model models.Strategy, stockSnapshots []factors.QuoteSnapshot)
OutputTable 输出表格
func ScanAllSectors ¶ added in v1.2.5
ScanAllSectors 扫描板块
func ScanSectorForTick ¶ added in v1.1.6
ScanSectorForTick 扫描板块
func SectorSortForHead ¶ added in v1.6.6
func SectorSortForHead(a, b factors.QuoteSnapshot) bool
SectorSortForHead 板块排序, 早盘
func SectorSortForTick ¶ added in v1.6.6
func SectorSortForTick(a, b factors.QuoteSnapshot) bool
SectorSortForTick 板块排序, 盘中
func TopBlockWithType ¶ added in v1.1.6
func TopBlockWithType(pbarIndex *int, rule *config.StrategyParameter) map[securities.BlockType][]SectorInfo
TopBlockWithType 板块排行
Types ¶
type GoodCase ¶
type GoodCase struct {
Date string `dataframe:"日期"`
Num int `dataframe:"数量"`
Yields float64 `dataframe:"浮动收益率%"`
//NextYields float64 `dataframe:"隔日收益率%"`
GtP1 float64 `dataframe:"胜率率%"`
GtP2 float64 `dataframe:"溢价超1%"`
GtP3 float64 `dataframe:"溢价超2%"`
GtP4 float64 `dataframe:"溢价超3%"`
GtP5 float64 `dataframe:"溢价超5%"`
}
GoodCase good case
type SampleFeature ¶
type SampleFeature struct {
SecurityCode string
Name string
OpenChangeRate float64
OpenTurnZ float64
LastClose float64
Open float64
Price float64
UpRate float64
OpenPremiumRate float64
NextPremiumRate float64
OpenQuantityRatio float64 // 量比
Beta float64
Alpha float64
}
SampleFeature 样本特征
type SectorInfo ¶ added in v1.1.6
type SectorInfo struct {
Code string `name:"代码"` // 板块代码
Name string `name:"名称"` // 板块名称
Type string `name:"类型"` // 板块类型
OpenAmount float64 `name:"开盘金额"` // 开盘金额
OpenChangeRate float64 `name:"开盘涨幅"` // 开盘涨幅
ChangeRate float64 `name:"板块涨幅"` // 板块涨幅
Rank int `name:"板块排名"` // 板块排名
TopCode string `name:"领涨个股"` // 领涨个股
TopName string `name:"领涨个股名称"` // 领涨个股名称
TopRate float64 `name:"领涨个股涨幅"` // 领涨个股涨幅
Count int `name:"总数"` // 总数
LimitUpNum int `name:"涨停数"` // 涨停数
NoChangeNum int `name:"平盘数"` // 平盘数
UpCount int `name:"上涨家数"` // 上涨家数
DownCount int `name:"下跌家数"` // 下跌家数
Capital float64 // 流通盘
FreeCapital float64 // 自由流通股本
OpenTurnZ float64 `name:"开盘换手"` // 开盘换手
StockCodes []string `dataframe:"-"` // 股票代码
}
SectorInfo 板块信息
Click to show internal directories.
Click to hide internal directories.