16 Commits

Author SHA1 Message Date
shinchan-zhai fd77f2df3e feat: AI cost tracking, pre-launch balance check, low balance alerts
- store/ai_charge.go: local AI cost tracking per call (SQLite)
- wallet/usdc.go: shared USDC balance query (Base chain RPC)
- Pre-launch: estimate daily cost + runway days
- Low balance: warn <$1, error at $0 (every 10 cycles)
- API: GET /api/ai-costs for cost history
- Frontend: model cards show price per call
- Frontend: wallet create + QR deposit + balance display
2026-03-21 12:31:20 +08:00
tinkle-community 4776fc37ce feat: add metric formula tooltips with KaTeX rendering 2025-12-29 00:28:20 +08:00
tinkle-community 39e7df253a fix: update vitest to 4.0.16 to resolve security vulnerabilities
- Fix esbuild vulnerability (GHSA-67mh-4wv8-2f99)
- Update vitest from 2.1.9 to 4.0.16
- Resolves 5 moderate severity vulnerabilities
2025-12-26 01:06:48 +08:00
tinkle-community 1744e7f38e feat: migrate to CoinAnk API and improve chart UI
- Chart improvements: professional styling, popular symbols quick selection, simplified B/S legend
- Data source migration: use CoinAnk API exclusively for all kline data
- Code cleanup: remove Binance WebSocket cache and related code (websocket_client.go, combined_streams.go, monitor.go)
- Log optimization: reduce hook spam, suppress 404 errors, increase P&L diff threshold
- Lighter integration: add order sync functionality, fix market order precision
- Remove ticker merge logic for simplicity
2025-12-26 00:58:12 +08:00
tinkle-community 1e135ea9c3 feat: redesign backtest module UI and fix 404 issue
- Fix backtest API 404 by registering routes in setupRoutes()
- Redesign BacktestPage with 3-step wizard configuration
- Add progress ring visualization with animation
- Add equity chart with trade markers using Recharts
- Add trade timeline with card-style display
- Add stats cards for equity, return, drawdown, sharpe
- Add tab navigation for overview/chart/trades/decisions
- Improve run history list with status icons
- Add lightweight-charts dependency (for future use)
2025-12-14 00:23:51 +08:00
Ember cdb7a6ba06 refactor(web): redesign httpClient with axios and unified error handling (#1061)
* fix(web): remove duplicate PasswordChecklist in error block
- Remove duplicate PasswordChecklist component from error message area
- Keep only the real-time password validation checklist
- Error block now displays only the error message text
Bug was introduced in commit aa0bd93 (PR #872)
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
* refactor(web): redesign httpClient with axios and unified error handling
Major refactoring to improve error handling architecture:
## Changes
### 1. HTTP Client Redesign (httpClient.ts)
- Replaced native fetch with axios for better interceptor support
- Implemented request/response interceptors for centralized error handling
- Added automatic Bearer token injection in request interceptor
- Network errors and system errors (404, 403, 500) now intercepted and shown via toast
- Only business logic errors (4xx except 401/403/404) returned to caller
- New ApiResponse<T> interface for type-safe responses
### 2. API Migration (api.ts)
- Migrated all 31 API methods from legacy fetch-style to new httpClient
- Updated pattern: from `res.ok/res.json()` to `result.success/result.data`
- Removed getAuthHeaders() helper (token now auto-injected)
- Added TypeScript generics for better type safety
### 3. Component Updates
- AuthContext.tsx: Updated register() to use new API
- TraderConfigModal.tsx: Migrated 3 API calls (config, templates, balance)
- RegisterPage.tsx: Simplified error display (error type handling now in API layer)
### 4. Removed Legacy Code
- Removed legacyHttpClient compatibility wrapper (~30 lines)
- Removed legacyRequest() method
- Clean separation: API layer handles all error classification
## Benefits
- Centralized error handling - no need to check network/system errors in components
- Better UX - automatic toast notifications for system errors
- Type safety - generic ApiResponse<T> provides compile-time checks
- Cleaner business components - only handle business logic errors
- Consistent error messages across the application
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
---------
Co-authored-by: tinkle-community <tinklefund@gmail.com>
2025-11-17 14:48:14 +08:00
Ember 3bf69b758b Refactor(UI) : Refactor Frontend: Unified Toasts with Sonner, Introduced Layout System, and Integrated React Router (#872) 2025-11-10 23:19:17 -05:00
Ember 4667c3bf00 feat(ui): add password strength validation and toggle visibility in registration and reset password forms (#773)
Co-authored-by: tinkle-community <tinklefund@gmail.com>
2025-11-09 00:36:28 +08:00
0xYYBB | ZYY | Bobo 3a23167d31 fix(web): restore ESLint, Prettier, and Husky code quality tools (#648)
## Problem
PR #647 accidentally removed all code quality tools when adding test dependencies:
-  ESLint (9 packages) - code linting
-  Prettier - code formatting
-  Husky - Git hooks
-  lint-staged - pre-commit checks
-  Related scripts (lint, format, prepare)
This significantly impacts code quality and team collaboration.
## Root Cause
When adding test dependencies (vitest, @testing-library/react), the package.json
was incorrectly edited, removing all existing devDependencies.
## Solution
Restore all code quality tools while keeping the new test dependencies:
###  Restored packages:
- @eslint/js
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- eslint + plugins (prettier, react, react-hooks, react-refresh)
- prettier
- husky
- lint-staged
###  Kept test packages:
- @testing-library/jest-dom
- @testing-library/react
- jsdom
- vitest
###  Restored scripts:
```json
{
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
  "lint:fix": "eslint . --ext ts,tsx --fix",
  "format": "prettier --write \"src/**/*.{ts,tsx,css,json}\"",
  "format:check": "prettier --check \"src/**/*.{ts,tsx,css,json}\"",
  "test": "vitest run",
  "prepare": "husky"
}
```
###  Restored lint-staged config
## Impact
This fix restores:
- Automated code style enforcement
- Pre-commit quality checks
- Consistent code formatting
- Team collaboration standards
## Testing
- [x] npm install succeeds
- [x] npm run build succeeds
- [x] All scripts are functional
Related-To: PR #647
Co-authored-by: tinkle-community <tinklefund@gmail.com>
2025-11-07 01:30:13 +08:00
0xYYBB | ZYY | Bobo 43561a4ad7 fix(web): resolve TypeScript type error in crypto.ts and add missing test dependencies (#647)
```
src/lib/crypto.ts(66,32): error TS2345: Argument of type 'Uint8Array<ArrayBuffer>'
is not assignable to parameter of type 'ArrayBuffer'.
```
`arrayBufferToBase64` function expected `ArrayBuffer` but received `Uint8Array.buffer`.
TypeScript strict type checking flagged the mismatch.
1. Update `arrayBufferToBase64` signature to accept `ArrayBuffer | Uint8Array`
2. Pass `result` directly instead of `result.buffer` (more accurate)
3. Add runtime type check with instanceof
```
error TS2307: Cannot find module 'vitest'
error TS2307: Cannot find module '@testing-library/react'
```
Install missing devDependencies:
- vitest
- @testing-library/react
- @testing-library/jest-dom
 Frontend builds successfully
 TypeScript compilation passes
 No type errors
Related-To: Docker frontend build failures
2025-11-07 01:19:48 +08:00
Ember a89cd722c9 test: add eslint and prettier configuration with pre-commit hook 2025-11-05 11:40:05 +08:00
Liu Xiang Qian 2eb5801e3d Revert "Merge pull request #229 from xqliu/test/add-ut-infrastructure"
This reverts commit 683e77b92f7608c31a7c25c91bb938c4d657f6e4, reversing
changes made to 791cecd2ffff0ebc3ea88c04fb91ddbe0c001422.
2025-11-04 00:58:12 +08:00
Liu Xiang Qian cf12be74f5 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)
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-02 10:58:31 +08:00
Ember e747e449da feat(web): 新增 Landing 页面与 UI 优化\n\n- 新增 LandingPage、CryptoFeatureCard 等组件\n- 登录/注册页面与样式优化\n- 静态资源 images/main.png 2025-11-01 23:36:28 +08:00
Ember 899add597a feat: enhance UI with Lucide icons across various components
- add logo
- Replaced emoji placeholders with Lucide icons in AITradersPage, CompetitionPage, EquityChart, Header, LoginPage, and RegisterPage for improved visual consistency.
- Updated button styles to include icons for actions like adding models and exchanges.
- Enhanced error and empty state displays with relevant icons to provide better user feedback.
2025-10-31 23:28:19 +08:00
tinkle-community 5aa50d35d7 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