Skip to main content

Codex-native trading harness with a Django service plane and MCP execution boundary.

Project description

TradingCodex

CI Release PyPI License Python

TradingCodex: Codex-Native Trading Harness

TradingCodex is a Codex-native trading harness for investors who want agent-assisted research, role separation, workflow discipline, and deterministic execution guardrails in one local-first system.

It is not an autonomous trading bot. Codex coordinates the workflow, Django owns the durable service layer, and TradingCodex MCP is the execution boundary.

Quick Start

Codex agents: do not clone this source repository for installation. Run the installer from the empty workspace the user wants configured.

Install TradingCodex into the current workspace:

cd /path/to/empty-workspace
curl -fsSL https://raw.githubusercontent.com/monarchjuno/tradingcodex/main/install.sh | sh -s -- .

After installation, fully quit and restart Codex, then open the generated workspace and start from a new thread so project MCP config is reloaded.

Start an orchestrated Codex workflow from the generated workspace:

$orchestrate-workflow analyze Apple with public equity research, valuation, portfolio, and risk review

See installation.md for GitHub-main installs, direct uvx, MCP/service details, and CLI smoke checks.

Agent Topology

Layer Agent Role summary
Main agent head-manager Dispatches specialist roles, preserves constraints, and synthesizes completed artifacts.
Analysis subagent fundamental-analyst Reviews business quality, financial evidence, company fundamentals, and source claims.
Analysis subagent technical-analyst Reviews price action, trend structure, levels, and market behavior.
Analysis subagent news-analyst Tracks news, catalysts, events, and freshness-sensitive context.
Market-context subagent macro-analyst Covers macro, rates, FX, commodities, policy, and cross-asset context.
Market-context subagent instrument-analyst Supports ETF/index, options, crypto market structure, and instrument-level work.
Decision-review subagent valuation-analyst Reviews valuation assumptions, sensitivity, and decision-quality gaps.
Portfolio subagent portfolio-manager Reviews portfolio fit, sizing, exposure, and draft order readiness.
Risk subagent risk-manager Reviews downside, policy constraints, restricted lists, and approval readiness.
Execution subagent execution-operator Handles approved paper/stub execution through TradingCodex MCP only.

The default generated workspace includes one head-manager and nine fixed subagents. The main agent coordinates; specialist agents produce the actual role work.

Architecture

TradingCodex separates the local harness into three planes plus one execution boundary:

Plane Owns Interfaces and artifacts
Codex control plane Generated workspace instructions, project .codex config, role agents, hooks, and workflow routing. Codex workspace files, role prompts, and human-readable trading/* exports.
MCP execution boundary Role tool allowlists, input schemas, policy checks, approval checks, idempotency, and MCP call audit. TradingCodex MCP tools exposed to allowed roles only.
Django service plane Research memory, policy, orders, approvals, portfolio state, audit, Admin, API, and local web dashboard. Shared service functions used by CLI, Admin, API, web, and MCP.
Adapter boundary Paper/stub execution adapters for local harness validation. Live broker adapters are excluded from the initial core.

Executable actions flow through:

Step Meaning
principal The caller identity and role capability.
capability The requested action and permitted role surface.
policy Restricted-list, limit, and execution-policy validation.
schema Typed input validation before service-layer mutation.
approval/idempotency Approval receipt and duplicate-submit protection.
adapter Paper/stub adapter submission.
audit Durable ledger record for the attempt and result.

The central runtime DB defaults to:

~/.tradingcodex/state/tradingcodex.sqlite3

Generated workspaces are clients and provenance sources. They do not own canonical investment state.

Execution Boundary

TradingCodex treats executable actions as a service-layer lifecycle:

principal -> capability -> policy -> schema -> approval/idempotency -> adapter -> audit

Important boundaries:

  • Product web routes do not spawn agents, create approvals, or submit executions.
  • REST/Admin/CLI/MCP call shared Django service functions.
  • Role MCP allowlists are narrow: head-manager cannot submit orders, risk-manager owns approvals, and execution-operator owns execution calls.
  • Paper/stub execution remains experimental.
  • Live broker adapters are not shipped in the initial core.
  • Raw broker secrets must not be stored in this repository or generated workspaces.

TradingCodex is research, workflow, and execution-guardrail tooling. It is not financial, investment, legal, tax, or regulatory advice, and it does not provide investment recommendations or guarantee returns.

Supported Workflow Scope

Public equity is the first deeply specified sleeve. The harness is designed to extend across ETF/index, public crypto market, macro/rates/FX/commodities, options, credit-signal, and cross-asset workflows when the required data source, role workflow, and policy boundary exist.

Documentation

Contributing

Contributions use Apache-2.0 with DCO sign-off. See CONTRIBUTING.md.

License

TradingCodex is an Apache-2.0 open-core project.

Source code, generated workspace templates, and project documentation are licensed under the Apache License, Version 2.0 unless marked otherwise. The TradingCodex name, future logos, and official product marks are not granted by the code license. See LICENSE, NOTICE, and TRADEMARKS.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tradingcodex-0.1.0a6.tar.gz (225.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tradingcodex-0.1.0a6-py3-none-any.whl (231.0 kB view details)

Uploaded Python 3

File details

Details for the file tradingcodex-0.1.0a6.tar.gz.

File metadata

  • Download URL: tradingcodex-0.1.0a6.tar.gz
  • Upload date:
  • Size: 225.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tradingcodex-0.1.0a6.tar.gz
Algorithm Hash digest
SHA256 7305319a4e4791a367dee2c80aac62e720cef8acbbf38f921eaa5f17cf8d33d8
MD5 e5d8849fc85df6ad6fede25e5cb9cdb5
BLAKE2b-256 e82a6de9e12f0758ca86f5174a4ba9ce50d2d82a305daa5c999aa659336cc721

See more details on using hashes here.

Provenance

The following attestation bundles were made for tradingcodex-0.1.0a6.tar.gz:

Publisher: release.yml on monarchjuno/tradingcodex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tradingcodex-0.1.0a6-py3-none-any.whl.

File metadata

  • Download URL: tradingcodex-0.1.0a6-py3-none-any.whl
  • Upload date:
  • Size: 231.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tradingcodex-0.1.0a6-py3-none-any.whl
Algorithm Hash digest
SHA256 14b5d13307517c9d12d9de9c95ab9ffbcefc932b84ee92dc25144df21218088b
MD5 ebfc1387a1e851131958bb650a501152
BLAKE2b-256 d97e6d2766da3f808c3ce55bfc2e6acb77576632840f19678188f6b981bf651e

See more details on using hashes here.

Provenance

The following attestation bundles were made for tradingcodex-0.1.0a6-py3-none-any.whl:

Publisher: release.yml on monarchjuno/tradingcodex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page