mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-15 00:36:56 +08:00
refactor: standardize code comments
This commit is contained in:
@@ -1,57 +1,57 @@
|
||||
package trader
|
||||
|
||||
// Trader 交易器统一接口
|
||||
// 支持多个交易平台(币安、Hyperliquid等)
|
||||
// Trader Unified trader interface
|
||||
// Supports multiple trading platforms (Binance, Hyperliquid, etc.)
|
||||
type Trader interface {
|
||||
// GetBalance 获取账户余额
|
||||
// GetBalance Get account balance
|
||||
GetBalance() (map[string]interface{}, error)
|
||||
|
||||
// GetPositions 获取所有持仓
|
||||
// GetPositions Get all positions
|
||||
GetPositions() ([]map[string]interface{}, error)
|
||||
|
||||
// OpenLong 开多仓
|
||||
// OpenLong Open long position
|
||||
OpenLong(symbol string, quantity float64, leverage int) (map[string]interface{}, error)
|
||||
|
||||
// OpenShort 开空仓
|
||||
// OpenShort Open short position
|
||||
OpenShort(symbol string, quantity float64, leverage int) (map[string]interface{}, error)
|
||||
|
||||
// CloseLong 平多仓(quantity=0表示全部平仓)
|
||||
// CloseLong Close long position (quantity=0 means close all)
|
||||
CloseLong(symbol string, quantity float64) (map[string]interface{}, error)
|
||||
|
||||
// CloseShort 平空仓(quantity=0表示全部平仓)
|
||||
// CloseShort Close short position (quantity=0 means close all)
|
||||
CloseShort(symbol string, quantity float64) (map[string]interface{}, error)
|
||||
|
||||
// SetLeverage 设置杠杆
|
||||
// SetLeverage Set leverage
|
||||
SetLeverage(symbol string, leverage int) error
|
||||
|
||||
// SetMarginMode 设置仓位模式 (true=全仓, false=逐仓)
|
||||
// SetMarginMode Set position mode (true=cross margin, false=isolated margin)
|
||||
SetMarginMode(symbol string, isCrossMargin bool) error
|
||||
|
||||
// GetMarketPrice 获取市场价格
|
||||
// GetMarketPrice Get market price
|
||||
GetMarketPrice(symbol string) (float64, error)
|
||||
|
||||
// SetStopLoss 设置止损单
|
||||
// SetStopLoss Set stop-loss order
|
||||
SetStopLoss(symbol string, positionSide string, quantity, stopPrice float64) error
|
||||
|
||||
// SetTakeProfit 设置止盈单
|
||||
// SetTakeProfit Set take-profit order
|
||||
SetTakeProfit(symbol string, positionSide string, quantity, takeProfitPrice float64) error
|
||||
|
||||
// CancelStopLossOrders 仅取消止损单(修复 BUG:调整止损时不删除止盈)
|
||||
// CancelStopLossOrders Cancel only stop-loss orders (BUG fix: don't delete take-profit when adjusting stop-loss)
|
||||
CancelStopLossOrders(symbol string) error
|
||||
|
||||
// CancelTakeProfitOrders 仅取消止盈单(修复 BUG:调整止盈时不删除止损)
|
||||
// CancelTakeProfitOrders Cancel only take-profit orders (BUG fix: don't delete stop-loss when adjusting take-profit)
|
||||
CancelTakeProfitOrders(symbol string) error
|
||||
|
||||
// CancelAllOrders 取消该币种的所有挂单
|
||||
// CancelAllOrders Cancel all pending orders for this symbol
|
||||
CancelAllOrders(symbol string) error
|
||||
|
||||
// CancelStopOrders 取消该币种的止盈/止损单(用于调整止盈止损位置)
|
||||
// CancelStopOrders Cancel stop-loss/take-profit orders for this symbol (for adjusting stop-loss/take-profit positions)
|
||||
CancelStopOrders(symbol string) error
|
||||
|
||||
// FormatQuantity 格式化数量到正确的精度
|
||||
// FormatQuantity Format quantity to correct precision
|
||||
FormatQuantity(symbol string, quantity float64) (string, error)
|
||||
|
||||
// GetOrderStatus 获取订单状态
|
||||
// 返回: status(FILLED/NEW/CANCELED), avgPrice, executedQty, commission
|
||||
// GetOrderStatus Get order status
|
||||
// Returns: status(FILLED/NEW/CANCELED), avgPrice, executedQty, commission
|
||||
GetOrderStatus(symbol string, orderID string) (map[string]interface{}, error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user