Commit Graph

38 Commits

Author SHA1 Message Date
tinkle-community
ff4cd0e3ca Merge pull request #389 from NoFxAiOS/beta
Fix:fix the main branch history issue from November 3rd.
2025-11-04 11:22:10 +08:00
Liu Xiang Qian
72a373e9e4 Revert "Merge pull request #229 from xqliu/test/add-ut-infrastructure"
This reverts commit 683e77b92f, reversing
changes made to 791cecd2ff.
2025-11-04 00:58:12 +08:00
ZhouYongyou
9e21793737 fix: GetTraderConfig missing critical fields in SELECT/Scan
**Problem**:
- GetTraderConfig was missing 9 critical fields in SELECT statement
- Missing corresponding Scan variables
- Caused trader edit UI to show 0 for leverage and empty trading_symbols

**Root Cause**:
Database query only selected basic fields (id, name, balance, etc.)
but missed leverage, trading_symbols, prompts, and all custom configs

**Fix**:
- Added missing fields to SELECT:
  * btc_eth_leverage, altcoin_leverage
  * trading_symbols
  * use_coin_pool, use_oi_top
  * custom_prompt, override_base_prompt
  * system_prompt_template
  * is_cross_margin
  * AI model custom_api_url, custom_model_name

- Added corresponding Scan variables to match SELECT order

**Impact**:
 Trader edit modal now displays correct leverage values
 Trading symbols list properly populated
 All custom configurations preserved and displayed
 API endpoint /traders/:id/config returns complete data

**Testing**:
-  Go compilation successful
-  All fields aligned (31 SELECT = 31 Scan)
-  API layer verified (api/server.go:887-904)

Reported by: 寒江孤影
Issue: Trader config edit modal showing 0 leverage and empty symbols

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 00:00:05 +08:00
icy
dfaaf66ea7 Merge branch 'dev' into beta 2025-11-03 23:46:59 +08:00
SkywalkerJi
683e77b92f Merge pull request #229 from xqliu/test/add-ut-infrastructure
test: Add minimal UT infrastructure and fix Issue #227
2025-11-04 00:28:34 +09:00
icy
eae928ddf7 Merge branch 'dev' into beta
# Conflicts:
#	config/database.go
#	main.go
2025-11-02 22:11:07 +08:00
yuanshi2016
95c32fcb2e 修改Kline获取方式为Websocket缓存。 2025-11-02 17:59:19 +08:00
yuanshi2016
3b1db6f64f K线获取方式改为websocket组合流. 带重拨机制
流程为下:
1. 启动时使用所有交易员设置的币种(去重) 如果交易员未配置,则使用系统默认
2. 在决策获取K线时 如果没有缓存 则先实时获取后再添加订阅. ps: 适用于Api方式的币种列表
2025-11-02 14:03:13 +08:00
Liu Xiang Qian
9ab7a36fbb test: Add minimal UT infrastructure and fix Issue #227
This commit sets up a minimal, KISS-principle testing infrastructure
for both backend and frontend, and includes the fix for Issue #227.

Backend Changes:
- Add Makefile with test commands (test, test-backend, test-frontend, test-coverage)
- Add example test: config/database_test.go
- Fix Go 1.25 printf format string warnings in trader/auto_trader.go
  (Changed log.Printf to log.Print for non-format strings)
- All backend tests pass ✓

Frontend Changes:
- Add Vitest configuration: web/vitest.config.ts (minimal setup)
- Add test utilities: web/src/test/test-utils.tsx
- Add example test: web/src/App.test.tsx
- Add dependencies: vitest, jsdom, @testing-library/react
- All frontend tests pass ✓

Issue #227 Fix:
- Fix AITradersPage to allow editing traders with disabled models/exchanges
- Change validation to use allModels/allExchanges instead of enabledModels/enabledExchanges
- Add comprehensive tests in web/src/components/AITradersPage.test.tsx
- Fixes: https://github.com/tinkle-community/nofx/issues/227

CI/CD:
- Add GitHub Actions workflow: .github/workflows/test.yml
- Non-blocking tests (continue-on-error: true)
- Runs on push/PR to main and dev branches

