Skip to content

merge - #1192

Merged
tinkle-community merged 20 commits into
mainfrom
dev
Dec 8, 2025
Merged

merge#1192
tinkle-community merged 20 commits into
mainfrom
dev

Conversation

@tinkle-community

@tinkle-community tinkle-community commented Dec 8, 2025

Copy link
Copy Markdown
Collaborator

Pull Request - Backend | 后端 PR

💡 提示 Tip: 推荐 PR 标题格式 type(scope): description
例如: feat(trader): add new strategy | fix(api): resolve auth issue


📝 Description | 描述

English:中文:


🎯 Type of Change | 变更类型

  • 🐛 Bug fix | 修复 Bug
  • ✨ New feature | 新功能
  • 💥 Breaking change | 破坏性变更
  • ♻️ Refactoring | 重构
  • ⚡ Performance improvement | 性能优化
  • 🔒 Security fix | 安全修复
  • 🔧 Build/config change | 构建/配置变更

🔗 Related Issues | 相关 Issue

  • Closes # | 关闭 #
  • Related to # | 相关 #

📋 Changes Made | 具体变更

English:中文:


🧪 Testing | 测试

Test Environment | 测试环境

  • OS | 操作系统:
  • Go Version | Go 版本:
  • Exchange | 交易所: [if applicable | 如适用]

Manual Testing | 手动测试

  • Tested locally | 本地测试通过
  • Tested on testnet | 测试网测试通过(交易所集成相关)
  • Unit tests pass | 单元测试通过
  • Verified no existing functionality broke | 确认没有破坏现有功能

Test Results | 测试结果

Test output here | 测试输出

🔒 Security Considerations | 安全考虑

  • No API keys or secrets hardcoded | 没有硬编码 API 密钥
  • User inputs properly validated | 用户输入已正确验证
  • No SQL injection vulnerabilities | 无 SQL 注入漏洞
  • Authentication/authorization properly handled | 认证/授权正确处理
  • Sensitive data is encrypted | 敏感数据已加密
  • N/A (not security-related) | 不适用

⚡ Performance Impact | 性能影响

  • No significant performance impact | 无显著性能影响
  • Performance improved | 性能提升
  • Performance may be impacted (explain below) | 性能可能受影响

If impacted, explain | 如果受影响,请说明:


✅ Checklist | 检查清单

Code Quality | 代码质量

  • Code follows project style | 代码遵循项目风格
  • Self-review completed | 已完成代码自查
  • Comments added for complex logic | 已添加必要注释
  • Code compiles successfully | 代码编译成功 (go build)
  • Ran go fmt | 已运行 go fmt

Documentation | 文档

  • Updated relevant documentation | 已更新相关文档
  • Added inline comments where necessary | 已添加必要的代码注释
  • Updated API documentation (if applicable) | 已更新 API 文档

Git

  • Commits follow conventional format | 提交遵循 Conventional Commits 格式
  • Rebased on latest dev branch | 已 rebase 到最新 dev 分支
  • No merge conflicts | 无合并冲突

📚 Additional Notes | 补充说明

English:中文:


By submitting this PR, I confirm | 提交此 PR,我确认:

  • I have read the Contributing Guidelines | 已阅读贡献指南
  • I agree to the Code of Conduct | 同意行为准则
  • My contribution is licensed under AGPL-3.0 | 贡献遵循 AGPL-3.0 许可证

🌟 Thank you for your contribution! | 感谢你的贡献!

- Get qtyStep from Bybit API for each symbol and cache it
- Format quantity based on actual qtyStep (e.g., BEATUSDT requires integers)
- Add missing fields to GetPositions: markPrice, unRealizedProfit, liquidationPrice
- Fix panic in buildTradingContext due to nil interface conversion
…ent write

