Metadata-Version: 2.4
Name: useopentrade
Version: 0.1.2
Summary: OpenTrade: crypto research, agent bundles, and runtime control
Requires-Python: <3.14,>=3.10
Description-Content-Type: text/markdown
Requires-Dist: langchain-core>=0.3.81
Requires-Dist: langchain-anthropic>=0.3.15
Requires-Dist: langchain-google-genai>=2.1.5
Requires-Dist: langchain-openai>=0.3.23
Requires-Dist: langgraph>=0.4.8
Requires-Dist: pandas>=2.3.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: ta>=0.11.0
Requires-Dist: rank-bm25>=0.2.2
Requires-Dist: fastapi>=0.115.0
Requires-Dist: uvicorn>=0.32.0
Requires-Dist: sse-starlette>=2.1.0
Requires-Dist: pydantic>=2.9.0
Requires-Dist: tradingview-ta>=3.3.0
Requires-Dist: feedparser>=6.0.0
Requires-Dist: fastmcp>=2.0.0
Requires-Dist: redis>=5.0.0
Requires-Dist: asyncpg>=0.29
Requires-Dist: psycopg[binary,pool]>=3.1
Requires-Dist: docker>=7.1.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: rich>=14.0.0
Requires-Dist: typer>=0.9
Requires-Dist: typing-extensions>=4.14.0
Requires-Dist: open-wallet-standard
Requires-Dist: scipy>=1.15.3
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.24.0; extra == "dev"
Requires-Dist: pytest-rerunfailures>=14.0; extra == "dev"
Provides-Extra: test
Requires-Dist: testcontainers[postgres]>=4.8.0; extra == "test"
Provides-Extra: live
Requires-Dist: hyperliquid-python-sdk>=0.24.0; extra == "live"
Requires-Dist: eth-account>=0.13.0; extra == "live"
Provides-Extra: cli

# OpenTrade

Automated crypto research and market intelligence for traders and analysts.

OpenTrade helps you scan the market, run deep diligence on any token, turn fragmented crypto data into portfolio-ready investment memos, and deploy a live agent. Use it to research a single asset, build thesis-driven screens, compare relative-value trades, or construct custom portfolios.

## What You Can Do

- **Research any token** — generate an institutional-style memo with fundamentals, technicals, news, sentiment, risks, catalysts, and a trade plan.
- **Scan the market** — find deep value, cashflow yield, AI exposure, momentum breakouts, oversold quality, or unlock-short candidates.
- **Build custom portfolios** — create baskets by asset class, sector, theme, valuation, liquidity, or risk profile.
- **Compare relative value** — use category and competitor analysis to frame pair trades or long/short ideas.
- **Track thesis changes** — rerun research or add follow-up analysis when governance, tokenomics, news, or market structure changes.
- **Audit the reasoning** — inspect analyst reports, scoring, debate, risk review, and final portfolio-manager memo.
- **Deploy an agent** — validate a portfolio and its guardrails, then run it in paper or live mode with explicit controls around live capital.

## How It Works

OpenTrade mirrors an institutional trading desk with specialized AI agents working in sequence:

```
ANALYST TEAM → RESEARCHER DEBATE → TRADER → RISK ANALYSIS → INVESTMENT MEMO
```

**Phase 1 — Analyst Team** (4 default agents, each with crypto-specific tools)
- **Fundamentals Analyst** — Market cap vs FDV, TVL, protocol revenue, on-chain valuation (MVRV, NVT), value accrual, fee switch/buyback/burn mechanics, token dilution, and competitive positioning
- **Technical Analyst** — Murphy-methodology top-down analysis: Dow Theory trend structure, MA crossovers (golden/death cross), swing-based S/R, Fibonacci retracements, RSI/MACD divergence detection, volume confirmation, plus standard indicators (RSI, MACD, Bollinger Bands, ATR, ADX, Stochastic RSI)
- **News Analyst** — Protocol upgrades, security incidents, hack history, governance proposals (full Discourse content)
- **Sentiment Analyst** — Crypto Twitter discourse, community metrics, developer activity (GitHub + Electric Capital)

**Phase 2 — Researcher Debate** (adversarial)
- **Bull Researcher** — Network effects, token utility, growth catalysts
- **Bear Researcher** — Smart contract risk, dilution, regulatory risk, centralization
- Debate runs 1-3 rounds, then **Research Manager** synthesizes

**Phase 3 — Trading Decision**
- **Trader Agent** — Synthesizes all inputs into a recommendation

**Phase 4 — Risk Analysis** (3-way debate)
- **Aggressive**, **Conservative**, and **Neutral** risk analysts debate the trader's recommendation

**Phase 5 — Investment Memo**
- **Portfolio Manager** — Final structured output modeled on institutional research standards (10 sections, conviction scoring, trade plan with entry/target/stop)