Test Results:
- Backend: 1 test passing
- Frontend: 5 tests passing (including 4 for Issue #227)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 10:58:31 +08:00
icy
5c8a20e8d4 Add beta mode 2025-11-02 02:31:19 +08:00
原始
c39eb4a0e2 Merge branch 'tinkle-community:dev' into dev 2025-11-01 22:07:25 +08:00
原始
128182ce7c Merge branch 'tinkle-community:dev' into dev 2025-11-01 20:24:59 +08:00
icy
2538d2f928 Merge branch 'dev' of https://github.com/tinkle-community/nofx 2025-11-01 20:09:17 +08:00
SkywalkerJi
4250c11ddf Supports custom system prompts and custom models. 2025-11-01 19:45:54 +08:00
icy
996b152eba Resolve merge conflicts in AITradersPage.tsx
- Fixed import statement conflict (using 'type Language')
- Merged exchange configuration logic preserving support for multiple exchange types
- Kept comprehensive form handling for Binance, Hyperliquid, Aster, and OKX exchanges
- Updated security warning messages to use proper translation keys

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 19:01:44 +08:00
icy
f413f87f39 Fixed health check; Fixed dex config; Add rank trader info view; 2025-11-01 18:58:32 +08:00
原始
b70df0ffe2 Merge branch 'tinkle-community:dev' into dev 2025-11-01 18:46:27 +08:00
SkywalkerJi
48d1320209 * Fixed the custom model URL.
*   Added functionality for custom model names.
2025-11-01 16:09:15 +08:00
yuanshi2016
2c08e1f10b 新增内置AI评分
修改market/data.go Get函数获取K线为流式获取(可以解决传入币种比较多的情况下耗时问题)
market目录下新增文件
main.go 新增运行入口
通过inside_coins=true控制
该评分默认初始化大约需要2分钟左右(因为币种列表比较多,api有限速)
使用时应该注意engine.go下的流动性过滤问题
2025-11-01 15:58:54 +08:00
icy
a7cc5e5ed4 竞赛fix、交易员新增参数 2025-11-01 02:17:11 +08:00
icy
8296d9843a Sync config.json to config.db for manual modify admin_mode and other configs 2025-10-31 15:24:18 +08:00
icy
517d0caf6f admin_mode config 2025-10-31 14:34:53 +08:00
icy
d0621265aa Add MarginMode configration 2025-10-31 13:14:24 +08:00
icy
a85d38cb59 rename fix 2025-10-31 04:07:14 +08:00
icy
3f686dec2e Merge branch 'main' of github.com:Icyoung/nofx
# Conflicts:
#	config.json.example
#	config/config.go
#	main.go
#	trader/auto_trader.go
#	web/src/App.tsx
#	web/src/components/CompetitionPage.tsx
2025-10-31 03:59:58 +08:00
icy
ac7c40632d account system、custom prompt 2025-10-31 03:42:01 +08:00
tinkle
007fa2567d feat: Add trader enabled switch and fix critical bugs
New Features:
- Add 'enabled' field to trader config for selective startup
- Only enabled traders will be initialized and run
- Display skip messages for disabled traders in logs

Bug Fixes:
- Fix Hyperliquid account value calculation
  * AccountValue is total equity, no need to add TotalMarginUsed
  * Correctly calculate wallet balance without unrealized PnL
  * Fix available balance calculation (AccountValue - TotalMarginUsed)
- Fix frontend page refresh navigation issue
  * Use URL hash to persist page state across refreshes
  * Support browser back/forward buttons
  * Prevent Details page from reverting to Competition on refresh

Technical Changes:
- config/config.go: Add Enabled bool field to TraderConfig
- main.go: Skip disabled traders during initialization
- trader/hyperliquid_trader.go: Correct account value logic
- web/src/App.tsx: Implement hash-based routing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 21:07:43 +08:00
icy
4f5b8b250a sync fork 2025-10-30 20:51:22 +08:00
刘 志
d9f99a6fcd fix: hyperliquid余额不准确 2025-10-30 08:38:31 +00:00
SkywalkerJi
a6fceff4d3 Expose the default mainstream currency settings to the configuration file 2025-10-30 10:01:45 +08:00
nobody
8a6013016a 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]
2025-10-30 00:27:33 +08:00
btcman
2cdfb87144 Feature: Add support for custom OpenAI-compatible API
This update enables users to configure any OpenAI-compatible API endpoint,
allowing the use of:
- OpenAI official API (GPT-4, GPT-4o, etc.)
- OpenRouter (access to multiple models)
- Local deployed models (Ollama, LM Studio, etc.)
- Other OpenAI-format compatible API services

Changes:
- config: Add custom_api_url, custom_api_key, custom_model_name fields
- mcp: Add SetCustomAPI function and ProviderCustom constant
- trader: Update AI initialization logic to support custom API
- manager: Pass custom API config to trader instances
- Add CUSTOM_API.md documentation with usage examples
- Update config.json.example with custom API sample

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 22:48:28 +08:00
PorunC
6fb65b43c6 Merge upstream/main: Integrate Hyperliquid support with leverage config
Resolved conflicts in manager/trader_manager.go by combining:
- Upstream: Exchange field, Hyperliquid API keys, Hyperliquid testnet
- Local: BTCETHLeverage and AltcoinLeverage fields

