@@ -25,12 +25,13 @@ type SLog struct {
25
25
}
26
26
27
27
type SExchange struct {
28
- Name string `toml:"name"`
29
- DebugMode bool `toml:"debug_mode"`
30
- AccessKey string `toml:"access_key"`
31
- SecretKey string `toml:"secret_key"`
32
- Testnet bool `toml:"testnet"`
33
- WebSocket bool `toml:"websocket"`
28
+ Name string `toml:"name"`
29
+ DebugMode bool `toml:"debug_mode"`
30
+ AccessKey string `toml:"access_key"`
31
+ SecretKey string `toml:"secret_key"`
32
+ Passphrase string `toml:"passphrase"`
33
+ Testnet bool `toml:"testnet"`
34
+ WebSocket bool `toml:"websocket"`
34
35
}
35
36
36
37
// Serve 加载策略并执行
@@ -75,12 +76,18 @@ func SetupStrategyFromConfig(strategy Strategy) (err error) {
75
76
}
76
77
var exs []interface {}
77
78
for _ , ex := range c .Exchanges {
78
- exchange := exchanges . NewExchange ( ex . Name ,
79
+ var opts = [] ApiOption {
79
80
ApiDebugModeOption (ex .DebugMode ),
80
81
ApiAccessKeyOption (ex .AccessKey ),
81
82
ApiSecretKeyOption (ex .SecretKey ),
82
83
ApiTestnetOption (ex .Testnet ),
83
- ApiWebSocketOption (ex .WebSocket ))
84
+ ApiWebSocketOption (ex .WebSocket ),
85
+ }
86
+ if ex .Passphrase != "" {
87
+ opts = append (opts , ApiPassPhraseOption (ex .Passphrase ))
88
+ }
89
+ exchange := exchanges .NewExchange (ex .Name ,
90
+ opts ... )
84
91
exs = append (exs , exchange )
85
92
}
86
93
if err = strategy .Setup (TradeModeLiveTrading , exs ... ); err != nil {
0 commit comments