Skip to content
プロジェクト

0xethanq/astra-quant-agent

GitHubで見る

概要

AstraQuant | 複数の LLM による協議、決定論的な Python のリスク制御、OKX での取引実行を備えた自律型暗号資産取引システムです。複数の大規模言語モデルと決定論的なコードによるリスク管理を組み合わせたクオンツ取引システムです。

ビジネス・金融

この数値の測り方

できること

  • Conversational AI Assistant (/admin/agent): Inspects live positions, 48-cycle order funnel drop-offs, risk conflicts, and runtime logs via read-only tools. Every configuration change is staged as a visual Key-Value Diff Proposal card with an automatic Pre-Apply Policy Snapshot and 1-Click Rollback.
  • Risk & Orders: 3 preset risk suites (conservative, balanced, aggressive), limit / market / smart hybrid order routing, Scale-Out (TP1/TP2 + breakeven SL) toggle, and 32 validated physics risk gates.
  • Model Council: Enable or bypass multi-seat deliberation (Macro, Tech, Risk, CIO) with per-seat model binding, reasoning effort, and fallback to single primary model.
  • Prompts: Modular system/user prompt pipeline editor with locked safety cores and versioned profiles.

計測したスター増加

24時間
+1
7日間
+6
15日間
+9
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

AstraQuant

Self-Hosted OKX Perpetuals AI Quant Decision & Execution System

License Python Vue 3 OKX V5 Version

English · 简体中文 · Live Terminal (astraquant.top) · Sister Skills Hub (tradeskill.si)


AstraQuant Live Dashboard


Overview

