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.0a7.tar.gz (226.7 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.0a7-py3-none-any.whl (231.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tradingcodex-0.1.0a7.tar.gz
  • Upload date:
  • Size: 226.7 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.0a7.tar.gz
Algorithm Hash digest
SHA256 20b02d5839e06623ab75653bd3c306e4805953b1a4362cb43e68c16ed3e34acb
MD5 459caf7aeb0b8e5c6c8b786d6875cbae
BLAKE2b-256 60dafaf464f010be7fc4e1680f7768a61a8d6d567a8b02619db56e6047625cee

See more details on using hashes here.

Provenance

The following attestation bundles were made for tradingcodex-0.1.0a7.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.0a7-py3-none-any.whl.

File metadata

  • Download URL: tradingcodex-0.1.0a7-py3-none-any.whl
  • Upload date:
  • Size: 231.5 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.0a7-py3-none-any.whl
Algorithm Hash digest
SHA256 cc895461ea7e726d7f83552dab810765d47d4772f5f5989ddad5ad4ac1ab0bc8
MD5 975f2b5488e6ba8d0a58395b7764186b
BLAKE2b-256 17a550028f38bb621c06c4197b625cd273fcd8e5e7bacc6c45a7db078b8dd23b

See more details on using hashes here.

Provenance

The following attestation bundles were made for tradingcodex-0.1.0a7-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