mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-15 00:36:56 +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:
47
nofxi/internal/execution/execution.go
Normal file
47
nofxi/internal/execution/execution.go
Normal file
@@ -0,0 +1,47 @@
|
||||
// Package execution implements the Execution Layer.
|
||||
//
|
||||
// Phase 2 — stubs for now.
|
||||
//
|
||||
// Planned capabilities:
|
||||
// - Multi-exchange order execution (via NOFX engine)
|
||||
// - Position management (open/close/adjust)
|
||||
// - Stop-loss and take-profit management
|
||||
// - x402 payment integration via Claw402
|
||||
// - Safe mode and risk controls
|
||||
package execution
|
||||
|
||||
// Executor is the trade execution interface.
|
||||
type Executor interface {
|
||||
// PlaceOrder places a trade order on the exchange.
|
||||
PlaceOrder(exchange, symbol, side string, price, quantity float64) (string, error)
|
||||
|
||||
// ClosePosition closes an existing position.
|
||||
ClosePosition(exchange, symbol string) error
|
||||
|
||||
// GetPositions returns current open positions.
|
||||
GetPositions(exchange string) ([]Position, error)
|
||||
|
||||
// GetBalance returns account balance.
|
||||
GetBalance(exchange string) (*Balance, error)
|
||||
}
|
||||
|
||||
// Position represents an open position.
|
||||
type Position struct {
|
||||
Exchange string `json:"exchange"`
|
||||
Symbol string `json:"symbol"`
|
||||
Side string `json:"side"`
|
||||
Size float64 `json:"size"`
|
||||
EntryPrice float64 `json:"entry_price"`
|
||||
MarkPrice float64 `json:"mark_price"`
|
||||
PnL float64 `json:"pnl"`
|
||||
Leverage float64 `json:"leverage"`
|
||||
}
|
||||
|
||||
// Balance represents account balance.
|
||||
type Balance struct {
|
||||
Exchange string `json:"exchange"`
|
||||
Total float64 `json:"total"`
|
||||
Available float64 `json:"available"`
|
||||
InPosition float64 `json:"in_position"`
|
||||
Currency string `json:"currency"`
|
||||
}
|
||||
Reference in New Issue
Block a user