- Add OKX trader support in order_sync.go and position_sync.go
- Change exchange.Type to exchange.ID for correct exchange identification
- Add writeMu mutex to prevent concurrent WebSocket writes in combined_streams.go and websocket_client.go
- Use http.DefaultClient instead of custom client, consistent with Binance/Bybit SDKs
- Remove unnecessary noProxyFunc and net/url import
- All exchanges now use the same HTTP client behavior
- Remove system_config, beta_codes, signal_source tables and related code
- Simplify config.go to only read from .env (APIServerPort, JWTSecret, RegistrationEnabled)
- Remove GetCustomCoins, use all USDT perpetual contracts for WSMonitor
- Add trader_equity_snapshots table for equity tracking
- Remove signal source modal from frontend AITradersPage
- Fix WSMonitor nil panic by restoring initialization in main.go
- Add clickable position rows that scroll to chart and update symbol
- Add framer-motion animations to chart tab transitions
- Sync exchange selection between positions and TradingView chart
- Optimize position table layout with compact styling
- Update CSS with glass effects and premium button styles
- Remove initDefaultData() for exchanges, ai_models, strategies tables
- Change supported exchanges/models API to return static lists
- Add GetDefaultStrategyConfig(lang) with Chinese/English prompt templates
- Frontend passes language parameter when creating new strategy
- StrategyStudioPage: auto-select new strategy after creation, clear selection after deletion
- ModelConfigModal: add loading state and async onSave handling
- ExchangeConfigModal: add loading state to prevent duplicate submissions
- Add RawResponse field to FullDecision and DecisionRecord
- Save raw AI response to database for debugging parse failures
- Add IMPORTANT note in prompt: all numeric values must be calculated numbers, not formulas
- Remove trader_orders table and OrderSyncManager (never worked correctly)
- Poll GetOrderStatus to get actual avgPrice, executedQty, and commission
- Get entry price from exchange GetPositions API when closing positions
- Pass fee to trader_positions table on close
- Move TraderStats type to position.go
- Add KlineBar struct with full OHLCV data and timestamp
- Store complete kline data in TimeframeSeriesData.Klines
- Format klines as readable table with Time, Open, High, Low, Close, Volume
- Mark current (latest) bar for clarity
- Use kline count from strategy config instead of hardcoded 10
- Keep MidPrices/Volume for backward compatibility
- Update both market/data.go and decision/strategy_engine.go formatters
- Fix OITopAPIResponse struct to use Code int (0=success) instead of Success bool
- Add all response fields from actual API (time_range_param, rank_type, limit)
- Add {symbol} placeholder validation warning in FetchQuantData
- Add API-level validation in strategy create/update to warn about missing {symbol}
Backend:
- Fix AIModelStore.Update to preserve existing API key when new key is empty
  (prevents clearing API key when adding a new model)
- Add default OI Top API URL to strategy config

Frontend:
- Add "Fill Default" buttons for Coin Pool, OI Top, and Quant Data URLs
- Pre-configured default URLs for all data sources
- Users can click to auto-fill with working defaults
Backend:
- Add enable_raw_klines field to IndicatorConfig (always true, required)
- Change defaults: disable EMA/MACD/RSI/ATR, keep volume/OI/funding enabled

Frontend:
- Completely redesign IndicatorEditor with 4 clear sections:
  1. Market Data: Raw OHLCV (required, locked) + timeframe selection
  2. Technical Indicators: EMA/MACD/RSI/ATR (optional, AI can calculate)
  3. Market Sentiment: Volume/OI/Funding Rate
  4. Quant Data: External API integration
- Add helpful tips and descriptions in both Chinese and English
- Improve visual hierarchy with section headers and color coding
- Auto-ensure enable_raw_klines is always true
When the program restarts, traders that had is_running=true in the
database will now automatically start. If a trader fails to run,
its status will be updated to false in the database.
…d UI

Backend:
- Add GetByID method to TraderStore for fetching trader without userID
- Calculate total_pnl_pct in equity history API using initial_balance
- Falls back to first snapshot equity if initial_balance not set

Frontend (ComparisonChart):
- Redesign with modern UI: gradient fills, glow effects, rounded corners
- Add mini stats bar showing all traders with current PnL
- Improved tooltip with date, time, and trend icons
- Better Y-axis domain calculation ensuring zero is visible
- Bottom stats grid: Leader, Lead PnL, Gap, Data Points
- Use ComposedChart with Area + Line for visual depth
- Animated loading state with spinning indicator
- Add PunkAvatar component for Web3-style trader avatars
- Integrate punk avatars into trader cards and dashboard header
- Add official Twitter/Telegram links to footer with anti-fork protection
- Create branding.ts with Base64 encoded official links
Frontend now calculates total_pnl_pct from equity values if the backend
doesn't return this field. This ensures the performance chart displays
correctly regardless of backend version.
@tinkle-community
tinkle-community merged commit 6c14e50 into main Dec 8, 2025
23 of 28 checks passed
@github-actions

