ApesTogether 开放 API,允许交易机器人在公开模拟组合中交易并赚取订阅收入
来源标题:Earn subscription income from your paper-trading bot
ApesTogether 推出交易 API,用户可用 Python 脚本、交易机器人或 AI agent 在公开模拟组合中下单,交易按实时市价记录并与标普 500 对比排名。每笔交易不可删除,同一账户最多可持有 5 个活跃 API key,采用 portfolio:read 与 trade:write 两种权限范围。该功能支持开发者通过自己的程序赚取订阅收入。
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
Let your own program — a Python script, a trading bot, or an AI agent — trade a public ApesTogether paper portfolio. Same rules as the app: every trade is timestamped at a live market price, ranked against the S&P 500, and can't be deleted.
Base URL: https://apestogether.ai/api/v1. Send your key as a bearer token on every request (except /clock):
Authorization: Bearer at_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Every key belongs to your account, and an account has exactly one portfolio, so every order from every key lands on the same public record. You can keep up to 5 active keys so each place your code runs (your laptop, a cloud server, an AI connector, a read-only dashboard) has its own, and so you can switch to a fresh key and revoke the old one without downtime. Manage them at /developers/keys. Two strategies running on the same account blend into one record, so point your keys at the strategy you want judged. Scopes: portfolio:read (read endpoints) and trade:write (place / cancel orders); read-only keys are available. Treat a key like a password: never commit it to a public repo or paste it into a shared notebook.
POST /api/v1/orders { "symbol": "AAPL", "side": "buy", // "buy" or "sell" "qty": 5, // shares (fractions OK) — OR — "notional": 500, // dollars (market hours only) "client_order_id": "my-bot-2026-10-05-AAPL", // optional, makes retries safe "dry_run": false // true = validate + quote, place nothing }
Send exactly one of qty or notional. type defaults to "market"; time_in_force is always "day".
Idempotency: if you send the same client_order_id twice, the second call returns the original order (header Idempotent-Replay: true) instead of trading again. Always set one when an AI or a retry loop is placing orders.
Dry run: "dry_run": true returns the estimated price and what would happen (fill now vs. queue for the open) without placing anything — use it as the confirmation step before an AI agent trades.
{ "id": "1042", "client_order_id": "my-bot-2026-10-05-AAPL", "symbol": "AAPL", "side": "buy", "type": "market", "time_in_force": "day", "qty": 5, "notional": null, "status": "filled", // filled | accepted | canceled | rejected "filled_qty": 5, "filled_avg_price": 228.41, "submitted_at": "2026-10-05T14:03:11Z", "filled_at": "2026-10-05T14:03:11Z", "canceled_at": null, "reject_reason": null, "paper": true }
Order statuses
filled — executed at the price shown.
accepted — submitted outside market hours; fills at the next open. Cancel with DELETE /orders/{id}.
canceled — you canceled it before the open.
rejected — not executed; reject_reason says why (for example insufficient_shares).
Orders queued from the app (not via the API) appear in /orders?status=open with ids like q123; you can cancel those too.
Errors return JSON {"code": "...", "message": "..."} with an HTTP status: 401 bad or missing key · 403 key lacks the scope · 404 not found · 422 invalid request or rejected order · 429 rate limit or daily order cap · 503 no live price available right now (try again).
Common codes: price_not_accepted, unsupported_order_type, qty_or_notional, notional_requires_open_market, insufficient_shares, quantity_too_large, order_too_large, daily_order_cap, not_cancelable.
KEY=at_live_your_key_here
curl -s https://apestogether.ai/api/v1/clock
curl -s -H "Authorization: Bearer $KEY" https://apestogether.ai/api/v1/account
curl -s -X POST -H "Authorization: Bearer $KEY" -H "Content-Type: application/json"
-d '{"symbol":"AAPL","qty":1,"side":"buy","dry_run":true}'
https://apestogether.ai/api/v1/orders
Quickstart (Python)
import os, requests
API = "https://apestogether.ai/api/v1" H = {"Authorization": f"Bearer {os.environ['APESTOGETHER_KEY']}"}
print(requests.get(f"{API}/account", headers=H).json())
order = {"symbol": "AAPL", "qty": 1, "side": "buy", "client_order_id": "first-order-AAPL", "dry_run": True} print(requests.post(f"{API}/orders", json=order, headers=H).json())
Use it from Claude, ChatGPT or your editor (MCP)
ApesTogether runs a remote MCP server at https://apestogether.ai/mcp (Streamable HTTP). Add it to an AI assistant and ask it in plain English to check your positions or trade. Tools: get_account, get_positions, get_quote, list_orders, get_fills, place_order (with dry_run), cancel_order, get_clock. Same rules as the REST API: paper only, market orders, server-set prices, public record.
Make a separate key for each assistant (Settings → AI Traders in the app) so you can revoke one without breaking the others.
The server tells the assistant to run every order as a dry run first and get your OK before placing it. Fills land on your public record immediately and can't be deleted.
POST https://your-server.example/hook X-ApesTogether-Event: trade X-ApesTogether-Delivery: evt_4f1c... X-ApesTogether-Timestamp: 1793548800 X-ApesTogether-Signature: sha256=9a7b...
{"id": "evt_4f1c...", "type": "trade", "created_at": "2026-11-10T14:31:07Z", "data": {"trader": {"name": "Drew", "slug": "...", "url": "https://apestogether.ai/p/..."}, "action": "buy", "ticker": "NVDA", "quantity": 12, "price": 191.42, "position_pct": null, "scaled": false, "executed_at": "2026-11-10T14:31:05Z"}}
Verify the signature before trusting a delivery: compute HMAC-SHA256 of <timestamp>.<raw body> with your secret and compare it with the header.
import hmac, hashlib def verified(secret, headers, raw_body): msg = headers["X-ApesTogether-Timestamp"].encode() + b"." + raw_body want = "sha256=" + hmac.new(secret.encode(), msg, hashlib.sha256).hexdigest() return hmac.compare_digest(want, headers["X-ApesTogether-Signature"])
Respond with any 2xx within 3 seconds. Deliveries are not retried; use X-ApesTogether-Delivery to ignore duplicates.
Only public https:// addresses are accepted, and redirects are not followed.
After 20 failed deliveries in a row the webhook is switched off; save it again to turn it back on.
Sell alerts include position_pct: the share of the position that was sold.
Coming next
Sign in instead of a key for Claude and ChatGPT, and listings in their connector directories.
TradingView webhooks — route Pine Script alerts straight to your portfolio (TradingView's webhook alerts need one of its paid plans).
ApesTogether is paper trading for information and education. It is not a broker or investment adviser, and nothing here is investment advice. You must be 18 or older. Use of the API is subject to the Terms of Service.
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。