++
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
package main
|
||||
|
||||
// 账号配置 - 对应Python的account.txt
|
||||
// 在Go中,我们用结构体(struct)代替Python的字典
|
||||
type AccountConfig struct {
|
||||
Username string `json:"username"` // `json:xxx` 是标签,告诉程序如何解析JSON
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
// Alpha模拟设置 - 对应Python的default_settings
|
||||
type SimulationSettings struct {
|
||||
InstrumentType string `json:"instrumentType"` // "EQUITY"
|
||||
Region string `json:"region"` // "USA"
|
||||
Universe string `json:"universe"` // "TOP3000"
|
||||
Delay int `json:"delay"` // 1
|
||||
Decay int `json:"decay"` // 12
|
||||
Truncation float64 `json:"truncation"` // 0.05
|
||||
Neutralization string `json:"neutralization"` // "FAST"
|
||||
Pasteurization string `json:"pasteurization"` // "ON"
|
||||
UnitHandling string `json:"unitHandling"` // "VERIFY"
|
||||
NanHandling string `json:"nanHandling"` // "ON"
|
||||
Language string `json:"language"` // "FASTEXPR"
|
||||
Visualization bool `json:"visualization"` // false
|
||||
}
|
||||
|
||||
// 模拟请求数据 - 对应Python的simulation_data
|
||||
type SimulationRequest struct {
|
||||
Type string `json:"type"` // "REGULAR"
|
||||
Settings SimulationSettings `json:"settings"`
|
||||
Regular string `json:"regular"` // 表达式
|
||||
}
|
||||
|
||||
// PerformanceMetrics 包含Alpha因子的所有性能指标
|
||||
type PerformanceMetrics struct {
|
||||
// 基本统计信息
|
||||
SharpeRatio *float64 `json:"sharpe_ratio,omitempty"`
|
||||
AnnualReturn *float64 `json:"annual_return,omitempty"`
|
||||
AnnualVolatility *float64 `json:"annual_volatility,omitempty"`
|
||||
MaxDrawdown *float64 `json:"max_drawdown,omitempty"`
|
||||
InformationRatio *float64 `json:"information_ratio,omitempty"`
|
||||
TailRatio *float64 `json:"tail_ratio,omitempty"`
|
||||
CommonRatio *float64 `json:"common_ratio,omitempty"`
|
||||
|
||||
// 风险调整后收益
|
||||
Score *float64 `json:"score,omitempty"`
|
||||
Turnover *float64 `json:"turnover,omitempty"`
|
||||
SpecificReturn *float64 `json:"specific_return,omitempty"`
|
||||
SpecificRisk *float64 `json:"specific_risk,omitempty"`
|
||||
|
||||
// 分位数表现
|
||||
TopMinusBottom *float64 `json:"top_minus_bottom,omitempty"`
|
||||
TopDecileReturn *float64 `json:"top_decile_return,omitempty"`
|
||||
BottomDecileReturn *float64 `json:"bottom_decile_return,omitempty"`
|
||||
IC *float64 `json:"ic,omitempty"`
|
||||
ICDecay *float64 `json:"ic_decay,omitempty"`
|
||||
|
||||
// 其他指标
|
||||
TotalReturn *float64 `json:"total_return,omitempty"`
|
||||
Capacity *float64 `json:"capacity,omitempty"`
|
||||
Fitness *float64 `json:"fitness,omitempty"`
|
||||
InstrumentCount *float64 `json:"instrument_count,omitempty"`
|
||||
StartDate *string `json:"start_date,omitempty"`
|
||||
EndDate *string `json:"end_date,omitempty"`
|
||||
}
|
||||
|
||||
// 模拟结果 - 对应Python的simulation_result
|
||||
type SimulationResult struct {
|
||||
Status string `json:"status"` // "success", "error", "failed"
|
||||
Expression string `json:"expression"`
|
||||
AlphaID string `json:"alpha_id"`
|
||||
Message string `json:"message,omitempty"` // 错误信息
|
||||
Metrics *PerformanceMetrics `json:"metrics,omitempty"`
|
||||
TimeCost float64 `json:"time_cost"` // 耗时(秒)
|
||||
FormattedTime string `json:"formatted_time"`
|
||||
Timestamp string `json:"timestamp"`
|
||||
}
|
||||
Reference in New Issue
Block a user