# BBGO notes ## BBGO Go 語言編寫的開源加密貨幣交易機器人框架 ## 功能 - 對交易所進行交易 - 內建/自定義交易策略 - 技術指標 ## 使用流程 (通常) ```mermaid graph TD; A(撰寫交易策略) --> B(設置API金鑰); B --> C(啟動交易機器人); C --> D{監控交易}; D -->|調整策略|A; D -->|結束| E[結束]; ``` ## 資料格式 (各階段可能用到的) ```cpp= /* 交易所 API 金鑰 */ struct ExchangeAPIKeys { string apiKey; string secretKey; // other }; /* trading pair */ struct TradingPair { string Base; string Quote; }; // ex: BTC/UCDT /* 交易策略 */ struct TradingStrategy { string entryCriteria; // 進入條件 string exitCriteria; // 退出條件 float riskPercentage; // 風險比例 float positionSize; // 交易量 // 交易進行的時間模式 string timeframe; // 時間框架 // 無視特定交易訊號, ex: 價格波動, 成交量 ... string signalFilter; // 訊號過濾器 // 持有交易的時間長度 string holdingPeriod; // 持倉期 string takeProfitStrategy; // 止盈條件 string stopLossStrategy; // 停損條件 string dynamicAdjustment; // 動態調整策略 // 監控交易 string informationOutput; // 資訊輸出和日誌 string tradingType; // 交易類型 string simulationParams; // 模擬和回測參數 // other }; // 風險管理 struct RiskManagement { float maxRiskPerTrade; // 每筆交易的最大風險 float maxDrawdown; // 最大回撤限制 float maxPortfolioRisk; // 最大投資組合風險 float maxDailyLoss; // 每日最大損失 int maxConsecutiveLosses; // 最大連續虧損次數限制 // other }; /* 監控交易 */ struct LoggingMonitoringSettings { bool enableLogging; // 啟用日誌記錄 bool enableMonitoring; // 啟用監控 string logFilePath; // 日誌文件路徑 int logLevel; // 日誌級別(例如:1 = INFO, 2 = WARNING, 3 = ERROR) // other }; /* 技術指標 */ // MA struct MovingAverageIndicator { int period; // 移動平均的期間 std::string type; // 移動平均的類型(簡單移動平均、指數移動平均等) // other }; // RS struct RSIndicator { int period; // RS 指標的期間 std::string type; // RS 指標的類型(14 天、9 天) // other }; // other /* 啟動機器人資料格式 */ struct BBGOStartInfo { ExchangeAPIKeys apiKeys; TradingPair pair; TradingStrategy strategy; RiskManagement risk; LoggingMonitoringSettings logs; MovingAverageIndicator ma; RSIndicator rs; // other }; ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up