Both features are now working together.
2025-10-29 21:01:05 +08:00
PorunC
b5a5760bc4 Feat: Add configurable leverage settings for BTC/ETH and altcoins (v2.0.3)
- Add LeverageConfig struct with btc_eth_leverage and altcoin_leverage fields
- Set default leverage to 5x (safe for Binance subaccounts)
- Add validation warnings for leverage >5x (subaccount restrictions)
- Update config.json.example with leverage configuration

Breaking changes:
- None (backward compatible with default 5x leverage)

Migration:
- Existing configs will auto-default to 5x leverage (safe)
- Main accounts can increase to 20x (altcoins) or 50x (BTC/ETH) in config.json
- Subaccounts must keep leverage ≤5x to avoid trade failures

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 20:29:51 +08:00
nobody
e1d5a6405c feat: Add Hyperliquid exchange support with unified trader interface
Major changes:
- Add full Hyperliquid trading support (long/short, leverage, SL/TP)
- Create unified Trader interface for multi-exchange support
- Implement automatic precision handling for orders and prices
- Fix balance calculation and unrealized P&L display
- Add comprehensive configuration guide in README

New features:
- Support for both Binance and Hyperliquid exchanges
- Automatic order size precision based on szDecimals
- Price formatting with 5 significant figures
- Non-custodial trading with Ethereum private key
- Seamless exchange switching via configuration

Technical details:
- Add trader/interface.go for unified trader interface
- Add trader/hyperliquid_trader.go for Hyperliquid implementation
- Update manager and auto_trader to support multiple exchanges
- Add go-hyperliquid SDK dependency
- Fix precision errors (float_to_wire, invalid price)

Fixes:
- Correct calculation of wallet balance and unrealized P&L
- Proper handling of AccountValue vs TotalRawUsd
- Frontend display issues for total equity and P&L

Documentation:
- Add Hyperliquid setup guide in README
- Update config.json.example with both exchanges
- Add troubleshooting section for common errors

Tested with live trading on Hyperliquid mainnet.
No breaking changes - backward compatible with existing configs.
2025-10-29 20:00:30 +08:00
tinkle
6d822173fb Docs: Enhance README files with beginner-friendly guides (4 languages)
**Configuration Improvements:**
- Add comprehensive "Get AI API Keys" section (DeepSeek + Qwen)
- Split configuration into Beginner Mode and Expert Mode
- Add step-by-step setup guides with placeholder tables
- Add configuration checklist and field explanations
- Document smart default behavior for use_default_coins (v2.0.2)

**Startup/Monitoring Guides:**
- Add detailed 2-step system startup instructions
- Include expected output and error troubleshooting tables
- Add monitoring and graceful shutdown procedures
- Provide health check commands

**AI Decision Flow Updates:**
- Enhance flow diagram with emojis and wider boxes
- Add v2.0.2 improvement markers throughout
- Document position duration tracking
- Document accurate USDT PnL calculation with leverage
- Document enhanced AI freedom for raw data analysis
- Document improved position tracking (symbol_side keys)
- Add "Key Improvements in v2.0.2" summary section

**Code Changes:**
- Simplify config.json.example to beginner-friendly single trader
- Implement smart default: use_default_coins auto-enables when omitted
- Set default to true if false without coin_pool_api_url

**Files Updated:**
- README.md (English): +559 lines
- README.zh-CN.md (Chinese): +527 lines
- README.ru.md (Russian): +634 lines
- README.uk.md (Ukrainian): +521 lines
- config.json.example: Simplified configuration
- config/config.go: Smart default logic

Total: 2068+ additions across all documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 17:16:27 +08:00
nobody
ccfa48688b feat: 添加use_default_coins开关,简化默认币种配置
- 新增use_default_coins配置项:true=使用默认8个主流币种,false=使用API币种池
- 更直观的配置方式,新手可直接设置true快速开始
- 优先级:use_default_coins > coin_pool_api_url > 缓存 > 默认列表
- 更新所有语言版本README(en/zh-CN/ru/uk)添加配置说明
- 更新config.json.example示例文件
2025-10-29 12:59:12 +08:00
tinkle
7e8a494ed3 Initial commit: NOFX AI Trading System
- Multi-AI competition mode (Qwen vs DeepSeek)
- Binance Futures integration
- AI self-learning mechanism
- Professional web dashboard
- Complete risk management system
2025-10-28 15:47:34 +08:00