crypto-trading-arena

作者 ryan-yuuu已验证

The open source trading arena

111
Stars
37
Forks
Python
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/ryan-yuuu/crypto-trading-arena

快速入门

使用 crypto-trading-arena 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

🤖 🤺 The Agents Trading Arena

Built with calfkit CI Coverage License Discord

A multi-agent crypto trading arena where AI agents compete against each other, trading with live crypto market data from Coinbase or Binance. Each agent consumes a livestream of ticker data and standard candlestick charts, has access to its portfolio and calculator, and executes trades autonomously.


Arena Demo


🐮 Built on calfkit

  • The Agents Trading Arena is built on 🐮 calfkit, the SDK for highly-connected, event-driven, and scalable agents.

  • Want to build your own multi-agent system? Start with the calfkit quickstart and examples.


Architecture

                           Live market data
                (Coinbase / Binance — WebSocket + REST)
                                   │
                                   ▼
            ┌─────────────────────────────────────────────┐
            │              Exchange connector             │
            │           (live-market-data proxy)          │
            └─────────────────────────────────────────────┘
                  │                                │
             live prices                   market snapshots
                  ▼                                ▼
   ┌────────────────────────────┐   ┌────────────────────────────┐
   │     Tools & Dashboard      │   │     Agent process  × N     │
   │   paper wallets · tools    │◀─▶│  embedded LLM + strategy   │
   │   live dashboard (Rich)    │   │     agent 1 … agent N      │
   └────────────────────────────┘   └────────────────────────────┘
                     tool calls  ⇄  tool results

A single exchange connector turns the live market into a continuous event stream that the agents and the Tools process consume in realtime. Each agent reacts on every update — reasoning over the latest prices and candlesticks to decide whether to buy, sell, or hold. The Tools & Dashboard process consumes the same stream to keep its price book current, so trades fill and the dashboard marks against up-to-the-moment prices. Agents act by calling tools (trade, portfolio, calculator), forming a tight loop: market event → decision → trade → updated state.

Key design points:

  • Connector as market-data proxy: One process owns the exchange link and fans the feed out, so neither agents nor tools touch the exchange directly.
  • Per-agent model selection: Each agent embeds its own model client, so different agents can use different LLMs with different providers.
  • Fan-out: Every agent independently receives every market-data update, with no replicated work.
  • Shared tools via ToolContext: A single deployed set of trading tools serves all agents — each tool resolves the calling agent's identity at runtime.
  • Dynamic agent accounts: Agents appear on the dashboard automatically on their first trade — no pre-registration needed.

Prerequisites

  • Python 3.10+
  • uv — fast Python package manager
  • Docker installed and running (in order to run a kafka broker)
  • An API key (and optionally base url) for your LLM provider

1. Install uv

If you don't have uv installed:

# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

# Or via Homebrew
brew install uv

After installation, restart your terminal.


2. Install the Calfkit SDK

Calfkit is the event-stream SDK that powers this project — it handles the agents' realtime stream consumption and orchestration. It's already a pinned dependency (calfkit>=0.12.6,<0.13 in pyproject.toml), installed along with everything else by uv sync in the Quickstart below.


3. Start the Broker

The broker orchestrates all nodes and enables realtime data streaming between all components.

Option A: Local broker setup (Docker required)

Run the following to clone the calfkit-broker repo and start a local Kafka broker container:

git clone https://github.com/calf-ai/calfkit-broker && cd calfkit-broker && make dev-up

Once the broker is ready, open a new terminal tab to continue with the quickstart. The default broker address is localhost:9092.

Option B: Calfkit cloud broker

There's also a cloud broker version so you can simply use the cloud broker URL (which would be provided to you) to deploy your agents instead of setting up and maintaining a broker locally.


Quickstart

Clone the repo and install dependencies:

git clone https://github.com/ryan-yuuu/crypto-trading-arena && cd crypto-trading-arena
uv sync

Add your LLM provider's API key:

cp .env.example .env      # then edit .env and set your provider's API key

Then launch each component in its own terminal. All components connect to the same broker (localhost:9092 for the local broker from step 3, or your cloud broker URL).


1. Start the exchange connector

Start either the Coinbase or Binance connector to stream live market data:

# Coinbase (default)
uv run python -m exchanges.coinbase --bootstrap-servers <broker-url>

# Or, Binance (experimental)
# uv run python -m exchanges.binance --bootstrap-servers <broker-url>

Optional: You can use the --min-interval <seconds> flag which controls how often agents are fed market data (default: 60s). Note that candle data is only updated every 60 seconds due to Coinbase API restrictions, so intervals below a minute mean agents will receive updated live pricing (bid/ask spread, ~5s granularity) but the same candle data.


2. Deploy tools & dashboard

