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:
nobody
2025-10-30 00:27:33 +08:00
parent 51cc922728
commit 87f67f2da1
7 changed files with 1224 additions and 7 deletions

114
README.md
View File

@@ -9,7 +9,7 @@
---
An automated crypto futures trading system powered by **DeepSeek/Qwen AI**, supporting **Binance and Hyperliquid exchanges**, **multi-AI model live trading competition**, featuring comprehensive market analysis, AI decision-making, **self-learning mechanism**, and professional Web monitoring interface.
An automated crypto futures trading system powered by **DeepSeek/Qwen AI**, supporting **Binance, Hyperliquid, and Aster DEX exchanges**, **multi-AI model live trading competition**, featuring comprehensive market analysis, AI decision-making, **self-learning mechanism**, and professional Web monitoring interface.
> ⚠️ **Risk Warning**: This system is experimental. AI auto-trading carries significant risks. Strongly recommended for learning/research purposes or testing with small amounts only!
@@ -23,9 +23,13 @@ Join our Telegram developer community to discuss, share ideas, and get support:
## 🆕 What's New (Latest Update)
### 🚀 Hyperliquid Exchange Support Added!
### 🚀 Multi-Exchange Support!
NOFX now supports **Hyperliquid** - a high-performance decentralized perpetual futures exchange!
NOFX now supports **three major exchanges**: Binance, Hyperliquid, and Aster DEX!
#### **Hyperliquid Exchange**
A high-performance decentralized perpetual futures exchange!
**Key Features:**
- ✅ Full trading support (long/short, leverage, stop-loss/take-profit)
@@ -48,6 +52,30 @@ NOFX now supports **Hyperliquid** - a high-performance decentralized perpetual f
See [Configuration Guide](#-alternative-using-hyperliquid-exchange) for details.
#### **Aster DEX Exchange** (NEW! v2.0.2)
A Binance-compatible decentralized perpetual futures exchange!
**Key Features:**
- ✅ Binance-style API (easy migration from Binance)
- ✅ Web3 wallet authentication (secure and decentralized)
- ✅ Full trading support with automatic precision handling
- ✅ Lower trading fees than CEX
- ✅ EVM-compatible (Ethereum, BSC, Polygon, etc.)
**Why Aster?**
- 🎯 **Binance-compatible API** - minimal code changes required
- 🔐 **API Wallet System** - separate trading wallet for security
- 💰 **Competitive fees** - lower than most centralized exchanges
- 🌐 **Multi-chain support** - trade on your preferred EVM chain
**Quick Start:**
1. Visit [Aster API Wallet](https://www.asterdex.com/en/api-wallet)
2. Connect your main wallet and create an API wallet
3. Copy the API Signer address and Private Key
4. Set `"exchange": "aster"` in config.json
5. Add `"aster_user"`, `"aster_signer"`, and `"aster_private_key"`
---
## ✨ Core Features
@@ -442,6 +470,71 @@ cp config.json.example config.json
---
#### 🔶 Alternative: Using Aster DEX Exchange
**NOFX also supports Aster DEX** - a Binance-compatible decentralized perpetual futures exchange!
**Why Choose Aster?**
- 🎯 Binance-compatible API (easy migration)
- 🔐 API Wallet security system
- 💰 Lower trading fees
- 🌐 Multi-chain support (ETH, BSC, Polygon)
- 🌍 No KYC required
**Step 1**: Create Aster API Wallet
1. Visit [Aster API Wallet](https://www.asterdex.com/en/api-wallet)
2. Connect your main wallet (MetaMask, WalletConnect, etc.)
3. Click "Create API Wallet"
4. **Save these 3 items immediately:**
- Main Wallet address (User)
- API Wallet address (Signer)
- API Wallet Private Key (⚠ shown only once!)
**Step 2**: Configure `config.json` for Aster
```json
{
"traders": [
{
"id": "aster_deepseek",
"name": "Aster DeepSeek Trader",
"ai_model": "deepseek",
"exchange": "aster",
"aster_user": "0x63DD5aCC6b1aa0f563956C0e534DD30B6dcF7C4e",
"aster_signer": "0x21cF8Ae13Bb72632562c6Fff438652Ba1a151bb0",
"aster_private_key": "4fd0a42218f3eae43a6ce26d22544e986139a01e5b34a62db53757ffca81bae1",
"deepseek_key": "sk-xxxxxxxxxxxxx",
"initial_balance": 1000.0,
"scan_interval_minutes": 3
}
],
"use_default_coins": true,
"api_server_port": 8080,
"leverage": {
"btc_eth_leverage": 5,
"altcoin_leverage": 5
}
}
```
**Key Configuration Fields:**
- `"exchange": "aster"` - Set exchange to Aster
- `aster_user` - Your main wallet address
- `aster_signer` - API wallet address (from Step 1)
- `aster_private_key` - API wallet private key (without `0x` prefix)
**📖 For detailed setup instructions, see**: [Aster Integration Guide](ASTER_INTEGRATION.md)
** Security Notes**:
- API wallet is separate from your main wallet (extra security layer)
- Never share your API private key
- You can revoke API wallet access anytime at [asterdex.com](https://www.asterdex.com/en/api-wallet)
---
#### ⚔️ Expert Mode: Multi-Trader Competition
For running multiple AI traders competing against each other:
@@ -1092,6 +1185,19 @@ This version fixes **critical calculation errors** in the historical trade recor
**Recommendation**: If you were running the system before this update, your historical statistics were inaccurate. After updating to v2.0.2, new trades will be calculated correctly.
### v2.0.2 (2025-10-29)
**Bug Fixes:**
- ✅ Fixed Aster exchange precision error (code -1111: "Precision is over the maximum defined for this asset")
- ✅ Improved price and quantity formatting to match exchange precision requirements
- ✅ Added detailed precision processing logs for debugging
- ✅ Enhanced all order functions (OpenLong, OpenShort, CloseLong, CloseShort, SetStopLoss, SetTakeProfit) with proper precision handling
**Technical Details:**
- Added `formatFloatWithPrecision` function to convert float64 to strings with correct precision
- Price and quantity parameters are now formatted according to exchange's `pricePrecision` and `quantityPrecision` specifications
- Trailing zeros are removed from formatted values to optimize API requests
### v2.0.1 (2025-10-29)
**Bug Fixes:**
@@ -1159,7 +1265,7 @@ Issues and Pull Requests are welcome!
---
**Last Updated**: 2025-10-29 (v2.0.2)
**Last Updated**: 2025-10-29 (v2.0.3)
**⚡ Explore the possibilities of quantitative trading with the power of AI!**