Back to all articles
Product EngineeringJun 9, 2026

Building an AI Trading Operator with Claude and Mintzy

M
Content and media team | Mintzy
10 min read
Building an AI Trading Operator with Claude and Mintzy

Most traders use AI the same way they use search engines: they ask questions, receive answers, and then make decisions themselves. While that approach improves research, it does not fundamentally change the trading workflow. The trader still needs to monitor markets, evaluate opportunities, manage risk, place orders, and keep track of positions.

The real opportunity emerges when AI stops being a research assistant and starts becoming an operator.

This is where Claude and Mintzy work together: Mintzy provides the intelligence layer, while Claude becomes the operational layer.

1. Architectural Blueprint

The workflow begins with Mintzy APIs continuously generating forecasting intelligence across a selected universe of assets. Instead of manually scanning charts and indicators, the system receives structured predictions, confidence signals, and market forecasts directly from the forecasting engine.

But prediction alone is not enough. A good trading system needs rules, and this is where Claude enters the workflow. Using a predefined framework, Claude continuously evaluates incoming forecasts, applies risk management constraints, filters weak opportunities, respects position limits, and determines whether a signal deserves capital allocation.

System Core Responsibilities:
  • Mintzy answers: "What does the market intelligence suggest?"
  • Claude answers: "Given our systematic rules, what should be done with that information?"

2. Production Project Layout

A clean, modular layout maps isolated responsibilities to dedicated files, ensuring that secrets stay out of version control and the execution logic remains highly maintainable:

trading-bot/
├── .env                 # Encrypted credentials (API Keys, Secrets) - NEVER COMMITTED
├── CLAUDE.md            # Execution manual and developer instructions for Claude Code
├── main.py              # Main execution loops and runtime orchestration
├── minting_client.py    # Interfaces with the Mintzy API to pull 30-minute forecasts
├── risk_manager.py      # Core logic gate: Filters weak signals and checks capital limits
├── trade_executor.py    # Interacts with broker infrastructure (e.g., Zerodha Kite Connect)
└── state.json           # Tracks open positions and real-time capital deployment metrics

3. The 6-Stage Operational Workflow

Rather than blindly executing every prediction, the framework operates inside a strict multi-layer execution loop:

[1. INTEL GENERATION] -> [2. RULE EVALUATION] -> [3. RISK GATE CONTROLS]
       (Mintzy API)            (Claude Logic)           (Position Sizing)
                                                                |
                                                                v
[6. SYSTEM REPEAT]   <- [5. AUDIT & TRACKING] <- [4. BROKER EXECUTION]
  (Next Intercept)         (Update state.json)       (Exchange Order)
  • Intelligence Generation: Mintzy generates directional price forecasts across selected assets and intervals.
  • Rule Evaluation: Claude retrieves those forecasts and evaluates them against predefined trading criteria.
  • Risk Gate Controls: Strict position sizing, capital limits, exposure thresholds, and directional filters are applied via code.
  • Broker Order Routing: Validated opportunities are seamlessly translated into exchange orders via broker APIs.
  • State & Audit Tracking: Every single action updates state.json automatically, leaving a transparent audit trail.
  • Continuous Intercept Loop: The workflow triggers at set intervals throughout market hours without human intervention.

4. Production Implementation

Step A: Fetching Market Intelligence (minting_client.py)

This component interfaces with the external analytical gateway to poll directional targets securely.

import os
import requests

def get_predictions(ticker: str) -> dict | None:
    """Fetches high-probability closing predictions from Mintzy API."""
    api_url = f"https://api.mintzy.ai/v1/predict?ticker={ticker}"
    headers = {"Authorization": f"Bearer {os.getenv('MINTZY_API_KEY')}"}
    
    try:
        response = requests.get(api_url, headers=headers, timeout=10)
        if response.status_code == 200:
            return response.json()
    except Exception as e:
        print(f"Error communicating with Mintzy intelligence layer: {e}")
    return None

Step B: The Operational Logic Gate (risk_manager.py)

This file translates your trading instructions into conditional execution parameters. If the incoming forecast does not satisfy the criteria, it is dropped immediately.

def filter_signals(prediction: dict, open_positions: dict, config: dict) -> dict | None:
    """Claude Operator Logic: Evaluates data against strict structural boundaries."""
    change_pct = prediction.get("change_pct", 0.0)
    confidence = prediction.get("confidence", 0.0)
    ticker = prediction.get("ticker")
    
    # 1. Take Threshold Check
    if abs(change_pct) < config["TAKE_THRESHOLD"]:
        return None
        
    # 2. Open Risk Checks
    if ticker in open_positions:
        return None
        
    if len(open_positions) >= config["MAX_TRADES_PER_DAY"]:
        return None

    # Formulate structural order details
    action = "BUY" if change_pct > 0 else "SELL"
    allocated_qty = calculate_position_size(config["VAL_CAPITAL_BASE"])
    
    return {"ticker": ticker, "action": action, "qty": allocated_qty, "change_pct": change_pct}

Step C: Exchange Execution Interface (trade_executor.py)

Once an execution ticket clears the risk gate, it is converted into active payloads for the broker infrastructure.

import os
import logging
from kiteconnect import KiteConnect

DRY_RUN = os.getenv("DRY_RUN", "true").lower() == "true"

def _get_broker():
    """Authenticates exchange-level connection."""
    kite = KiteConnect(api_key=os.getenv("ZERODHA_API_KEY"))
    kite.set_access_token(os.getenv("ZERODHA_ACCESS_TOKEN"))
    return kite

def place_order(signal: dict) -> str | None:
    """Routes execution instructions securely to broker infrastructure."""
    log_line = f"{signal['action']} {signal['qty']} shares of {signal['ticker']} @ target gap {signal['change_pct']:+.2f}%"
    
    if DRY_RUN:
        logging.info(f"[DRY RUN TRIGGERED] {log_line}")
        print(f" [DRY RUN OPERATING] {log_line}")
        return "DRY_RUN_SUCCESS"
        
    try:
        broker = _get_broker()
        order_id = broker.place_order(
            tradingsymbol=signal["ticker"],
            transaction_type=broker.TRANSACTION_TYPE_BUY if signal["action"] == "BUY" else broker.TRANSACTION_TYPE_SELL,
            quantity=signal["qty"],
            order_type=broker.ORDER_TYPE_MARKET,
            product=broker.PRODUCT_MIS
        )
        return order_id
    except Exception as e:
        logging.error(f"Execution failed for {signal['ticker']}: {e}")
        return None

Conclusion: The Connected Intelligence Standard

The result of this integration is a structured decision-making framework where forecasting, reasoning, risk controls, and automated accounting execute together inside a unified workflow.

The future of systematic trading belongs to connected layers: Mintzy provides the analytical intelligence, and Claude operates the framework. Together, they create a highly consistent execution lifecycle, operating session after session.

Building an AI Trading Operator with Claude and Mintzy | Mintzy