uv run python -m deploy.tools_and_dashboard --bootstrap-servers <broker-url>

3. Deploy agents

Deploy an agent with an embedded model client and a trading strategy. Each agent runs its own LLM inference. See arena/strategies.py for the full system prompts.

# OpenAI model
uv run python -m deploy.agent \
    --name <unique-agent-name> --model-id <openai-model-id> \
    --strategy <strategy> --bootstrap-servers <broker-url>

# Or, any OpenAI-compatible provider (e.g. DeepInfra, OpenRouter, etc.)
# uv run python -m deploy.agent \
#     --name <unique-agent-name> --model-id <model-id> \
#     --base-url <llm-provider-base-url> --api-key <api-key> \
#     --strategy <strategy> --bootstrap-servers <broker-url>

# Or, load agent config from config.json
# uv run python -m deploy.agent \
#     --from-config <agent-name> --strategy <strategy> \
#     --bootstrap-servers <broker-url>

Once agents are deployed, market data flows to them and trades should hydrate the dashboard soon.


4. (Optional) Start the response viewer

A live dashboard that shows all agent activity, such as tool calls, text responses (agent reasoning), and tool results, as they happen.

uv run python -m deploy.response_viewer --bootstrap-servers <broker-url>

Data Recording

All trades and periodic portfolio snapshots are automatically saved to CSV files in the data/ directory. Each session produces two files:

  • trades_<timestamp>.csv — every executed trade with price, quantity, fee charged, and agent cash after settlement
  • snapshots_<timestamp>.csv — periodic portfolio state per agent, including positions, market values, unrealized and realized P&L, and cumulative fees paid

You can configure the snapshot interval and output directory:

uv run python -m deploy.tools_and_dashboard \
    --bootstrap-servers <broker-url> \
    --snapshot-interval <default-600-seconds> \
    --data-dir ./data

To disable recording entirely, pass --snapshot-interval 0.

For full column descriptions and examples, see docs/csv-data-recording.md.


CLI Reference & Config-Based Deployments

For full CLI flags, config-based deployment options, and the config schema, see CLI_REFERENCE.md.


Testing

The suite separates fast, deterministic tests from ones that need external resources:

# Fast unit + in-memory tests (what CI runs on every PR). No broker, no API key.
uv run pytest -m "not llm and not broker"

# Broker integration tests against a real Redpanda broker (needs Docker; a
# container is started automatically via testcontainers).
uv run pytest -m broker --run-broker

# Live LLM tests (needs OPENAI_API_KEY); a bare `uv run pytest` includes these.
uv run pytest -m llm

Markers: llm (live inference call) and broker (live Kafka-API broker, opt-in via --run-broker). CI (.github/workflows/ci.yml) runs lint, the non-LLM unit tests on Python 3.10–3.12, and the Redpanda broker job. Known-but-unfixed issues are tracked as strict xfails; see docs/REVIEW_FINDINGS.md.


Available Agent Tools

ToolDescription
execute_tradeBuy or sell a crypto product at the current market price. A configurable taker fee is charged on every fill (see trading.fees.taker_bps below)
get_portfolioView cash, open positions, cost basis (fee-inclusive), P&L, and average time held
calculatorEvaluate math expressions for position sizing, P&L calculations, etc.

Deployment Configurations

FileConstantDefaultDescription
arena/models.pyINITIAL_CASH100_000.0Starting cash balance per agent
exchanges/coinbase.pyDEFAULT_PRODUCTS3 productsCoinbase products tracked by the price feed
exchanges/binance.pyDEFAULT_SYMBOLS3 symbolsBinance symbols tracked by the price feed
config.jsontrading.fees.taker_bps60Taker fee in basis points charged on every simulated fill (both buys and sells). 60 ≈ Coinbase Advanced Trade base tier; 10 ≈ Binance global VIP 0; 40 ≈ Kraken Pro; 0 disables. Read by both the tools node (which charges the fee) and the price-feed connector (which advertises it to agents).

License

Apache-2.0.



Built on 🐮 calfkit — the SDK for highly-connected, event-driven, and scalable agents.
Building your own multi-agent system? Start with the calfkit quickstart · ⭐ star the repo

常见问题

What is crypto-trading-arena?

crypto-trading-arena is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by ryan-yuuu. The open source trading arena. It has 111 GitHub stars.

Is crypto-trading-arena safe to use?

Yes. crypto-trading-arena passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install crypto-trading-arena?

Clone the repository with "git clone https://github.com/ryan-yuuu/crypto-trading-arena" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is crypto-trading-arena written in?

crypto-trading-arena is primarily written in Python. It is open-source under ryan-yuuu on GitHub, so you can review or fork the full source.

Are there alternatives to crypto-trading-arena?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh crypto-trading-arena against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情