nofx icon indicating copy to clipboard operation
nofx copied to clipboard

建议先把币安的测试网修复吧,现在dev的bug有点多,直接实盘不稳。我们可以先用测试网测试。但是现在测试网用不起来

Open heyu3913 opened this issue 1 year ago • 4 comments

heyu3913 avatar Nov 06 '25 02:11 heyu3913

不是用不起来。是没有加。

yibitnet avatar Nov 06 '25 06:11 yibitnet

不是用不起来。是没有加。 ui上有测试网这个选项

heyu3913 avatar Nov 06 '25 06:11 heyu3913

不是用不起来。是没有加。 ui上有测试网这个选项

他代码实际上没有。你可以加一下 nofx/trader/binance_futures.go futures.UseTestnet = true

相关代码: // NewFuturesTrader 创建合约交易器 func NewFuturesTrader(apiKey, secretKey string) *FuturesTrader { futures.UseTestnet = true //加这个是测试网 client := futures.NewClient(apiKey, secretKey) // 同步时间,避免 Timestamp ahead 错误 syncBinanceServerTime(client) trader := &FuturesTrader{ client: client, cacheDuration: 15 * time.Second, // 15秒缓存 }

// 设置双向持仓模式(Hedge Mode)
// 这是必需的,因为代码中使用了 PositionSide (LONG/SHORT)
if err := trader.setDualSidePosition(); err != nil {
	log.Printf("⚠️ 设置双向持仓模式失败: %v (如果已是双向模式则忽略此警告)", err)
}

return trader

}

yibitnet avatar Nov 06 '25 06:11 yibitnet

步时间,避免 Timestamp a

收到 我研究一下。佬最好提个pr上去

heyu3913 avatar Nov 06 '25 06:11 heyu3913