Skip to content

Markfans/cryptoquant-ai

Repository files navigation

CryptoQuant AI

CryptoQuant AI is a local-first quantitative cryptocurrency trading dashboard for research, monitoring, backtesting, and optional OKX execution. It combines a React/Vite frontend with an Express/TypeScript backend, local SQLite persistence, OKX market/account integrations, Zhipu GLM-assisted summaries, and risk controls for strategy evaluation.

This project is for research and personal operations. It is not financial advice. Use demo trading first, keep API permissions limited, and never expose this service directly to the public internet without proper hardening.

Features

  • OKX market data, account balance, positions, order history, and order submission support.
  • Demo and live OKX credential paths with a local encrypted credential store.
  • Regime-based strategy engine with trend breakout, mean reversion, macro risk gating, TP/SL construction, and risk kill switch behavior.
  • Shadow trading, walk-forward backtesting, portfolio return analytics, execution diagnostics, reliability views, and audit trails.
  • Local SQLite and JSON persistence for trades, state, risk events, and research snapshots.
  • React dashboard with legacy embedded panels for existing operational workflows.

Prerequisites

  • Node.js 24 or newer.
  • npm 10 or newer.
  • Git.
  • Optional OKX API credentials for live or demo trading.
  • Optional Zhipu GLM API key for AI-assisted summaries.
  • Optional FRED API key for macro data.
  • Optional local HTTP/SOCKS proxy if your network cannot reach OKX directly.

Installation

git clone https://github.com/YOUR_GITHUB_USERNAME/cryptoquant-ai.git
cd cryptoquant-ai
npm ci
copy .env.example .env

On macOS or Linux, use:

cp .env.example .env

Edit .env and replace every YOUR_..._HERE value with your own local credentials. Leave optional services blank if you do not use them.

Usage

Start the local development server:

npm run dev

Then open:

http://localhost:3000

Build for production:

npm run build
npm run start:prod

Run validation:

npm run lint
npm test
npm run build

Windows users can also run 一键启动.bat from the project root. The script checks Node/npm, installs dependencies, creates .env from .env.example when needed, runs type checks, and starts the app.

Configuration

The app reads configuration from .env. Important variables include:

  • ADMIN_USERNAME, ADMIN_PASSWORD, SESSION_TTL_HOURS for local operator login.
  • APP_SECRET for local encrypted credential storage.
  • OKX_API_KEY, OKX_SECRET_KEY, OKX_PASSPHRASE for OKX live mode.
  • OKX_DEMO_API_KEY, OKX_DEMO_SECRET_KEY, OKX_DEMO_PASSPHRASE for OKX demo mode.
  • EXCHANGE_PROXY_URL for optional proxy routing, for example http://127.0.0.1:10808.
  • ZHIPU_API_KEY and model settings for AI-assisted summaries.
  • FRED_API_KEY for macro data.
  • SMTP_USER, SMTP_PASS, SMTP_TO for optional email notifications.

Never commit .env, data/, logs, SQLite files, screenshots containing account information, or encrypted credential stores.

Security Notes

  • Start with OKX demo trading before live trading.
  • Restrict exchange API keys to the minimum permissions needed.
  • Do not put API keys in frontend code.
  • Use a long random APP_SECRET before saving credentials in the local vault.
  • Keep this service behind local authentication and do not publish it as an unauthenticated public web app.
  • Review generated orders, leverage, take-profit, and stop-loss behavior before enabling live execution.

License

MIT. See LICENSE.

About

CryptoQuant AI is an advanced, open-source quantitative trading platform designed to bridge the gap between algorithmic market execution and artificial intelligence. Built entirely on a modern Node.js, Vite, and TypeScript stack, this project provides a robust, highly responsive frontend dashboard paired with powerful automation capabilities.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors