Hyper Trading Agent is a commercial-oriented financial research agent platform. It combines agent chat, market research tools, backtesting, model provider configuration, and a RAG knowledge base for private financial research workflows.
This repository is maintained as an independent project under 970thunder.
- Agent chat API with streaming session events.
- Financial research tools, market data integrations, report generation, and backtesting.
- SiliconFlow, OpenAI-compatible, OpenRouter, DeepSeek, Qwen/DashScope, Ollama, and other provider configuration surfaces.
- Local lightweight RAG using SQLite FTS for single-machine usage.
- Commercial platform MVP:
- email/password auth
- organizations and RBAC roles
- model provider management
- knowledge bases, documents, URL ingestion, search, and citations
- audit logs and model usage API surfaces
- Production deployment skeleton with Docker Compose, PostgreSQL + pgvector schema, Redis, API, and worker services.
flowchart LR
UI["Frontend UI"] --> API["FastAPI API"]
API --> Agent["Agent Runtime"]
API --> Auth["Commercial Auth / RBAC"]
API --> KB["Knowledge Base API"]
Agent --> Tools["Research Tools"]
Agent --> Models["LLM Providers"]
KB --> LocalRAG["SQLite FTS MVP"]
KB --> PGVector["pgvector Adapter / Local Fallback"]
API --> Audit["Audit / Usage Logs"]
API --> Jobs["Durable Runtime Jobs"]
Jobs --> SQLiteJobs["SQLite Local Store"]
Jobs -. production .-> Redis["Redis Queue"]
Worker["Worker Process"] --> Redis
Backend:
cd agent
copy .env.example .env
python -m cli serve --port 8899Frontend:
cd frontend
npm install
npm run devOpen the frontend dev URL shown by Vite. The frontend proxies API traffic to the local backend.
For SiliconFlow, configure agent/.env:
LANGCHAIN_PROVIDER=siliconflow
LANGCHAIN_MODEL_NAME=deepseek-ai/DeepSeek-V3.2
SILICONFLOW_BASE_URL=https://api.siliconflow.cn/v1
SILICONFLOW_API_KEY=your-api-keyDo not commit real API keys. Use local .env files or production secrets.
Create production env:
copy .env.production.example .env.productionSet at least:
POSTGRES_PASSWORDAPI_AUTH_KEYVIBE_TRADING_SECRET_KEYSILICONFLOW_API_KEY
Runtime jobs default to the production queue contract in Docker:
HYPER_TRADING_RUNTIME_JOB_BACKEND=redis-postgres
HYPER_TRADING_RUNTIME_JOB_QUEUE=hyper:runtime:jobsFor a single-machine deployment without Redis/Postgres workers, set HYPER_TRADING_RUNTIME_JOB_BACKEND=sqlite-local.
Start:
docker compose --env-file .env.production -f docker-compose.prod.yml up --build -dInitialize the first organization owner:
$sfKey = (Select-String -Path .env.production -Pattern '^SILICONFLOW_API_KEY=').Line.Split('=',2)[1]
docker compose --env-file .env.production -f docker-compose.prod.yml exec api python -m src.commercial.bootstrap --email owner@example.com --password "change-this-password" --organization "Hyper Research" --api-key "$sfKey"Stop:
docker compose --env-file .env.production -f docker-compose.prod.yml downFor local HTTP access, set VIBE_TRADING_COOKIE_SECURE=false in .env.production. Use true only behind HTTPS/TLS. If host port 8899 is occupied, set API_PORT=8898 or another free port.
Docker Desktop may present browser requests to the container as the bridge gateway address instead of 127.0.0.1. For local-only Docker usage, keep API_BIND=127.0.0.1 and VIBE_TRADING_TRUST_DOCKER_LOOPBACK=1 so the bundled frontend can call protected API routes without a manual API key.
Operations runbooks:
POST /auth/registerPOST /auth/loginPOST /auth/logoutGET /auth/meGET /organizations/currentGET /models/providersPOST /models/providersPOST /models/providers/{id}/testGET /knowledge-basesPOST /knowledge-basesPOST /knowledge-bases/{id}/documentsPOST /knowledge-bases/{id}/urlsPOST /knowledge-bases/{id}/searchGET /audit-logsGET /usage/model-callsGET /metrics
- Runtime jobs have a SQLite durable store and a Redis/Postgres queue contract. The worker can consume queued envelopes and update job state, but full Agent run, web crawl, and long-backtest executors still need to be moved onto that worker path.
- RAG supports local fallback, embedding status, ingestion lifecycle, hybrid-style retrieval surfaces, and pgvector adapter configuration. Full production Postgres repository parity and rerank tuning remain follow-up work.
- CSRF protection, enterprise SSO, quota enforcement, and deeper observability hardening are still pending.
python -m pytest agent\tests\test_commercial_store.py -q
cd frontend
npm run build- Move Agent run, web crawl, RAG ingestion, and long backtest executors onto the durable Redis/Postgres worker path.
- Complete Postgres runtime repository parity for commercial data beyond the current SQLite MVP.
- Add rerank/evaluation loops for RAG and investment report quality.
- Add enterprise SSO, quota enforcement, and stronger observability hardening.
- Package private deployment runbooks, backup drills, and security review gates for commercial delivery.