Developer

Task examples

Full lifecycles against https://forkmyalpha.com/api/engine in curl and python. Reads are public; writes need Authorization: Bearer sk_live_... sk_live_YOUR_KEY is a placeholder, so generate a real key first. Steps that decide or apply basket changes act on the platform's own bots and need the admin/owner role; they are marked. The complete endpoint list is on the live reference.

Import a Pine script

key required

Analyze a Pine v5-subset indicator, preview it through the platform's honest backtest, and register it as a content-addressed pine_v1 genome. Your script decides entries and exits; the harness prices them — Pine strategy.* orders are never simulated. Registered Pine genomes can be backtested and Gauntlet-verified; they cannot run live.

BASE=https://forkmyalpha.com/api/engine
KEY=sk_live_YOUR_KEY   # placeholder — generate a real key in the portal

# Keep the script in a file; jq turns it into a JSON string.
SCRIPT=$(jq -Rs . < my_indicator.pine)

# 1) Analyze: what inputs and plots does the script expose?
curl -s -X POST "$BASE/api/pine/analyze" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d "{\"script_text\": $SCRIPT}"

# 2) Preview through the honest backtest. You map which plots mean
#    enter/exit — Pine strategy.* orders are never simulated.
curl -s -X POST "$BASE/api/pine/preview" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"script_text\": $SCRIPT,
    \"inputs\": {},
    \"mapping\": {
      \"enter_long\": {\"source\": \"plot\", \"id\": \"plot_0\"},
      \"exit_long\":  {\"source\": \"plot\", \"id\": \"plot_1\"}
    },
    \"ticker\": \"GME\"
  }"

# 3) Register as a content-addressed pine_v1 genome
#    (backtest/verify only — a registered Pine genome can never run live)
curl -s -X POST "$BASE/api/pine/register" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"script_text\": $SCRIPT,
    \"inputs\": {},
    \"mapping\": {
      \"enter_long\": {\"source\": \"plot\", \"id\": \"plot_0\"},
      \"exit_long\":  {\"source\": \"plot\", \"id\": \"plot_1\"}
    },
    \"name\": \"my-indicator\"
  }"

Deep-vet a candidate

key required

Queue a full-history backtest with a train/out-of-sample split for any ticker, poll until it finishes, and read the grade from the nightly discovery snapshot. The kickoff is a write; both status polls and the snapshot are public reads.

BASE=https://forkmyalpha.com/api/engine
KEY=sk_live_YOUR_KEY

# Kick off a deep vet: full-history backtest with a train/OOS split
curl -s -X POST "$BASE/api/discovery/deep-vet" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"ticker": "AMD"}'

# Poll until it finishes (status: running | done | error) — public read
curl -s "$BASE/api/discovery/deep-vet-status?ticker=AMD"

# The result (grade, score) lands in the discovery snapshot — public read
curl -s "$BASE/api/discovery/candidates"

Propose a basket change

key requiredadmin/owner steps

Proposals never change a live basket by themselves: anyone with a key can propose, but the decision and the mark-applied confirmation are owner intents — those two calls require the admin/owner role and will 403 otherwise.

BASE=https://forkmyalpha.com/api/engine
KEY=sk_live_YOUR_KEY

# The snapshot names the bot that takes proposals (proposal_bot_id)
curl -s "$BASE/api/discovery/candidates"

# 1) Propose an add (any active key). Nothing changes a live basket
#    here — a proposal is a request for an owner decision.
curl -s -X POST "$BASE/api/discovery/proposals" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"bot_id": "YOUR_BOT_ID", "action": "add", "ticker": "AMD", "rationale": "OOS PF and fresh deep vet"}'

# New proposal ids appear in the snapshot's proposals array
# (status PROPOSED). The next two steps need the admin/owner role.

# 2) Decide — ADMIN/OWNER ONLY
curl -s -X POST "$BASE/api/discovery/proposals/42/decision" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"approved": true, "note": "adds diversification, vet is fresh"}'

# 3) After the bot config really changed, mark it applied — ADMIN/OWNER ONLY
curl -s -X POST "$BASE/api/discovery/proposals/42/mark-applied" \
  -H "Authorization: Bearer $KEY"

Compile a verified genome to a node bundle

key required

Turn a VERIFIED genome into a self-host bundle: a config that references the genome by hash, an .env.example with credential placeholders, and a docker-compose. Verification is the product — unverified genomes are refused, and broker keys never touch the platform.

BASE=https://forkmyalpha.com/api/engine
KEY=sk_live_YOUR_KEY

# Only VERIFIED genomes compile — an unvetted strategy is refused.
# genome_ref accepts a name, short hash, or full hash.
curl -s -X POST "$BASE/registry/bundle" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"genome_ref": "gme-tuned-histogram", "mode": "paper", "safety": {"daily_loss_cap_pct": 5}}'

# Response: {"genome": ..., "grade": ..., "files": {"config.json": ...,
# ".env.example": ..., "docker-compose.yml": ...}} — write the files to
# one directory, fill in .env from .env.example, docker compose up -d.
# Broker credentials go in your local .env and never touch the platform.

Read the reality gap

public

The honesty check: where each bot's live equity sits inside its verification card's bootstrap expectation cone. Verdicts come back verbatim (within_expectation, below_expectation, above_expectation), and bots without a card report that honestly instead of hiding.

# Public read — no key needed. Per-bot verdicts locating live equity
# inside the verification card's bootstrap expectation cone.
curl -s https://forkmyalpha.com/api/engine/api/reality-gap