TRA (trading research agents) is an open-source cryptocurrency trading desk published on PyPI under the package name bitra, which users can run locally themselves. It reads market data, makes a single decision, calculates round-trip costs, validates against user-declared constraints, and then records the decision or sends an order with a stop-loss attached. Decisions can come from user-defined rule files (no model required) or be suggested by a language model; however, all numerical calculations, constraint application, position sizing, and order sending are performed by the system without involving the model. Every decision and rejection is saved to disk along with the reason.
Main capabilities:
- A unified order path to all exchanges via ccxt, supporting linear perpetual contracts (USDT or USDC margin), spot pairs (long-only), stock perpetuals and tokenized stocks, and prediction market outcomes.
- Arena feature: replay arbitrary rules over multi-year data (deducting user-defined costs) and compare against buy-and-hold and random benchmarks.
- Typed judge: reads the day's headlines and can block entries on adverse events.
- Records all decisions and rejections along with their reasons for later verification.
- Supports two modes: rule desk (no model key required) and agent desk (model key required).
- Provides console, script, and cron run modes, with --plain or --json output.
- Supports multiple model providers (Anthropic, OpenAI, Google, etc.), with each provider reading its key from environment variables or a .env file.
- Provides a research path for backtesting, paper trading, and live canary sessions.
Usage:
- Install: requires Python 3.11 or newer. Install with uv:
uv pip install 'bitra[ccxt,anthropic,openai,google,data]', or run in a virtual environmentpip install 'bitra[ccxt,anthropic,openai,google,data]'. - Create a trading desk:
tra initcreates a folder containing settings and decision records; you can use--venue okxto specify the exchange (default is Bybit). - The rule desk requires declaring the rule's average net return in [strategy].edge_bps (from your own arena run); the agent desk requires copying .env.example to .env and setting the model key.
- Check:
tra checkreads all settings and points out the next issue that needs fixing. - Run:
tra runmakes one decision based on live market data in a sandbox (without leaving the local machine);tra run --every 1dmakes one decision at market close each day; or simply entertrato enter the console. - Exchange execution: use
--venueCreate a trading desk, then enable execution with three commands. You must first read and sign the authorization letter (tra mandate --sign "Your Name"). Signing alone does not enable any functionality;--venue-modewill both sign and enable orders.
Use cases:
- Research, backtesting, and paper trading of cryptocurrency trading strategies.
- Testing trading rules or trading suggestions proposed by language models in a sandbox environment.
- Unified order management across multiple exchanges via ccxt.
- Auditable recording and verification of trading decisions.
Limitations:
- The project is experimental; settings may change between versions.
- The author has never run it with real funds.
- No profitable strategy is included.
- Live mode (venue mode) is the only mode in which losses are possible and requires signing the authorization letter.
- Some features (such as the rules desk and event guard) exist only on the develop branch and have not been released.
- When the trading desk is not running, open positions are protected only by exchange-side stop-loss and take-profit; running under a supervisor is recommended.
- Dated futures, inverse contracts, and options are still under development; the system will reject orders for these market types.
- The model cannot place, cancel, or resize orders, nor can it read files outside the project or edit configuration.
- Each provider's free tier is metered per model; unless a cap is declared, spending is not limited.