Documentation
¶
Index ¶
- Constants
- type ConfigService
- func (cs *ConfigService) AddToWatchlist(stock models.Stock) error
- func (cs *ConfigService) GetConfig() *models.AppConfig
- func (cs *ConfigService) GetWatchlist() []models.Stock
- func (cs *ConfigService) RemoveFromWatchlist(symbol string) error
- func (cs *ConfigService) SearchStocks(keyword string, limit int) []StockSearchResult
- func (cs *ConfigService) UpdateConfig(config *models.AppConfig) error
- type EnhancePromptInput
- type EnhancePromptResult
- type F10Service
- func (s *F10Service) GetBonusFinancing(code normalizedCode) (models.BonusFinancing, error)
- func (s *F10Service) GetBonusFinancingByCode(code string) (models.BonusFinancing, error)
- func (s *F10Service) GetBusinessAnalysis(code normalizedCode) (models.BusinessAnalysis, error)
- func (s *F10Service) GetBusinessAnalysisByCode(code string) (models.BusinessAnalysis, error)
- func (s *F10Service) GetCapitalOperation(code string) (models.F10CapitalOperation, error)
- func (s *F10Service) GetCompanySurvey(code normalizedCode) (map[string]any, error)
- func (s *F10Service) GetCompanySurveyByCode(code string) (map[string]any, error)
- func (s *F10Service) GetCoreThemes(code string) (models.F10CoreThemes, error)
- func (s *F10Service) GetEquityPledge(code normalizedCode) (models.EquityPledge, error)
- func (s *F10Service) GetEquityPledgeByCode(code string) (models.EquityPledge, error)
- func (s *F10Service) GetEquityStructure(code string) (models.F10EquityStructure, error)
- func (s *F10Service) GetFinancialStatements(code normalizedCode) (models.FinancialStatements, error)
- func (s *F10Service) GetFinancialStatementsByCode(code string) (models.FinancialStatements, error)
- func (s *F10Service) GetFundFlow(code normalizedCode) (models.FundFlowSeries, error)
- func (s *F10Service) GetFundFlowByCode(code string) (models.FundFlowSeries, error)
- func (s *F10Service) GetIndustryCompare(code string) models.IndustryCompare
- func (s *F10Service) GetIndustryCompareMetrics(code string) (models.F10IndustryCompareMetrics, error)
- func (s *F10Service) GetInstitutionalHoldings(code normalizedCode) (models.InstitutionalHoldings, error)
- func (s *F10Service) GetInstitutionalHoldingsByCode(code string) (models.InstitutionalHoldings, error)
- func (s *F10Service) GetLockupRelease(code normalizedCode) (models.LockupRelease, error)
- func (s *F10Service) GetLockupReleaseByCode(code string) (models.LockupRelease, error)
- func (s *F10Service) GetMainIndicators(code string) (models.F10MainIndicators, error)
- func (s *F10Service) GetManagement(code string) (models.F10Management, error)
- func (s *F10Service) GetOperationsRequired(code string) (models.F10OperationsRequired, error)
- func (s *F10Service) GetOverview(code string) (models.F10Overview, error)
- func (s *F10Service) GetPerformanceEvents(code normalizedCode) (models.PerformanceEvents, error)
- func (s *F10Service) GetPerformanceEventsByCode(code string) (models.PerformanceEvents, error)
- func (s *F10Service) GetRelatedStocks(code string) (models.F10RelatedStocks, error)
- func (s *F10Service) GetShareholderChanges(code normalizedCode) (models.ShareholderChanges, error)
- func (s *F10Service) GetShareholderChangesByCode(code string) (models.ShareholderChanges, error)
- func (s *F10Service) GetShareholderNumbers(code normalizedCode) (models.ShareholderNumbers, error)
- func (s *F10Service) GetShareholderNumbersByCode(code string) (models.ShareholderNumbers, error)
- func (s *F10Service) GetStockBuyback(code normalizedCode) (models.StockBuyback, error)
- func (s *F10Service) GetStockBuybackByCode(code string) (models.StockBuyback, error)
- func (s *F10Service) GetValuation(code normalizedCode) (models.StockValuation, error)
- func (s *F10Service) GetValuationByCode(code string) (models.StockValuation, error)
- func (s *F10Service) GetValuationTrend(code string, rangeKey string) (models.F10ValuationTrend, error)
- type GenerateInput
- type GenerateResult
- type KLineSubscription
- type LongHuBangListResult
- type LongHuBangService
- type MCPInfoForGen
- type MarketDataPusher
- func (p *MarketDataPusher) AddSubscription(code string)
- func (p *MarketDataPusher) GetSubscribedStocks() []models.Stock
- func (p *MarketDataPusher) RemoveSubscription(code string)
- func (p *MarketDataPusher) SetReady()
- func (p *MarketDataPusher) Start(ctx context.Context)
- func (p *MarketDataPusher) Stop()
- type MarketService
- func (ms *MarketService) GenerateOrderBook(price float64) models.OrderBook
- func (ms *MarketService) GetBoardFundFlowList(category string, page int, size int) (models.BoardFundFlowList, error)
- func (ms *MarketService) GetBoardLeaders(boardCode string, limit int) (models.BoardLeaderList, error)
- func (ms *MarketService) GetIndexFundFlowSeries(code string, interval string, limit int) (models.FundFlowKLineSeries, error)
- func (ms *MarketService) GetKLineData(code string, period string, days int) ([]models.KLineData, error)
- func (ms *MarketService) GetMarketIndices() ([]models.MarketIndex, error)
- func (ms *MarketService) GetMarketStatus() MarketStatus
- func (ms *MarketService) GetRealOrderBook(code string) (models.OrderBook, error)
- func (ms *MarketService) GetStockAnnouncements(code string, page int, size int) (models.StockAnnouncements, error)
- func (ms *MarketService) GetStockDataWithOrderBook(codes ...string) ([]StockWithOrderBook, error)
- func (ms *MarketService) GetStockMovesList(moveType string, page int, size int) (models.StockMoveList, error)
- func (ms *MarketService) GetStockRealTimeData(codes ...string) ([]models.Stock, error)
- func (ms *MarketService) GetTradeDates(days int) ([]string, error)
- func (ms *MarketService) GetTradingSchedule() TradingSchedule
- func (ms *MarketService) SearchStocks(keyword string, limit int) []StockSearchResult
- type MarketStatus
- type NewsService
- type ReportContentResponse
- type ResearchReport
- type ResearchReportResponse
- type ResearchReportService
- func (s *ResearchReportService) FormatReportsToText(reports []ResearchReport) string
- func (s *ResearchReportService) GetReportContent(infoCode string) (*ReportContentResponse, error)
- func (s *ResearchReportService) GetReportPDFUrl(infoCode string) string
- func (s *ResearchReportService) GetResearchReports(stockCode string, pageSize, pageNo int) (*ResearchReportResponse, error)
- type SessionService
- func (ss *SessionService) AddMessage(stockCode string, msg models.ChatMessage) error
- func (ss *SessionService) AddMessages(stockCode string, msgs []models.ChatMessage) error
- func (ss *SessionService) ClearMessages(stockCode string) error
- func (ss *SessionService) GetMessages(stockCode string) []models.ChatMessage
- func (ss *SessionService) GetOrCreateSession(stockCode, stockName string) (*models.StockSession, error)
- func (ss *SessionService) GetPosition(stockCode string) *models.StockPosition
- func (ss *SessionService) GetSession(stockCode string) *models.StockSession
- func (ss *SessionService) UpdatePosition(stockCode string, shares int64, costPrice float64) error
- type StockSearchResult
- type StockWithOrderBook
- type StrategyService
- func (s *StrategyService) AddAgentToActiveStrategy(agent models.StrategyAgent) error
- func (s *StrategyService) AddStrategy(strategy models.Strategy) error
- func (s *StrategyService) DeleteAgentFromActiveStrategy(agentID string) error
- func (s *StrategyService) DeleteStrategy(id string) error
- func (s *StrategyService) EnhancePrompt(ctx context.Context, input EnhancePromptInput) (*EnhancePromptResult, error)
- func (s *StrategyService) Generate(ctx context.Context, input GenerateInput) (*GenerateResult, error)
- func (s *StrategyService) GetActiveID() string
- func (s *StrategyService) GetActiveStrategy() *models.Strategy
- func (s *StrategyService) GetAgentByID(id string) *models.AgentConfig
- func (s *StrategyService) GetAgentsByIDs(ids []string) []models.AgentConfig
- func (s *StrategyService) GetAllAgents() []models.AgentConfig
- func (s *StrategyService) GetAllStrategies() []models.Strategy
- func (s *StrategyService) GetEnabledAgents() []models.AgentConfig
- func (s *StrategyService) SetActiveStrategy(id string) error
- func (s *StrategyService) SetLLM(llm model.LLM)
- func (s *StrategyService) UpdateAgentInActiveStrategy(agent models.StrategyAgent) error
- func (s *StrategyService) UpdateStrategy(strategy models.Strategy) error
- type Telegraph
- type ToolInfoForGen
- type TradingPeriod
- type TradingSchedule
- type UpdateInfo
- type UpdateProgress
- type UpdateService
Constants ¶
const ( EventStockUpdate = "market:stock:update" EventOrderBookUpdate = "market:orderbook:update" EventTelegraphUpdate = "market:telegraph:update" EventMarketIndicesUpdate = "market:indices:update" EventMarketSubscribe = "market:subscribe" EventOrderBookSubscribe = "market:orderbook:subscribe" EventKLineUpdate = "market:kline:update" EventKLineSubscribe = "market:kline:subscribe" )
事件名称常量
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigService ¶
type ConfigService struct {
// contains filtered or unexported fields
}
ConfigService 配置服务
func NewConfigService ¶
func NewConfigService(dataDir string) (*ConfigService, error)
NewConfigService 创建配置服务
func (*ConfigService) AddToWatchlist ¶
func (cs *ConfigService) AddToWatchlist(stock models.Stock) error
AddToWatchlist 添加自选股
func (*ConfigService) GetConfig ¶
func (cs *ConfigService) GetConfig() *models.AppConfig
GetConfig 获取配置
func (*ConfigService) GetWatchlist ¶
func (cs *ConfigService) GetWatchlist() []models.Stock
GetWatchlist 获取自选股列表
func (*ConfigService) RemoveFromWatchlist ¶
func (cs *ConfigService) RemoveFromWatchlist(symbol string) error
RemoveFromWatchlist 移除自选股
func (*ConfigService) SearchStocks ¶
func (cs *ConfigService) SearchStocks(keyword string, limit int) []StockSearchResult
SearchStocks 搜索股票
func (*ConfigService) UpdateConfig ¶
func (cs *ConfigService) UpdateConfig(config *models.AppConfig) error
UpdateConfig 更新配置
type EnhancePromptInput ¶ added in v0.2.0
type EnhancePromptInput struct {
OriginalPrompt string `json:"originalPrompt"` // 原始提示词
AgentRole string `json:"agentRole"` // Agent角色
AgentName string `json:"agentName"` // Agent名称
}
EnhancePromptInput 提示词增强输入
type EnhancePromptResult ¶ added in v0.2.0
type EnhancePromptResult struct {
EnhancedPrompt string `json:"enhancedPrompt"` // 增强后的提示词
}
EnhancePromptResult 提示词增强结果
type F10Service ¶ added in v0.3.4
type F10Service struct {
// contains filtered or unexported fields
}
F10Service F10 数据服务
func (*F10Service) GetBonusFinancing ¶ added in v0.3.4
func (s *F10Service) GetBonusFinancing(code normalizedCode) (models.BonusFinancing, error)
GetBonusFinancing 获取分红融资信息
func (*F10Service) GetBonusFinancingByCode ¶ added in v0.3.4
func (s *F10Service) GetBonusFinancingByCode(code string) (models.BonusFinancing, error)
GetBonusFinancingByCode 根据股票代码获取分红融资
func (*F10Service) GetBusinessAnalysis ¶ added in v0.3.4
func (s *F10Service) GetBusinessAnalysis(code normalizedCode) (models.BusinessAnalysis, error)
GetBusinessAnalysis 获取经营分析信息
func (*F10Service) GetBusinessAnalysisByCode ¶ added in v0.3.4
func (s *F10Service) GetBusinessAnalysisByCode(code string) (models.BusinessAnalysis, error)
GetBusinessAnalysisByCode 根据股票代码获取经营分析
func (*F10Service) GetCapitalOperation ¶ added in v0.3.4
func (s *F10Service) GetCapitalOperation(code string) (models.F10CapitalOperation, error)
GetCapitalOperation 获取资本运作信息
func (*F10Service) GetCompanySurvey ¶ added in v0.3.4
func (s *F10Service) GetCompanySurvey(code normalizedCode) (map[string]any, error)
GetCompanySurvey 获取公司概况
func (*F10Service) GetCompanySurveyByCode ¶ added in v0.3.4
func (s *F10Service) GetCompanySurveyByCode(code string) (map[string]any, error)
GetCompanySurveyByCode 根据股票代码获取公司概况
func (*F10Service) GetCoreThemes ¶ added in v0.3.4
func (s *F10Service) GetCoreThemes(code string) (models.F10CoreThemes, error)
GetCoreThemes 获取核心题材(含历史题材与所属板块)
func (*F10Service) GetEquityPledge ¶ added in v0.3.4
func (s *F10Service) GetEquityPledge(code normalizedCode) (models.EquityPledge, error)
GetEquityPledge 获取股权质押概况
func (*F10Service) GetEquityPledgeByCode ¶ added in v0.3.4
func (s *F10Service) GetEquityPledgeByCode(code string) (models.EquityPledge, error)
GetEquityPledgeByCode 根据股票代码获取股权质押
func (*F10Service) GetEquityStructure ¶ added in v0.3.4
func (s *F10Service) GetEquityStructure(code string) (models.F10EquityStructure, error)
GetEquityStructure 获取股本结构
func (*F10Service) GetFinancialStatements ¶ added in v0.3.4
func (s *F10Service) GetFinancialStatements(code normalizedCode) (models.FinancialStatements, error)
GetFinancialStatements 获取财务报表
func (*F10Service) GetFinancialStatementsByCode ¶ added in v0.3.4
func (s *F10Service) GetFinancialStatementsByCode(code string) (models.FinancialStatements, error)
GetFinancialStatementsByCode 根据股票代码获取财务报表
func (*F10Service) GetFundFlow ¶ added in v0.3.4
func (s *F10Service) GetFundFlow(code normalizedCode) (models.FundFlowSeries, error)
GetFundFlow 获取资金流
func (*F10Service) GetFundFlowByCode ¶ added in v0.3.4
func (s *F10Service) GetFundFlowByCode(code string) (models.FundFlowSeries, error)
GetFundFlowByCode 根据股票代码获取资金流
func (*F10Service) GetIndustryCompare ¶ added in v0.3.4
func (s *F10Service) GetIndustryCompare(code string) models.IndustryCompare
GetIndustryCompare 获取行业对比数据
func (*F10Service) GetIndustryCompareMetrics ¶ added in v0.3.4
func (s *F10Service) GetIndustryCompareMetrics(code string) (models.F10IndustryCompareMetrics, error)
GetIndustryCompareMetrics 获取行业对比指标(估值与成长性)
func (*F10Service) GetInstitutionalHoldings ¶ added in v0.3.4
func (s *F10Service) GetInstitutionalHoldings(code normalizedCode) (models.InstitutionalHoldings, error)
GetInstitutionalHoldings 获取机构/股东信息
func (*F10Service) GetInstitutionalHoldingsByCode ¶ added in v0.3.4
func (s *F10Service) GetInstitutionalHoldingsByCode(code string) (models.InstitutionalHoldings, error)
GetInstitutionalHoldingsByCode 根据股票代码获取机构持股
func (*F10Service) GetLockupRelease ¶ added in v0.3.4
func (s *F10Service) GetLockupRelease(code normalizedCode) (models.LockupRelease, error)
GetLockupRelease 获取限售解禁信息
func (*F10Service) GetLockupReleaseByCode ¶ added in v0.3.4
func (s *F10Service) GetLockupReleaseByCode(code string) (models.LockupRelease, error)
GetLockupReleaseByCode 根据股票代码获取限售解禁
func (*F10Service) GetMainIndicators ¶ added in v0.3.4
func (s *F10Service) GetMainIndicators(code string) (models.F10MainIndicators, error)
GetMainIndicators 获取主要指标(年度/季度)
func (*F10Service) GetManagement ¶ added in v0.3.4
func (s *F10Service) GetManagement(code string) (models.F10Management, error)
GetManagement 获取公司高管信息
func (*F10Service) GetOperationsRequired ¶ added in v0.3.4
func (s *F10Service) GetOperationsRequired(code string) (models.F10OperationsRequired, error)
GetOperationsRequired 获取操盘必读数据
func (*F10Service) GetOverview ¶ added in v0.3.4
func (s *F10Service) GetOverview(code string) (models.F10Overview, error)
GetOverview 获取 F10 综合数据
func (*F10Service) GetPerformanceEvents ¶ added in v0.3.4
func (s *F10Service) GetPerformanceEvents(code normalizedCode) (models.PerformanceEvents, error)
GetPerformanceEvents 获取业绩事件
func (*F10Service) GetPerformanceEventsByCode ¶ added in v0.3.4
func (s *F10Service) GetPerformanceEventsByCode(code string) (models.PerformanceEvents, error)
GetPerformanceEventsByCode 根据股票代码获取业绩事件
func (*F10Service) GetRelatedStocks ¶ added in v0.3.4
func (s *F10Service) GetRelatedStocks(code string) (models.F10RelatedStocks, error)
GetRelatedStocks 获取关联个股
func (*F10Service) GetShareholderChanges ¶ added in v0.3.4
func (s *F10Service) GetShareholderChanges(code normalizedCode) (models.ShareholderChanges, error)
GetShareholderChanges 获取股东增减持
func (*F10Service) GetShareholderChangesByCode ¶ added in v0.3.4
func (s *F10Service) GetShareholderChangesByCode(code string) (models.ShareholderChanges, error)
GetShareholderChangesByCode 根据股票代码获取股东增减持
func (*F10Service) GetShareholderNumbers ¶ added in v0.3.4
func (s *F10Service) GetShareholderNumbers(code normalizedCode) (models.ShareholderNumbers, error)
GetShareholderNumbers 获取股东户数
func (*F10Service) GetShareholderNumbersByCode ¶ added in v0.3.4
func (s *F10Service) GetShareholderNumbersByCode(code string) (models.ShareholderNumbers, error)
GetShareholderNumbersByCode 根据股票代码获取股东户数
func (*F10Service) GetStockBuyback ¶ added in v0.3.4
func (s *F10Service) GetStockBuyback(code normalizedCode) (models.StockBuyback, error)
GetStockBuyback 获取股票回购
func (*F10Service) GetStockBuybackByCode ¶ added in v0.3.4
func (s *F10Service) GetStockBuybackByCode(code string) (models.StockBuyback, error)
GetStockBuybackByCode 根据股票代码获取股票回购
func (*F10Service) GetValuation ¶ added in v0.3.4
func (s *F10Service) GetValuation(code normalizedCode) (models.StockValuation, error)
GetValuation 获取估值指标
func (*F10Service) GetValuationByCode ¶ added in v0.3.4
func (s *F10Service) GetValuationByCode(code string) (models.StockValuation, error)
GetValuationByCode 通过股票代码获取估值指标
func (*F10Service) GetValuationTrend ¶ added in v0.3.4
func (s *F10Service) GetValuationTrend(code string, rangeKey string) (models.F10ValuationTrend, error)
GetValuationTrend 获取估值趋势(市盈率/市净率/市销率/市现率)
type GenerateInput ¶ added in v0.2.0
type GenerateInput struct {
Prompt string // 用户描述
Tools []ToolInfoForGen // 可用工具列表
MCPServers []MCPInfoForGen // MCP服务器列表
}
GenerateInput 策略生成输入
type GenerateResult ¶ added in v0.2.0
type GenerateResult struct {
Strategy models.Strategy `json:"strategy"`
Reasoning string `json:"reasoning"`
}
GenerateResult AI生成结果
type KLineSubscription ¶
KLineSubscription K线订阅信息
type LongHuBangListResult ¶
type LongHuBangListResult struct {
Items []models.LongHuBangItem `json:"items"`
Total int `json:"total"` // 总记录数
}
LongHuBangListResult 龙虎榜列表结果
type LongHuBangService ¶
type LongHuBangService struct {
// contains filtered or unexported fields
}
LongHuBangService 龙虎榜服务
func NewLongHuBangService ¶
func NewLongHuBangService() *LongHuBangService
NewLongHuBangService 创建龙虎榜服务
func (*LongHuBangService) GetLongHuBangList ¶
func (s *LongHuBangService) GetLongHuBangList(pageSize, pageNumber int, tradeDate string) (*LongHuBangListResult, error)
GetLongHuBangList 获取龙虎榜列表 tradeDate: 交易日期,格式 YYYY-MM-DD,为空则获取所有日期
func (*LongHuBangService) GetStockDetail ¶
func (s *LongHuBangService) GetStockDetail(code, tradeDate string) ([]models.LongHuBangDetail, error)
GetStockDetail 获取个股龙虎榜营业部明细
type MCPInfoForGen ¶ added in v0.2.0
type MCPInfoForGen struct {
ID string `json:"id"`
Name string `json:"name"`
Tools []string `json:"tools"` // 该服务器提供的工具列表
}
MCPInfoForGen MCP服务器信息(用于生成)
type MarketDataPusher ¶
type MarketDataPusher struct {
// contains filtered or unexported fields
}
MarketDataPusher 市场数据推送服务
func NewMarketDataPusher ¶
func NewMarketDataPusher(marketService *MarketService, configService *ConfigService, newsService *NewsService) *MarketDataPusher
NewMarketDataPusher 创建市场数据推送服务
func (*MarketDataPusher) AddSubscription ¶
func (p *MarketDataPusher) AddSubscription(code string)
AddSubscription 添加订阅
func (*MarketDataPusher) GetSubscribedStocks ¶
func (p *MarketDataPusher) GetSubscribedStocks() []models.Stock
GetSubscribedStocks 获取当前订阅的股票数据
func (*MarketDataPusher) RemoveSubscription ¶
func (p *MarketDataPusher) RemoveSubscription(code string)
RemoveSubscription 移除订阅
func (*MarketDataPusher) SetReady ¶ added in v0.3.0
func (p *MarketDataPusher) SetReady()
SetReady 设置前端已准备好,开始推送数据
type MarketService ¶
type MarketService struct {
// contains filtered or unexported fields
}
MarketService 市场数据服务
func NewMarketServiceWithProviders ¶ added in v0.3.4
func NewMarketServiceWithProviders(primary marketProvider, fallback marketProvider) *MarketService
func (*MarketService) GenerateOrderBook ¶
func (ms *MarketService) GenerateOrderBook(price float64) models.OrderBook
GenerateOrderBook 生成盘口数据(保留兼容,建议使用 GetRealOrderBook)
func (*MarketService) GetBoardFundFlowList ¶ added in v0.3.4
func (ms *MarketService) GetBoardFundFlowList(category string, page int, size int) (models.BoardFundFlowList, error)
GetBoardFundFlowList 获取板块资金流列表(行业/概念/地域)
func (*MarketService) GetBoardLeaders ¶ added in v0.3.4
func (ms *MarketService) GetBoardLeaders(boardCode string, limit int) (models.BoardLeaderList, error)
GetBoardLeaders 获取板块龙头候选
func (*MarketService) GetIndexFundFlowSeries ¶ added in v0.3.4
func (ms *MarketService) GetIndexFundFlowSeries(code string, interval string, limit int) (models.FundFlowKLineSeries, error)
GetIndexFundFlowSeries 获取指数资金流曲线
func (*MarketService) GetKLineData ¶
func (ms *MarketService) GetKLineData(code string, period string, days int) ([]models.KLineData, error)
GetKLineData 获取K线数据(带缓存)
func (*MarketService) GetMarketIndices ¶
func (ms *MarketService) GetMarketIndices() ([]models.MarketIndex, error)
GetMarketIndices 获取大盘指数数据
func (*MarketService) GetMarketStatus ¶
func (ms *MarketService) GetMarketStatus() MarketStatus
GetMarketStatus 获取当前市场交易状态
func (*MarketService) GetRealOrderBook ¶
func (ms *MarketService) GetRealOrderBook(code string) (models.OrderBook, error)
GetRealOrderBook 获取真实盘口数据
func (*MarketService) GetStockAnnouncements ¶ added in v0.3.4
func (ms *MarketService) GetStockAnnouncements(code string, page int, size int) (models.StockAnnouncements, error)
GetStockAnnouncements 获取个股公告摘要
func (*MarketService) GetStockDataWithOrderBook ¶
func (ms *MarketService) GetStockDataWithOrderBook(codes ...string) ([]StockWithOrderBook, error)
GetStockDataWithOrderBook 获取股票实时数据(含真实盘口),带缓存
func (*MarketService) GetStockMovesList ¶ added in v0.3.4
func (ms *MarketService) GetStockMovesList(moveType string, page int, size int) (models.StockMoveList, error)
GetStockMovesList 获取盘口异动列表
func (*MarketService) GetStockRealTimeData ¶
func (ms *MarketService) GetStockRealTimeData(codes ...string) ([]models.Stock, error)
GetStockRealTimeData 获取股票实时数据
func (*MarketService) GetTradeDates ¶ added in v0.3.0
func (ms *MarketService) GetTradeDates(days int) ([]string, error)
GetTradeDates 获取指定天数内的交易日列表(从今天往前推)
func (*MarketService) GetTradingSchedule ¶ added in v0.3.0
func (ms *MarketService) GetTradingSchedule() TradingSchedule
GetTradingSchedule 获取交易时间表(供前端判断市场状态)
func (*MarketService) SearchStocks ¶ added in v0.3.4
func (ms *MarketService) SearchStocks(keyword string, limit int) []StockSearchResult
SearchStocks 搜索股票
type MarketStatus ¶
type MarketStatus struct {
Status string `json:"status"` // trading, closed, pre_market, lunch_break
StatusText string `json:"statusText"` // 中文状态描述
IsTradeDay bool `json:"isTradeDay"` // 是否交易日
HolidayName string `json:"holidayName"` // 节假日名称(如有)
}
MarketStatus 市场交易状态
type NewsService ¶
type NewsService struct {
// contains filtered or unexported fields
}
NewsService 资讯服务
func (*NewsService) GetLatestTelegraph ¶
func (s *NewsService) GetLatestTelegraph() *Telegraph
GetLatestTelegraph 获取最新一条快讯
func (*NewsService) GetTelegraphList ¶
func (s *NewsService) GetTelegraphList() ([]Telegraph, error)
GetTelegraphList 获取财联社快讯列表
type ReportContentResponse ¶
type ReportContentResponse struct {
Content string `json:"content"` // 研报正文内容
PDFUrl string `json:"pdfUrl"` // PDF下载链接
}
ReportContentResponse 研报内容响应
type ResearchReport ¶
type ResearchReport struct {
Title string `json:"title"` // 研报标题
StockName string `json:"stockName"` // 股票名称
StockCode string `json:"stockCode"` // 股票代码
OrgSName string `json:"orgSName"` // 券商简称
PublishDate string `json:"publishDate"` // 发布日期
PredictThisYearEps string `json:"predictThisYearEps"` // 今年预测EPS
PredictThisYearPe string `json:"predictThisYearPe"` // 今年预测PE
PredictNextYearEps string `json:"predictNextYearEps"` // 明年预测EPS
PredictNextYearPe string `json:"predictNextYearPe"` // 明年预测PE
IndvInduName string `json:"indvInduName"` // 行业名称
EmRatingName string `json:"emRatingName"` // 评级名称
Researcher string `json:"researcher"` // 研究员
EncodeUrl string `json:"encodeUrl"` // 报告链接编码
InfoCode string `json:"infoCode"` // 研报唯一标识码
}
ResearchReport 个股研报数据结构
type ResearchReportResponse ¶
type ResearchReportResponse struct {
Data []ResearchReport `json:"data"`
TotalPage int `json:"TotalPage"`
TotalCount int `json:"TotalCount"`
}
ResearchReportResponse API 响应结构
type ResearchReportService ¶
type ResearchReportService struct {
// contains filtered or unexported fields
}
ResearchReportService 研报服务
func NewResearchReportService ¶
func NewResearchReportService() *ResearchReportService
NewResearchReportService 创建研报服务
func (*ResearchReportService) FormatReportsToText ¶
func (s *ResearchReportService) FormatReportsToText(reports []ResearchReport) string
FormatReportsToText 将研报数据格式化为文本
func (*ResearchReportService) GetReportContent ¶
func (s *ResearchReportService) GetReportContent(infoCode string) (*ReportContentResponse, error)
GetReportContent 获取研报正文内容 infoCode: 研报唯一标识码
func (*ResearchReportService) GetReportPDFUrl ¶
func (s *ResearchReportService) GetReportPDFUrl(infoCode string) string
GetReportPDFUrl 根据 infoCode 生成研报 PDF 下载链接
func (*ResearchReportService) GetResearchReports ¶
func (s *ResearchReportService) GetResearchReports(stockCode string, pageSize, pageNo int) (*ResearchReportResponse, error)
GetResearchReports 获取个股研报 stockCode: 股票代码 (如 "000001",支持带前缀如 "sz000001") pageSize: 每页数量 pageNo: 页码
type SessionService ¶
type SessionService struct {
// contains filtered or unexported fields
}
SessionService Session服务
func NewSessionService ¶
func NewSessionService(dataDir string) *SessionService
NewSessionService 创建Session服务
func (*SessionService) AddMessage ¶
func (ss *SessionService) AddMessage(stockCode string, msg models.ChatMessage) error
AddMessage 添加消息到Session
func (*SessionService) AddMessages ¶
func (ss *SessionService) AddMessages(stockCode string, msgs []models.ChatMessage) error
AddMessages 批量添加消息到Session
func (*SessionService) ClearMessages ¶
func (ss *SessionService) ClearMessages(stockCode string) error
ClearMessages 清空Session消息
func (*SessionService) GetMessages ¶
func (ss *SessionService) GetMessages(stockCode string) []models.ChatMessage
GetMessages 获取Session消息
func (*SessionService) GetOrCreateSession ¶
func (ss *SessionService) GetOrCreateSession(stockCode, stockName string) (*models.StockSession, error)
GetOrCreateSession 获取或创建Session
func (*SessionService) GetPosition ¶
func (ss *SessionService) GetPosition(stockCode string) *models.StockPosition
GetPosition 获取持仓信息
func (*SessionService) GetSession ¶
func (ss *SessionService) GetSession(stockCode string) *models.StockSession
GetSession 获取Session
func (*SessionService) UpdatePosition ¶
func (ss *SessionService) UpdatePosition(stockCode string, shares int64, costPrice float64) error
UpdatePosition 更新持仓信息
type StockSearchResult ¶
type StockWithOrderBook ¶
StockWithOrderBook 包含盘口数据的股票信息
type StrategyService ¶ added in v0.2.0
type StrategyService struct {
// contains filtered or unexported fields
}
StrategyService 策略服务
func NewStrategyService ¶ added in v0.2.0
func NewStrategyService(dataDir string) *StrategyService
NewStrategyService 创建策略服务
func (*StrategyService) AddAgentToActiveStrategy ¶ added in v0.2.0
func (s *StrategyService) AddAgentToActiveStrategy(agent models.StrategyAgent) error
AddAgentToActiveStrategy 向当前激活策略添加专家
func (*StrategyService) AddStrategy ¶ added in v0.2.0
func (s *StrategyService) AddStrategy(strategy models.Strategy) error
AddStrategy 添加新策略
func (*StrategyService) DeleteAgentFromActiveStrategy ¶ added in v0.2.0
func (s *StrategyService) DeleteAgentFromActiveStrategy(agentID string) error
DeleteAgentFromActiveStrategy 从当前激活策略删除专家
func (*StrategyService) DeleteStrategy ¶ added in v0.2.0
func (s *StrategyService) DeleteStrategy(id string) error
DeleteStrategy 删除策略
func (*StrategyService) EnhancePrompt ¶ added in v0.2.0
func (s *StrategyService) EnhancePrompt(ctx context.Context, input EnhancePromptInput) (*EnhancePromptResult, error)
EnhancePrompt 增强Agent提示词
func (*StrategyService) Generate ¶ added in v0.2.0
func (s *StrategyService) Generate(ctx context.Context, input GenerateInput) (*GenerateResult, error)
Generate 根据用户描述生成策略
func (*StrategyService) GetActiveID ¶ added in v0.2.0
func (s *StrategyService) GetActiveID() string
GetActiveID 获取当前激活策略ID
func (*StrategyService) GetActiveStrategy ¶ added in v0.2.0
func (s *StrategyService) GetActiveStrategy() *models.Strategy
GetActiveStrategy 获取当前激活的策略
func (*StrategyService) GetAgentByID ¶ added in v0.2.0
func (s *StrategyService) GetAgentByID(id string) *models.AgentConfig
GetAgentByID 根据ID获取Agent
func (*StrategyService) GetAgentsByIDs ¶ added in v0.2.0
func (s *StrategyService) GetAgentsByIDs(ids []string) []models.AgentConfig
GetAgentsByIDs 根据ID列表获取Agent
func (*StrategyService) GetAllAgents ¶ added in v0.2.0
func (s *StrategyService) GetAllAgents() []models.AgentConfig
GetAllAgents 获取所有Agent配置
func (*StrategyService) GetAllStrategies ¶ added in v0.2.0
func (s *StrategyService) GetAllStrategies() []models.Strategy
GetAllStrategies 获取所有策略
func (*StrategyService) GetEnabledAgents ¶ added in v0.2.0
func (s *StrategyService) GetEnabledAgents() []models.AgentConfig
GetEnabledAgents 获取已启用的Agent
func (*StrategyService) SetActiveStrategy ¶ added in v0.2.0
func (s *StrategyService) SetActiveStrategy(id string) error
SetActiveStrategy 设置当前激活策略
func (*StrategyService) SetLLM ¶ added in v0.2.0
func (s *StrategyService) SetLLM(llm model.LLM)
SetLLM 设置LLM用于AI生成策略
func (*StrategyService) UpdateAgentInActiveStrategy ¶ added in v0.2.0
func (s *StrategyService) UpdateAgentInActiveStrategy(agent models.StrategyAgent) error
UpdateAgentInActiveStrategy 更新当前激活策略中的专家
func (*StrategyService) UpdateStrategy ¶ added in v0.2.0
func (s *StrategyService) UpdateStrategy(strategy models.Strategy) error
UpdateStrategy 更新策略
type Telegraph ¶
type Telegraph struct {
Time string `json:"time"`
Content string `json:"content"`
URL string `json:"url"`
}
Telegraph 快讯数据结构
type ToolInfoForGen ¶ added in v0.2.0
ToolInfoForGen 工具信息(用于生成)
type TradingPeriod ¶ added in v0.3.0
type TradingPeriod struct {
Status string `json:"status"` // 状态标识
Text string `json:"text"` // 中文描述
StartTime string `json:"startTime"` // 开始时间 HH:MM
EndTime string `json:"endTime"` // 结束时间 HH:MM
}
TradingPeriod 交易时段
type TradingSchedule ¶ added in v0.3.0
type TradingSchedule struct {
IsTradeDay bool `json:"isTradeDay"` // 今天是否交易日
HolidayName string `json:"holidayName"` // 节假日名称
Periods []TradingPeriod `json:"periods"` // 时段列表
}
TradingSchedule 交易时间表
type UpdateInfo ¶
type UpdateInfo struct {
HasUpdate bool `json:"hasUpdate"`
LatestVersion string `json:"latestVersion"`
CurrentVersion string `json:"currentVersion"`
ReleaseURL string `json:"releaseUrl"`
ReleaseNotes string `json:"releaseNotes"`
Error string `json:"error,omitempty"`
}
UpdateInfo 更新信息
type UpdateProgress ¶
type UpdateProgress struct {
Status string `json:"status"` // "checking", "downloading", "installing", "completed", "error"
Message string `json:"message"` // 状态消息
Percent int `json:"percent"` // 进度百分比 (0-100)
}
UpdateProgress 更新进度信息
type UpdateService ¶
type UpdateService struct {
// contains filtered or unexported fields
}
UpdateService 更新检测服务 负责从 GitHub Releases 检测和下载更新
func NewUpdateService ¶
func NewUpdateService(repoOwner, repoName, currentVersion string) *UpdateService
NewUpdateService 创建更新服务实例
func (*UpdateService) CheckForUpdate ¶
func (u *UpdateService) CheckForUpdate() UpdateInfo
CheckForUpdate 检查是否有可用更新
func (*UpdateService) CleanupOldFiles ¶
func (u *UpdateService) CleanupOldFiles() error
CleanupOldFiles 清理旧文件
func (*UpdateService) GetCurrentVersion ¶
func (u *UpdateService) GetCurrentVersion() string
GetCurrentVersion 获取当前版本
func (*UpdateService) RestartApplication ¶
func (u *UpdateService) RestartApplication() error
RestartApplication 重启应用程序
func (*UpdateService) Startup ¶
func (u *UpdateService) Startup(ctx context.Context)
Startup 在应用启动时调用