oficcejo/alpha-arena-okx

比特币BTC加密货币ai自动交易机器人,基于nof1:alphaarena项目,让ai模型deepseek或qwen3-max自动炒币的程序,支持欧易okx交易所。无需人工干预,请看演示网站(演示为新版本,正在持续测试中,稳定盈利后更新,请关注更新)

What it is

alpha‑arena‑okx is an open‑source, AI‑assisted Bitcoin futures trading bot for the OKX exchange. It continuously fetches market data, lets a DeepSeek‑chat model generate buy/hold/sell signals, and then places orders (including real‑time stop‑loss / take‑profit orders). A Streamlit‑based web dashboard shows account balances, positions, price charts and the AI’s latest decision.

Core components

File / folder Role
deepseekok2.py Main trading loop – pulls OHLCV data, calls the DeepSeek API, computes position size, sends orders to OKX and manages stop‑loss/take‑profit orders.
streamlit_app.py Real‑time monitoring UI built with Streamlit – displays account info, price, profit curve and the AI’s signal with visual effects.
run.py Single entry point used by the Baota (宝塔) panel to start both the bot and the UI together.
data_manager.py Simple in‑memory/shared data store that lets the bot and the UI read the same latest market / signal information.
requirements.txt Python dependencies (e.g., ccxt, streamlit, httpx).
Docker files (Dockerfile, Dockerfile.trading, docker‑compose.yml) Containerised builds for the trading process and the Streamlit UI.
.env_template / .env Holds API keys for DeepSeek, OKX (and optionally Binance) and other configuration values.

How it works

  1. Data collection – Uses ccxt to fetch 15‑minute candles from OKX.
  2. AI decision – Sends the recent price series (and a few technical‑indicator values) to the DeepSeek‑chat model. The model returns a simple command: buy, sell (short) or hold.
  3. Position sizing – A formula combines a base USDT amount, a confidence multiplier, a max‑position ratio and a trend‑strength factor to compute the order size.
  4. Order execution – Places market (or limit) orders via OKX API, then immediately creates real stop‑loss / take‑profit orders so the exchange can close the position without waiting for the 15‑minute cycle.
  5. Monitoring – The Streamlit dashboard reads the shared state and shows:
    • Account equity and margin usage
    • Current position and order IDs
    • BTC price and 24‑h change
    • Profit‑and‑loss curve
    • The AI’s latest reasoning (text returned by DeepSeek)

Deployment options

Method When to use Steps (high‑level)
Baota panel (一键部署) VPS/云服务器 with a graphical control panel (recommended for non‑technical users). Install Baota, add a Python 项目管理器, upload the repo, set run.py as the start script, fill .env with keys.
Docker Local development or container‑oriented production. git clone … && cd ds-main && cp .env.example .env && docker-compose up -d.
Direct Python Quick debugging or custom development. Create a virtualenv, pip install -r requirements.txt, run python deepseekok2.py (bot) and streamlit run streamlit_app.py (UI) or simply python run.py.

Configuration highlights

  • AI model – DeepSeek‑chat (deepseek-chat). API key placed in DEEPSEEK_API_KEY.
  • Exchange – OKX API keys (OKX_API_KEY, OKX_SECRET, OKX_PASSWORD). The bot works in single‑direction mode (only long or only short, as configured).
  • Trading parameters – Defined in deepseekok2.py under TRADE_CONFIG. Important knobs:
    • leverage (default 10×)
    • timeframe (15m or 1h as per the latest test)
    • Position‑management block with confidence multipliers and max‑position ratio.
  • Stop‑loss / take‑profit – Enabled in v2.1; the bot creates real algorithmic orders on OKX that trigger instantly when price hits the thresholds.

Who might use it

  • Retail crypto traders who want an AI‑driven signal layer without writing their own model.
  • Developers looking for a ready‑made example of integrating a large‑language‑model API into an automated trading pipeline.
  • Anyone interested in experimenting with AI‑based risk management (stop‑loss/take‑profit automation) on futures markets.

Caveats / warnings

  • The author repeatedly notes that the strategy is not consistently profitable; extensive testing is advised before committing real capital.
  • Only single‑direction positions are supported – you must configure the bot for either long or short only.
  • API usage incurs costs (DeepSeek token pricing) and requires careful handling of secret keys.
  • The bot relies on the stability of the OKX API and the DeepSeek service; outages will halt trading.

All information above is taken directly from the repository’s README; no additional features have been inferred.

Related

  • Project
  • Project
  • Project
  • Project
  • Project