Skip to content

feat(exchange): add MEXC paper trading - #1524

Open
katsushi2441 wants to merge 3 commits into
NoFxAiOS:devfrom
katsushi2441:feat/mexc-paper-trading
Open

feat(exchange): add MEXC paper trading#1524
katsushi2441 wants to merge 3 commits into
NoFxAiOS:devfrom
katsushi2441:feat/mexc-paper-trading

Conversation

@katsushi2441

Copy link
Copy Markdown

Summary

  • Problem: NOFX requires real exchange credentials and funds before users can safely evaluate an AI strategy against live market prices.
  • What changed: Added an API-key-free MEXC paper exchange that reads public MEXC Spot V3 prices/candles and simulates USDT-margined long/short positions, leverage, fees, stop-loss, take-profit, balances, orders, and closed PnL locally. Added API routing, exchange setup UI, persistent paper accounts, MEXC interval normalization/aggregation, and tests.
  • What did NOT change (scope boundary): No MEXC private or order endpoint is called. Existing live exchange behavior, credentials, and order execution are unchanged.

Change Type

  • Bug fix
  • Feature
  • Refactoring
  • Docs
  • Security fix
  • Chore / infra

Scope

  • Trading engine / strategies
  • MCP / AI clients
  • API / server
  • Telegram bot / agent
  • Web UI / frontend
  • Config / deployment
  • CI/CD / infra

Linked Issues

  • Related: none

Testing

What you verified and how:

  • go build ./... passes
  • go test ./... passes
  • Manual testing done (describe below)

Manual verification:

  • Confirmed MEXC public ticker, symbol, native 1h, and aligned aggregated 3m candle retrieval.
  • Confirmed a 10,000 USDT paper account can start without credentials.
  • Confirmed long/short fills, fees, persistence, insufficient-margin rejection, and stop-loss/take-profit execution through automated tests.
  • npm test -- --run: 128 tests passed.
  • npm run build: TypeScript and Vite production build passed.

Security Impact

  • Secrets/keys handling changed? No; MEXC Paper neither accepts nor requires exchange credentials.
  • New/changed API endpoints? No new paths; existing exchange, symbol, candle, account, and trader endpoints now support mexc_paper.
  • User input validation affected? Yes; mexc_paper is accepted as a credential-free exchange type, while existing exchange validation is unchanged.

Compatibility

  • Backward compatible? Yes
  • Config/env changes? No; NOFX_MEXC_PAPER_DATA_DIR is optional and defaults to data/mexc-paper.
  • Migration needed? No
  • If yes, upgrade steps: N/A

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant