AAPICODE.IO
Projects & Case StudiesAdvanced 9 min readUpdated 2026-04

Market App: Serverless Financial Intelligence Platform

A clean rebuild of a market-alerts, pairs, quant, and autotrading platform into Lambda zip APIs behind API Gateway and CloudFront, with AI-assisted planning and auditable Alpaca execution.

AWSTerraformLambdaCloudFrontDynamoDBAlpacaAI-assisted SDLC

Why this project matters

Market App is the current financial.apicode.io rebuild: a financial intelligence and automation platform with alerts, pair strategies, quantitative backtests, and webhook-driven autotrading. The goal is to make the platform simpler to operate, easier to audit, and safer to evolve.

Clean rebuild direction

  • Retire ECR and Fargate for the four backend services.
  • Deploy alerts, pairs, quant, and autotrading as arm64 Lambda zip functions behind API Gateway.
  • Serve the React SPA from S3 through CloudFront on financial.apicode.io.
  • Route /api/alerts, /api/pairs, /api/quant, and /api/autotrading through CloudFront behaviors.
  • Use DynamoDB orders as the auditable autotrading order log.
  • Use Alpaca REST for cloud execution, while keeping IB Gateway experiments local-only.

Target architecture

flowchart LR
    Internet --> CF["CloudFront financial.apicode.io"]
    CF --> S3["S3 SPA bucket"]
    CF --> AlertsApi["API Gateway alerts"]
    CF --> PairsApi["API Gateway pairs"]
    CF --> QuantApi["API Gateway quant"]
    CF --> AutoApi["API Gateway autotrading"]
    AlertsApi --> AlertsLambda["Lambda alerts-prod"]
    PairsApi --> PairsLambda["Lambda pairs-prod"]
    QuantApi --> QuantLambda["Lambda quant-prod"]
    AutoApi --> AutoLambda["Lambda autotrading-prod"]
    AutoLambda --> Orders[("DynamoDB orders")]
    AutoLambda --> Alpaca["Alpaca REST API"]

Autotrading design

The cloud version intentionally avoids long-lived TCP sessions to IB Gateway. A TradingView webhook validates X-Webhook-Secret against SSM, parses the signal, writes the request to DynamoDB, submits via Alpaca paper trading, and records the resulting order state for auditability.

How AI is used in the project

  • Architecture comparison: AI helped evaluate Fargate, Lambda image, and Lambda zip tradeoffs, then converge on the lowest-maintenance path.
  • Blast-radius planning: AI helped identify what to destroy and rebuild, and what to explicitly leave untouched, including APICODE.IO hosting, Terraform bootstrap state, and local IB experiments.
  • Refactoring acceleration: AI assisted the conversion from container/FastAPI-style services to API Gateway v2 Lambda handlers.
  • Deployment safety: AI helped generate reverse-order destroy steps, forward apply sequencing, smoke tests, and rollback-friendly verification commands.
  • Documentation: AI produced operator-ready notes that separate secrets handling, KMS rotation, ACM validation, and API smoke gates.

Engineering principles demonstrated

  • Prefer boring, auditable infrastructure over clever runtime complexity.
  • Use DynamoDB as the system of record for order intent and execution state.
  • Keep trading disabled by default and start with Alpaca paper execution.
  • Make advanced quant strategies explicit when they are not suitable for the Lambda zip runtime.
  • Use Terraform stacks as deployment boundaries and smoke-test each layer before moving forward.
Modernization note

Added as a current APICODE.IO project spotlight showing how AI is used as an engineering accelerator for architecture, refactoring, deployment planning, and smoke-test design.