AstraQuant is a self-hosted algorithmic trading and operations system built natively for OKX USDT-Margined Perpetuals (OKX V5 API). It pairs deterministic Python microstructure analysis and hard risk interlocks with configurable LLM reasoning — backed by an interactive Web workstation and a conversational Control Plane.

  • Public Live Workstation (/): Real-time OKX equity & margin telemetry, interactive candlestick chart with live Entry / SL / two-leg TP1 & TP2 overlays, AI decision timeline with Chain-of-Thought inspection, closed-loop strategy review, macro news stream, and full trade ledger.
  • Direct Control Plane (/admin/*): Unified AI Assistant (/admin/agent) with structured config diff proposals, pre-apply policy snapshots, and 1-click rollback, plus a 5-tab Strategy Config (/admin/strategy) managing 32 risk parameters, order routing, model council, modular prompts, experience rules, and trading windows.

Visual Tour (v9.2.0)

Live Trading Workstation
Live Workstation
AI Assistant & Atomic Diff Proposals
AI Assistant Console
Strategy Config & Smart Order Routing
Strategy Config
AI Decisions Timeline
AI Decisions
Chain-of-Thought Audit Drawer
CoT Audit Drawer
Closed-Loop Strategy Review
Strategy Review
Trade Ledger & Lifecycle
Trade Ledger
Market Intelligence & Long/Short Ratio
Market News

Core Architecture

OKX V5 (Candles · Orderbook · Funding · OI · Positions)
   │
   ▼
7-Tier Quantitative Factor Matrix (backend/scripts/market_radar.py)
   │  Multi-timeframe trend (4H/1H/15M), VWAP value area, CVD divergence, orderbook imbalance
   ▼
AI Decision Engine (backend/scripts/ai_brain_trader.py)
   │  Single primary LLM or optional Multi-Model Council (Macro / Tech / Risk / CIO)
   ▼
32-Param Fail-Closed Risk Engine (backend/scripts/risk_constants.py)
   │  1R risk budget · leverage caps · min R:R · daily loss circuit breaker · cooldown · DEMO gate
   ▼
Execution & Cloud Protection (backend/scripts/trader/)
   │  Smart hybrid (Post-Only maker -> IOC fallback) · Limit · Market
   │  Two-leg Scale-Out (TP1 partial close + SL to breakeven + TP2 runner) · Cloud OCO Algo orders
   ▼
Closed-Loop Operations (/admin/agent · /lab)
      Trade attrition review, structured experience rules, conversational Agent diagnostics & rollback

Key Capabilities in v9.2.0

  1. Conversational AI Assistant (/admin/agent): Inspects live positions, 48-cycle order funnel drop-offs, risk conflicts, and runtime logs via read-only tools. Every configuration change is staged as a visual Key-Value Diff Proposal card with an automatic Pre-Apply Policy Snapshot and 1-Click Rollback.
  2. Unified 5-Tab Strategy Config (/admin/strategy):
    • Risk & Orders: 3 preset risk suites (conservative, balanced, aggressive), limit / market / smart hybrid order routing, Scale-Out (TP1/TP2 + breakeven SL) toggle, and 32 validated physics risk gates.
    • Model Council: Enable or bypass multi-seat deliberation (Macro, Tech, Risk, CIO) with per-seat model binding, reasoning effort, and fallback to single primary model.
    • Prompts: Modular system/user prompt pipeline editor with locked safety cores and versioned profiles.
    • Memory & Review: Automated post-trade attribution (self_improvement_engine.py) and toggleable experience rules injected back into future prompts.
    • Windows & Jobs: UTC+8 trading-session gates and on-demand manual maintenance jobs.
  3. Hard DEMO / LIVE Isolation: Separate encrypted keystores and .env execution gates ensure simulated paper accounts (DEMO) can never accidentally submit real mainnet orders.

Supporting AstraQuant through OKX order attribution

AstraQuant takes ongoing work to develop, test, document, and host. Thank you for supporting the project. OKX order attribution is on by default when there is no saved preference. While enabled, new orders carry the project code and OKX may pay the project a rebate on eligible trades. The account signup invitation is managed separately, and account fees follow OKX rules.

A superadmin can review the beneficiary and code and turn attribution off at any time under Account Access → OKX Broker Attribution. DEMO and LIVE preferences are separate. Turning it off omits the code on later requests, including protection orders and emergency closes. OKX continues to manage orders it has already accepted.

Upgrades preserve existing settings, including saved opt-outs. Portable backups exclude this preference file. A new installation restored from a backup alone starts with the default, so review the setting before trading.

Quick Start

1. Docker Compose (Recommended)

git clone https://github.com/0xethanq/astra-quant-agent.git
cd astra-quant-agent

# Copy default template (defaults to OKX DEMO paper mode)
cp backend/env.example backend/.env
chmod 600 backend/.env

# Optional: run interactive initialization wizard
python3 backend/scripts/setup_wizard.py

# Start backend + watchdog + gateway
ASTRA_BUILD_REVISION="$(git rev-parse HEAD)" docker compose up -d --build

Open http://127.0.0.1:8080:

  • First visit creates your superadmin account at /admin/login (initial initialization).
  • Configure an LLM provider in /admin/llm and OKX V5 DEMO API credentials in /admin/security.

The admin version page compares the running image's commit with GitHub main. To deploy a newer commit, rebuild the backend and gateway images from a clean host checkout using the same build command.

2. Local Standalone Development

See STANDALONE.md for running Python + Vite without Docker and RECOVERY_GUIDE.md for daemon & database recovery procedures.


Sister Project: TradeSkill (OKX 20% Fee Rebate & AI IDE Skills)

Looking to query markets or place trades directly inside Claude Code, Cursor, Codex, or Windsurf, or reduce OKX perpetual fees?

Sister Single-Venue Editions & Live Terminals

Edition Live Terminal GitHub Repository TradeSkill Companion
AstraQuant · OKX V5 astraquant.top 0xethanq/astra-quant-agent OKX Skills · 20% Rebate
AstraQuant · Gate V4 gate.astraquant.top 0xethanq/astra-quant-gate Gate Skills · 20% Rebate
AstraQuant · Binance USDⓈ-M bn.astraquant.top 0xethanq/astra-quant-binance Binance Skills · 20% Rebate
TradeSkill Hub tradeskill.si 0xethanq/crypto-trading-skills 164 Skills & Calculator

Repository Layout

astra-quant-agent/
├── backend/
│   ├── astra_backend/       # FastAPI control plane, Agent console, LLM hub, risk & backup APIs
│   ├── astra_gateway/       # Encrypted secrets vault, notification channels & backup supervisor
│   ├── scripts/             # Core quant loop, 7-tier market radar, execution & evolution engine
│   ├── docs/images/         # Documentation screenshots served at /images/* and /docs/images/*
│   └── tests/               # Offline pytest/unittest audit, trading, UI, LLM & ops suites
├── frontend/
│   ├── src/views/dashboard/ # Public terminal views (/, /factors, /news, /lab, /history)
│   ├── src/views/admin/     # Admin workbench (/admin/agent, /admin/strategy, /admin/llm, ...)
│   ├── src/views/docs/      # Interactive in-app user manual (/docs)
│   └── tests/               # Frontend design parity, i18n copy & dead-UI Node test gates
├── Dockerfile               # Multi-stage Node 26 + Python 3.14 production build
└── docker-compose.yml       # Single-host deployment orchestration

Code map

Entry-point guides inside each subsystem:

Notice: OPENCODE.md does not exist in this repository and was never contained here. Start from the subsystem READMEs below.

File Purpose
backend/astra_backend/README.md Backend layering & subsystem placement rules (L0-L3, routers vs domain services)
backend/scripts/README.md Runtime scripts & daemons entrypoints (ai_brain_trader, market_radar, trader/)
frontend/src/components/admin/README.md Frontend components & state conventions, composables, and design gates
RECOVERY_GUIDE.md Emergency stop, process restart, and ledger recovery commands

Automated doc & test baseline gates:

  • backend/tests/audit/test_directory_docs_current.py (keeps subsystem maps and root entries synchronized)
  • backend/tests/core/test_readme_baseline_numbers.py (verifies documented offline test counts match AST methods)

Brand & codename

The public product name is AstraQuant and the internal codebase prefix is astra (astra_backend, astra_gateway, ASTRA_*). Intentional historical markers retained solely for backward compatibility with existing exchange orders and encrypted backups:

  • t-r20sl* client order tags (backend/scripts/tag_markers.py) for previously placed exchange stop-loss brackets.
  • R20GCM2 archive header magic (backend/scripts/backup_runtime.py) so older backup archives remain decryptable.
  • Historical deployment path /opt/r20-quantum-trader / Grafana UIDs referenced in migration docs and legacy service units.

License & Disclaimer

Licensed under GNU AGPL-3.0 + Commons Clause v1.0 + Anti-Scam Special Addendum — personal/internal quant usage and transparent auditing are free; unauthorized commercial resale, SaaS hosting, or fraudulent signal schemes are prohibited.

Risk Disclosure: Algorithmic cryptocurrency futures trading carries significant financial risk. Start in OKX DEMO simulated mode, validate risk parameters and stop-loss protection before committing real capital, and never expose admin tokens or API keys publicly.

関連プロジェクトを探す

読み込み中…