mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-07 04:50:57 +08:00
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
48 lines
1.4 KiB
Go
48 lines
1.4 KiB
Go
// 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"`
|
|
}
|