API Reference
Trading Tools v2

Trading Tools v2

Codebase: /opt/tradingtools-v2 Architecture: pnpm monorepo — packages/ (ingest, confirm, executor, enrichment, tpsl, perfmon, router, shared) + apps/control-api

Trading Tools v2 is a headless internal system and the production copy-trading engine (since the 2026-05-31 cutover, replacing /opt/copytrading). There is no public-facing API — all user interaction goes through the Insiders backend as a proxy.


Architecture overview

PackageRole
packages/ingestTrade event ingestion from Polymarket (also runs bookfeed → mark.prices)
packages/enrichmentRead-only ClickHouse → Redis cache builder
packages/executorExecutes copy trades on behalf of followers
packages/confirmConfirms trade execution on-chain
packages/tpsl (GUARD)Manages TP/SL triggers on positions
packages/perfmonSession PnL monitoring, auto-pause
packages/routerRoutes events between packages
packages/sharedShared types, DB client, utils
apps/control-apiHTTP control surface :9110

control-api · :9110

Source: /opt/tradingtools-v2/apps/control-api/src/index.ts

Exposed at tradingv2.polyinsiders.com (nginx enabled 2026-06-01), token-gated with a shared Authorization: Bearer <CONTROL_API_TOKEN>. All routes documented in detail under:

Quick reference

MethodPathCategory
POST/subscriptionsSubscription
GET/subscriptions?followerProxy=0x…Subscription
GET/subscriptions/:idSubscription
GET/subscriptions/:id/fillsSubscription
PATCH/subscriptions/:idSubscription
POST/subscriptions/:id/pauseSubscription
POST/subscriptions/:id/resumeSubscription
DELETE/subscriptions/:idSubscription
POST/subscriptions/fundingInternal
POST/subscriptions/:id/perf-actionInternal
POST/triggersTPSL (GUARD)
PATCH/triggers/:idTPSL (GUARD)
DELETE/triggers/:idTPSL (GUARD)
GET/triggers?wallet=0x…TPSL (GUARD)
GET/triggers/:idTPSL (GUARD)
GET/healthInfra
GET/readyInfra

Database

Schema: /opt/tradingtools-v2/db/schema.prisma Engine: PostgreSQL · Job queue: BullMQ + Redis


Key docs in codebase

FileContents
docs/control_api_wire_spec_v1.mdFull wire-true API spec (captured live 2026-05-30)
docs/tpsl_control_api_v1.mdGUARD TPSL full schema
docs/exec_handover_2026-05-29.mdExecutor handover notes
docs/v1_subs_migration_plan_v1.mdV1→V2 subscription migration plan
docs/insiders_api_shapes.mdInsiders API request/response shapes
TRADINGTOOLS_V2_ARCHITECTURE.mdSystem architecture overview