mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-17 09:24:36 +08:00
refactor: align variable naming and add Binance time sync
1. Rename `traderRecord` to `trader` in handleCreateTrader - Aligns with upstream naming convention (nofxaios/dev) - Line 403: variable definition - Line 424: CreateTrader call 2. Add Binance server time synchronization (PR #145 simple fix) - Fixes timestamp errors (code=-1021) - Sets UseTestnet=false (ensure production network) - Syncs server time on trader initialization - Based on commit 64299c1 from pr-145 branch Both changes improve compatibility with upstream and prevent timestamp-related API failures.
This commit is contained in:
@@ -32,6 +32,11 @@ type FuturesTrader struct {
|
||||
// NewFuturesTrader 创建合约交易器
|
||||
func NewFuturesTrader(apiKey, secretKey string) *FuturesTrader {
|
||||
client := futures.NewClient(apiKey, secretKey)
|
||||
|
||||
// 🔧 修复时间戳问题:启用时间同步
|
||||
futures.UseTestnet = false // 确保使用正式网络
|
||||
client.NewSetServerTimeService().Do(context.Background()) // 同步服务器时间
|
||||
|
||||
return &FuturesTrader{
|
||||
client: client,
|
||||
cacheDuration: 15 * time.Second, // 15秒缓存
|
||||
|
||||
Reference in New Issue
Block a user