mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-16 01:06:59 +08:00
feat: init nofxi - AI Trading Agent module
NOFXi — Your AI Trading Agent, built on NOFX. Architecture: - Agent Core: intent routing, conversation memory, trade confirmation - Memory: SQLite (trades, conversations, preferences, strategies) - Thinking: LLM client (OpenAI/claw402/DeepSeek compatible) - Execution: Bridge to NOFX trader engine (9 exchanges) - Perception: Market monitor, price alerts, anomaly detection - Interaction: Telegram bot + REST API + OpenAI-compatible endpoint Features: - Natural language trading (中英文) - /buy /sell /analyze /watch /alert /positions /balance - Daily P/L reports, portfolio risk checks - Trade confirmation flow (safety first) - Price polling and alert notifications
This commit is contained in:
28
nofxi/internal/thinking/engine.go
Normal file
28
nofxi/internal/thinking/engine.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package thinking
|
||||
|
||||
import "context"
|
||||
|
||||
// Engine is the AI decision-making interface.
|
||||
type Engine interface {
|
||||
// Chat sends a message to the LLM with conversation context and returns a response.
|
||||
Chat(ctx context.Context, messages []Message) (string, error)
|
||||
|
||||
// Analyze asks the AI to analyze market data and provide a trading recommendation.
|
||||
Analyze(ctx context.Context, prompt string) (*Analysis, error)
|
||||
}
|
||||
|
||||
// Message represents a chat message.
|
||||
type Message struct {
|
||||
Role string `json:"role"` // "system", "user", "assistant"
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
// Analysis holds an AI trading recommendation.
|
||||
type Analysis struct {
|
||||
Action string `json:"action"` // "buy", "sell", "hold", "wait"
|
||||
Symbol string `json:"symbol"`
|
||||
Confidence float64 `json:"confidence"` // 0.0 - 1.0
|
||||
Reasoning string `json:"reasoning"`
|
||||
StopLoss float64 `json:"stop_loss,omitempty"`
|
||||
TakeProfit float64 `json:"take_profit,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user