**Scanner Mode** — Before running full memos, use YAML-defined screens in `screens/` via `scripts/run_screen.py` or the `opentrade-scanner` skill to find candidates such as deep value, oversold quality, statistical mean reversion, cashflow yield, AI exposure, momentum breakouts, or unlock shorts. Scanner output includes ranked candidates and ready-to-run research commands.

**Agent Deployment** — Validate the portfolio, strategy, and guardrails before pushing an agent. Live deployment requires explicit approval, venue credentials added through the OpenTrade dashboard, and passing live safety checks.

## Data Sources

| Source | Data | Access |
|--------|------|--------|
| [CoinGecko](https://www.coingecko.com/) | Price, OHLCV, market cap, supply, community metrics | Managed beta connector |
| [DefiLlama](https://defillama.com/) | TVL, protocol revenue, fees, DEX volume, stablecoin TVL, hacks | Managed beta connector |
| [CoinMetrics](https://coinmetrics.io/) | Network data, active addresses, transaction count, market cap, supply | Managed community connector |
| [Tavily](https://tavily.com/) | Web search for news, security incidents, tokenomics, and competitive context | Managed beta connector |
| [Token Terminal](https://tokenterminal.com/) | Financial metrics, revenue, fees, users, statements | Optional self-hosted connector |
| [Tokenomist](https://tokenomist.ai/) | Unlocks, emissions, allocations, buyback/burn | Optional self-hosted connector |
| [Nansen](https://www.nansen.ai/) | Smart money signals (accumulation/distribution) | Optional self-hosted connector |
| [Electric Capital](https://github.com/electric-capital/crypto-ecosystems) | Ecosystem developer metrics | Open dataset |
| [ta](https://github.com/bukosabino/ta) | Technical indicators | Computed locally |
| Governance Forums | Full Discourse topic content | Public APIs |

## Quickstart

### 1. Install OpenTrade

Install the CLI and OpenTrade skills:

```bash
pipx install useopentrade
opentrade setup install-skills
opentrade setup check
opentrade login
```

`opentrade login` connects the CLI and MCP server to your OpenTrade dashboard
account. You can also paste the following into Claude Code, Codex, or Cursor to
have your agent complete setup:

```text
Set up https://opentrade.money/setup.md
```

See **[SETUP.md](docs/SETUP.md)** for MCP registration, manual installation,
and troubleshooting.

### 2. Research an asset or scan the market

Run a full research memo:

```bash
opentrade research bitcoin --depth standard --output ./bitcoin-memo.md
```

Or scan the supported universe before choosing what to research:

```bash
opentrade scan --max-tokens 20
```

For thesis-driven work, use guided mode:

```bash
opentrade guided "Find deep-value crypto assets with active development" --confirm
```

### 3. Use the hosted API and deploy an agent

The CLI calls the hosted OpenTrade API by default. When you have a reviewed
`portfolio_decision.json` and `guardrails.json`, validate them and create an
Agent Bundle:

```bash
opentrade portfolio validate ./portfolio_decision.json --require-stops
opentrade bundle create \
  --name my-agent \
  --portfolio ./portfolio_decision.json \
  --guardrails ./guardrails.json \
  --output ./agent_bundle
```

Review the generated strategy before approving and deploying it:

```bash
cat ./agent_bundle/strategy.md
opentrade bundle approve-strategy ./agent_bundle
opentrade bundle validate ./agent_bundle
opentrade agent push --bundle ./agent_bundle --mode live
```

Live deployment requires explicit approval, credentials stored through the
dashboard, policy checks, reconciliation, audit logging, and tested emergency
controls. Use `--mode paper` to deploy with virtual capital instead.

### Local API development

You only need to run the API server when developing or self-hosting OpenTrade:

```bash
uvicorn api.main:app --reload --port 8000
OPENTRADE_API_URL=http://localhost:8000 opentrade research bitcoin
```

## Project Structure

```
opentrade/
├── skills/                    # Codex, Claude Code, and compatible agent skills
├── research/
│   ├── agents/                # Analyst, debate, risk, and portfolio-manager pipeline
│   ├── dataflows/             # Market, on-chain, news, and developer data
│   ├── graph/                 # Research orchestration
│   ├── planning/              # Guided workflow planning
│   ├── bundles/               # Agent Bundle creation and validation
│   └── runtime/               # Paper and guarded-live execution
├── cli/                       # `opentrade` command-line interface
├── api/                       # FastAPI, control plane, runtime routes, and MCP server
├── app/                       # Next.js routes and product pages
├── components/                # Product and marketing UI
├── screens/                   # YAML-defined market screens
├── scripts/                   # Research and screening utilities
└── tests/
```

## License

This project is a fork of [TradingAgents](https://github.com/TauricResearch/TradingAgents), licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).

---

*This software is for research purposes only and does not constitute financial or investment advice.*
