-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
📝 Description | 描述
Add Binance Futures Testnet support to enable safe strategy testing without real funds.
添加币安合约测试网支持,允许在无需真实资金的情况下安全测试策略。
🎯 Type of Change
- ✨ New feature
🔗 Related Issues
- Related to PR feat(okx/hyperliquid): add Testnet/Simulated trading support #1317 (OKX/Hyperliquid testnet support)
📋 Problem Statement
Currently, NOFX supports testnet for OKX/Hyperliquid (PR #1317), but Binance Futures testnet is NOT supported.
When testnet=1 is set in database, trader/binance_futures.go still uses futures.NewClient() which defaults to mainnet (fapi.binance.com).
Result: Testnet API key fails with -2015: Invalid API-key because requests go to mainnet instead of testnet.binancefuture.com.
目前NOFX支持OKX/Hyperliquid测试网(PR #1317),但不支持币安合约测试网。
当数据库设置testnet=1时,trader/binance_futures.go仍使用默认正式网(fapi.binance.com)。
结果:测试网API Key返回-2015: Invalid API-key错误,因为请求发送到正式网而非testnet.binancefuture.com。
🎯 Proposed Solution
Following PR #1317 pattern:
- Add
Testnetproperty support inBinanceFuturesTrader - When
testnet=true, usetestnet.binancefuture.comas base URL - Update UI to show "Use Testnet" toggle for Binance Futures
参考PR #1317模式:
- 在
BinanceFuturesTrader添加Testnet属性支持 - 当
testnet=true时,使用testnet.binancefuture.com - UI添加"使用测试网"开关
📚 Technical Details
Current Code:
func NewFuturesTrader(apiKey, secretKey string, userId string) *FuturesTrader {
client := futures.NewClient(apiKey, secretKey) // Always mainnet
Suggested:
func NewFuturesTrader(apiKey, secretKey string, testnet bool, userId string) *FuturesTrader {
if testnet {
// Use testnet.binancefuture.com
}
🔗 Binance Testnet Info
- Base URL: https://testnet.binancefuture.com
- Docs: https://testnet.binancefuture.com/en/futures/BTC_USDT
- Faucet: Available on testnet for getting test funds
✅ LabelsMetadata
Metadata
Assignees
Labels
No labels