mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-13 15:57:01 +08:00
feat: Add Aster DEX exchange support + fix precision issues
## Features - Add full Aster DEX integration with Binance-compatible API - Support Web3 authentication with API wallet system - Add comprehensive Aster integration guide (ASTER_INTEGRATION.md) - Add example Aster configuration (config.aster.example.json) ## Bug Fixes - Fix precision error (code -1111) for all order types - Implement proper float-to-string conversion with exchange precision - Add automatic precision fetching from /exchangeInfo endpoint - Remove trailing zeros from formatted values ## Documentation - Update README.md with Aster quick start guide - Add detailed setup instructions for creating API wallet - Include troubleshooting FAQ and security best practices - Update core features to mention three supported exchanges ## Technical Details - Added formatFloatWithPrecision() helper function - Updated all order functions to use proper precision formatting - Added precision logging for debugging - Fully backward compatible with existing configurations Closes #[issue number if applicable]
This commit is contained in:
@@ -24,6 +24,11 @@ type TraderConfig struct {
|
||||
HyperliquidPrivateKey string `json:"hyperliquid_private_key,omitempty"`
|
||||
HyperliquidTestnet bool `json:"hyperliquid_testnet,omitempty"`
|
||||
|
||||
// Aster配置
|
||||
AsterUser string `json:"aster_user,omitempty"` // Aster主钱包地址
|
||||
AsterSigner string `json:"aster_signer,omitempty"` // Aster API钱包地址
|
||||
AsterPrivateKey string `json:"aster_private_key,omitempty"` // Aster API钱包私钥
|
||||
|
||||
// AI配置
|
||||
QwenKey string `json:"qwen_key,omitempty"`
|
||||
DeepSeekKey string `json:"deepseek_key,omitempty"`
|
||||
@@ -108,8 +113,8 @@ func (c *Config) Validate() error {
|
||||
if trader.Exchange == "" {
|
||||
trader.Exchange = "binance" // 默认使用币安
|
||||
}
|
||||
if trader.Exchange != "binance" && trader.Exchange != "hyperliquid" {
|
||||
return fmt.Errorf("trader[%d]: exchange必须是 'binance' 或 'hyperliquid'", i)
|
||||
if trader.Exchange != "binance" && trader.Exchange != "hyperliquid" && trader.Exchange != "aster" {
|
||||
return fmt.Errorf("trader[%d]: exchange必须是 'binance', 'hyperliquid' 或 'aster'", i)
|
||||
}
|
||||
|
||||
// 根据平台验证对应的密钥
|
||||
@@ -121,6 +126,10 @@ func (c *Config) Validate() error {
|
||||
if trader.HyperliquidPrivateKey == "" {
|
||||
return fmt.Errorf("trader[%d]: 使用Hyperliquid时必须配置hyperliquid_private_key", i)
|
||||
}
|
||||
} else if trader.Exchange == "aster" {
|
||||
if trader.AsterUser == "" || trader.AsterSigner == "" || trader.AsterPrivateKey == "" {
|
||||
return fmt.Errorf("trader[%d]: 使用Aster时必须配置aster_user, aster_signer和aster_private_key", i)
|
||||
}
|
||||
}
|
||||
|
||||
if trader.AIModel == "qwen" && trader.QwenKey == "" {
|
||||
|
||||
Reference in New Issue
Block a user