github-actions Bot commented Dec 8, 2025

Copy link
Copy Markdown

⚠️ PR Title Format Suggestion

Your PR title doesn't follow the Conventional Commits format, but this won't block your PR from being merged.

Current title: merge

Recommended format: type(scope): description

Valid types:

feat, fix, docs, style, refactor, perf, test, chore, ci, security, build

Common scopes (optional):

exchange, trader, ai, api, ui, frontend, backend, security, deps, workflow, github, actions, config, docker, build, release

Examples:

  • feat(trader): add new trading strategy
  • fix(api): resolve authentication issue
  • docs: update README
  • chore(deps): update dependencies
  • ci(workflow): improve GitHub Actions

Note: This is a suggestion to improve consistency. Your PR can still be reviewed and merged.


This is an automated comment. You can update the PR title anytime.

@github-actions

github-actions Bot commented Dec 8, 2025

Copy link
Copy Markdown

🚨 This PR is large (>18934 lines changed). Please consider breaking it into smaller, focused PRs for easier review.

@github-actions

github-actions Bot commented Dec 8, 2025

Copy link
Copy Markdown

🔧 已自动应用专用模板 | Auto-Applied Template

检测到您的PR主要包含 backend 相关的变更,系统已自动为您应用相应的模板。

Detected that your PR primarily contains backend changes. The appropriate template has been automatically applied.

文件统计 | File Statistics

  • 🔧 Go files: 29
  • 📦 Other files: 1

已应用模板 | Applied Template
.github/PULL_REQUEST_TEMPLATE/backend.md

✨ 您现在可以直接在PR描述中填写相关信息了!

✨ You can now fill in the relevant information in the PR description!

@github-actions

github-actions Bot commented Dec 8, 2025

Copy link
Copy Markdown

🐳 Docker Build Check Results

AMD64 builds: ✅ success
ARM64 build (native runner): ✅ success

🎉 All Docker builds passed!

✨ Using GitHub native ARM64 runners - 3x faster than emulation!

After merge, full multi-arch builds will run in ~10-12 minutes.

Checked: Backend (amd64 + arm64 native), Frontend (amd64) | Powered by GitHub ARM64 Runners

@github-actions

github-actions Bot commented Dec 8, 2025

Copy link
Copy Markdown

🤖 Advisory Check Results

These are advisory checks to help improve code quality. They won't block your PR from being merged.

📋 PR Information

Title Format: ⚠️ Suggestion - Consider using type(scope): description

Recommended format

Valid types: feat, fix, docs, style, refactor, perf, test, chore, ci, security, build

Examples:

  • feat(trader): add new trading strategy
  • fix(api): resolve authentication issue
  • docs: update README

PR Size: 🔴 Large (18934 lines: +9397 -9537)

💡 Suggestion: This is a large PR. Consider breaking it into smaller, focused PRs for easier review.

🔧 Backend Checks

Go Formatting: ⚠️ Needs formatting

Files needing formatting
api/strategy.go
api/utils_test.go
decision/engine.go
decision/strategy_engine.go
decision/validate_test.go
manager/trader_manager.go
market/data.go
mcp/client.go
mcp/config.go
mcp/deepseek_client.go

Go Vet: ✅ Good
Tests: ✅ Passed

Fix locally:

go fmt ./...      # Format code
go vet ./...      # Check for issues
go test ./...     # Run tests

⚛️ Frontend Checks

Build & Type Check: ✅ Success

Fix locally:

cd web
npm run build  # Test build (includes type checking)

📖 Resources

Questions? Feel free to ask in the comments! 🙏


These checks are advisory and won't block your PR from being merged. This comment is automatically generated from pr-checks-run.yml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant