mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-14 08:16:56 +08:00
feat(hook): Add hook module to help decouple some specific logic (#784)
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"log"
|
||||
"nofx/hook"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -61,8 +62,14 @@ type FuturesTrader struct {
|
||||
}
|
||||
|
||||
// NewFuturesTrader 创建合约交易器
|
||||
func NewFuturesTrader(apiKey, secretKey string) *FuturesTrader {
|
||||
func NewFuturesTrader(apiKey, secretKey string, userId string) *FuturesTrader {
|
||||
client := futures.NewClient(apiKey, secretKey)
|
||||
|
||||
hookRes := hook.HookExec[hook.NewBinanceTraderResult](hook.NEW_BINANCE_TRADER, userId, client)
|
||||
if hookRes != nil && hookRes.GetResult() != nil {
|
||||
client = hookRes.GetResult()
|
||||
}
|
||||
|
||||
// 同步时间,避免 Timestamp ahead 错误
|
||||
syncBinanceServerTime(client)
|
||||
trader := &FuturesTrader{
|
||||
|
||||
Reference in New Issue
Block a user