storages

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StrategiesPath = "zero-sum" // 策略结果数据文件存储路径
	OrdersPath     = "qmt"      // QMT订单缓存路径
)

Variables

This section is empty.

Functions

func BaseDataUpdate added in v0.2.7

func BaseDataUpdate(barIndex int, date string, plugins []cache.DataAdapter, op cache.OpKind)

BaseDataUpdate 修复数据

func CheckOrderState added in v0.7.7

func CheckOrderState(date string, model models.Strategy, code string, direction trader.Direction) bool

CheckOrderState 检查订单执行状态

func CountStrategyOrders added in v0.7.7

func CountStrategyOrders(date string, model models.Strategy, direction trader.Direction) int

CountStrategyOrders 统计策略订单数

func FeaturesUpdate added in v0.2.7

func FeaturesUpdate(barIndex *int, cacheDate, featureDate string, plugins []cache.DataAdapter, op cache.OpKind)

FeaturesUpdate 更新特征

func FetchListForFirstPurchase added in v0.7.9

func FetchListForFirstPurchase(date, qmtStrategyName string, direction trader.Direction) []string

FetchListForFirstPurchase 获取指定日期交易的个股列表

func GetResultCachePath added in v0.5.6

func GetResultCachePath() string

GetResultCachePath 获取结果缓存路径

func OutputStatistics added in v0.5.6

func OutputStatistics(model models.Strategy, date string, v []models.Statistics)

OutputStatistics 输出策略结果

func PushOrderState added in v0.7.7

func PushOrderState(date string, model models.Strategy, code string, direction trader.Direction) error

PushOrderState 推送订单完成状态

func SaveStockPool added in v0.6.1

func SaveStockPool(list []StockPool)

func Touch added in v0.7.7

func Touch(filename string) error

Touch 创建一个空文件

Types

type StockPool added in v0.6.1

type StockPool struct {
	Status         StrategyStatus `name:"策略状态" dataframe:"status"`
	Date           string         `name:"信号日期" dataframe:"date"`
	Code           string         `name:"证券代码" dataframe:"code"`
	Name           string         `name:"证券名称" dataframe:"name"`
	TurnZ          float64        `name:"开盘换手Z" dataframe:"turn_z"`
	Rate           float64        `name:"涨跌幅%" dataframe:"rate"`
	Buy            float64        `name:"委托价格" dataframe:"buy"`
	Sell           float64        `name:"目标价格" dataframe:"sell"`
	StrategyCode   int            `name:"策略编码" dataframe:"strategy_code"`
	StrategyName   string         `name:"策略名称" dataframe:"strategy_name"`
	Rules          uint64         `name:"规则" dataframe:"rules"`
	BlockType      string         `name:"板块类型" dataframe:"block_type"`
	BlockCode      string         `name:"板块代码" dataframe:"block_code"`
	BlockName      string         `name:"板块名称" dataframe:"block_name"`
	BlockRate      float64        `name:"板块涨幅%" dataframe:"block_rate"`
	BlockTop       int            `name:"板块排名" dataframe:"block_top"`
	BlockRank      int            `name:"个股排名" dataframe:"block_rank"`
	BlockZhangTing string         `name:"板块涨停数" dataframe:"block_zhangting"`
	BlockDescribe  string         `name:"涨/跌/平" dataframe:"block_describe"`
	BlockTopCode   string         `name:"领涨股代码" dataframe:"block_top_code"`
	BlockTopName   string         `name:"领涨股名称" dataframe:"block_top_name"`
	BlockTopRate   float64        `name:"领涨股涨幅%" dataframe:"block_top_rate"`
	Tendency       string         `name:"短线趋势" dataframe:"tendency"`
	OrderId        int            `name:"订单ID" dataframe:"order_id"`
	OrderStatus    int            `name:"订单状态" dataframe:"order_status"`
	Active         int            `name:"活跃度" dataframe:"active"`
	Speed          float64        `name:"涨速" dataframe:"speed"`
	CreateTime     string         `name:"创建时间" dataframe:"create_time"`
	UpdateTime     string         `name:"更新时间" dataframe:"update_time"`
}

StockPool 股票池

func GetStockPool added in v0.6.1

func GetStockPool() (list []StockPool)

func (StockPool) Key added in v0.7.2

func (sp StockPool) Key() string

Key 索引字段: 日期/策略代码/证券代码

type StrategyStatus added in v0.6.1

type StrategyStatus int
const (
	StrategyMiss          StrategyStatus = 0x0000 // 策略 - 未命中
	StrategyHit           StrategyStatus = 0x0001 // 策略 - 命中
	StrategyCancel        StrategyStatus = 0x0002 // 策略 - 召回
	StrategyPassed        StrategyStatus = 0x0004 // 策略 - 成功
	StrategyOrdered       StrategyStatus = 0x0008 // 策略 - 已下单
	StrategySucceeded     StrategyStatus = 0x0010 // 策略 - 订单已成功
	StrategyJunk          StrategyStatus = 0x0080 // 策略 - 作废
	StrategyAlreadyExists StrategyStatus = 0x8000 // 已存在
)

func (*StrategyStatus) IsCancel added in v0.6.1

func (s *StrategyStatus) IsCancel() bool

IsCancel 是否召回/撤销

func (*StrategyStatus) IsHit added in v0.6.1

func (s *StrategyStatus) IsHit() bool

IsHit 是否命中

func (*StrategyStatus) IsPassed added in v0.6.1

func (s *StrategyStatus) IsPassed() bool

func (*StrategyStatus) Set added in v0.6.1

func (s *StrategyStatus) Set(other StrategyStatus, on bool)

Set 设置状态

Jump to

Keyboard shortcuts

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