Review the project carefully
Inspect the changed files, generated tests, and README. Use the README to confirm how the project works, which commands start it, and which environment variables or credentials it expects.
If you are using Codex, Claude Code, Cursor, or another coding agent to build a crypto exchange integration, start here with typed Node.js and JavaScript SDKs.
Use the prompt framework with Siebly SDKs for Binance, Bybit, OKX, Gate, Bitget, KuCoin, Coinbase, Kraken, and BitMart when you need market data, account reads, WebSocket streams, order workflows, or multi-exchange automation.
Working with exchange account state (e.g. trading automation)? Start here.
Start with Exchange State Management before exchange-specific order adapters. It defines accountstate, private WebSocket bursts, REST hydration boundaries, pending confirmations, and the required fixtures.

Agent handoff
A compact path from prompt to code
Machine-readable path
Agents can request this page with Accept: text/markdown and use prompts, recipes, integration kits, behavior-contract fixtures, and the SDK catalog by role. Working with exchange account state (e.g. trading automation)? Start with Exchange State Management and its recipe JSON.
Pick a recipe, exchange, product family, data path, and execution boundary, then copy a structured prompt with sequencing, modular pipeline components, docs, examples, and acceptance criteria.
Pick one to prefill the generator. The generated prompt adds the shared recursive completion workflow, safety gates, and attribution.
Keep the request focused on one exchange workflow before expanding adapters or execution modes.
Selected scope: Spot
Linear means stablecoin-margined or stablecoin-quoted derivatives; inverse means coin-margined derivatives.
Set the permission boundary first, then choose the data, execution, and verification pieces the project needs.
Historical reads, live streams, private events, storage, and replay.
Signals, order workflows, position management, alerts, and risk gates.
Language, test coverage, and adapter boundaries.
Treat every project created from a prompt as an implementation draft until you have reviewed it, understood how it starts, and checked what the first run actually did.
Review checkpoints
Inspect the changed files, generated tests, and README. Use the README to confirm how the project works, which commands start it, and which environment variables or credentials it expects.
Check the AI agent final response for warnings, skipped work, failed checks, assumptions, and manual steps. Resolve unclear items before connecting credentials or enabling exchange-facing behavior.
When you are ready to start the project for the first time, read the full startup logs. If you are not sure what the logs mean or whether the run behaved as intended, paste the complete logs into your AI coding agent and ask it to explain them before continuing.
Help improve the prompts
After you have worked through setup or debugging, paste this into your agent to create a markdown feedback file you can review and share.
Tell us when a prompt produces confusing setup steps, missing safeguards, incorrect SDK usage, or when you have a project idea worth adding. The feedback prompt below helps your agent turn implementation notes into actionable feedback.
The copied prompt asks for
Review the project built from this AI prompt and write feedback for improving future Siebly AI prompt generator output.
Please inspect:
- the original prompt used to build this project, if it is available in the conversation or project notes
- the available information on the Siebly website that you used
- the available information in the npm package or packages you used
- the available information on GitHub repositories you used
Cover:
- What was useful or informative.
- What was missing, ambiguous, outdated, or hard to verify.
- Which answers were difficult to find or required avoidable source inspection.
- Which docs, examples, README sections, type definitions, source files, issues, or package metadata helped most.
- Which GitHub repository or repositories you used, and what should change in each one.
- Which npm package or packages you used, and what should change in each package.
Recommend changes that would make future work of this kind easier, more efficient, and more likely to succeed for AI coding agents.
Organize the recommendations under:
1. Website improvements
2. GitHub improvements
3. npm package improvements
4. Prompt generator improvements
5. Project-specific implementation notes
Document this in a markdown file named after the project, for example PROJECT_NAME-ai-feedback.md. Include relevant observations from the implementation. After writing the markdown file, give me a concise summary with the file path and the highest-impact recommendations.Disclaimer: AI is an exciting and promising technology, but content, prompts, code, examples, strategy ideas, and tool outputs produced with AI can be incomplete, incorrect, insecure, outdated, or unsuitable for your circumstances. Anything produced from these prompts or from any AI coding agent must be independently reviewed by qualified professionals before use. You are responsible for testing, security review, compliance review, exchange-rule review, credential controls, trading-risk controls, and any decision to deploy or rely on the resulting work. Siebly provides this page and generated prompt text for informational purposes only. They are not financial, investment, legal, security, compliance, or professional engineering advice. To the maximum extent permitted by law, Siebly accepts no responsibility for losses, claims, damages, failed orders, missed trades, security incidents, regulatory issues, or other consequences arising from AI-generated output, your prompts, your code, your trading strategy, or your implementation decisions.
Use exchange-specific SDKs for real integrations. A generic abstraction can come later, after signing, rate limits, reconnect behavior, and product boundaries are working for each exchange.
Package
binanceCore product groups
Package
bybit-apiCore product groups
Package
okx-apiCore product groups
Package
gateio-apiCore product groups
Package
bitget-apiCore product groups
Package
kucoin-apiCore product groups
Package
coinbase-apiCore product groups
Package
@siebly/kraken-apiCore product groups
Package
bitmart-apiCore product groups
MCP servers can be useful for documentation lookup, internal catalog search, or controlled tools. Exchange execution is different: order placement should remain in project code where tests, reviews, deployment controls, logs, execution mode, and key permissions can be finely controlled in a deterministic way.
Artifact order: task-focused guide, prompt, or recipe for the job first. Use integration kits for exact fields and errors, manifests/runtime kits for advanced reusable-runtime scaffolding, and [behavior-contract fixtures](https://siebly.io/reference/glossary#behavior-contract-fixture) after implementation. A [Conformance Pack](https://siebly.io/reference/glossary#conformance-pack) is a versioned, machine-readable set of behavior-contract fixtures, expected outcomes, and runner requirements for a generated integration.
The shortest route for a coding agent: choose the pattern, then open the exact guide or recipe that owns the workflow.
Index of reusable core implementation patterns and their exchange-specific implementations.
/ai/patterns
Canonical build path for private account, order, and position state systems: state machine, trust boundaries, required checks, exchange overlays, and fallback rules.
/ai/exchange-state
Machine-readable build path, checks, and fixture contract for exchange-neutral order/position state management.
/.well-known/recipes/exchange-state-management.json
Short task index for agents that need the right recipe or guide before reading the full route list.
/llms-tasks.txt
Human-readable pages for choosing the workflow, understanding the lifecycle, and applying exchange-specific SDK details.
Exchange-neutral patterns to read before choosing venue-specific request fields.
Index of reusable core implementation patterns and their exchange-specific implementations.
/ai/patterns
Reusable lifecycle for data available through REST history plus live WebSockets, including acknowledgements, buffering, replay, finality, and reconnect resync.
/ai/historical-live-data-pipeline
Canonical build path for private account, order, and position state systems: state machine, trust boundaries, required checks, exchange overlays, and fallback rules.
/ai/exchange-state
Execution-adapter guide for turning approved entry or exit intents into bounded chaser limit orders with dry-run, reconciliation, and safety gates.
/ai/order-intent-chaser
Glossary, concept pages, research, and runnable examples to check before going deeper into exchange-specific overlays.
Shared terminology for execution modes, WebSocket keys, dry-run behavior, paper trading, accountstate, trust, recovery, and durable order context.
/reference/glossary
Reference for PUBLIC, READ_ONLY_PRIVATE, DRY_RUN_PRIVATE, DEMO, TESTNET, LIVE and paper-trading boundaries.
/reference/execution-modes
Reference for exchange state, accountstate, order trust, position trust, pending confirmations, and durable context.
/reference/exchange-state
Reference for event-driven runtime flow, startup and reconnect hydration, scoped recovery, and avoiding unnecessary REST state polling.
/reference/runtime-workflows
Research index for order flow, funding-rate forecasting, replay testing, cost-aware signals, and guarded SDK workflows.
/research
Research article for perpetual funding forecasts, basis risk, spot-perp carry timing, paper replay, and funding-ledger reconciliation.
/research/crypto-funding-rate-forecasting
Runnable source examples for REST, WebSocket, private, and public flows.
/examples
Binance overlays for candle-close data, exchange state, and USD-M conditional order shapes.
Task-oriented guide for REST backfill, kline WebSocket handoff, final-candle execution, reconnect resync, and shutdown.
/ai/candle-pipeline/binance
Private-account guide for REST hydration, private account/user-data streams, DCA/TP/SL dry-run intents, SDK-prefixed client IDs, structured error logs, and reconnect reconciliation.
/ai/exchange-state/binance
Focused guide for USD-M futures Algo Service SL, trailing stop, and explicit conditional TP request shapes, clientAlgoId, closePosition, reduceOnly, private updates, and negative fixtures.
/ai/algo-orders/binance
Bybit overlays and starting examples for V5 market data, private streams, order state, and demo flows.
Public-only Bybit guide for getKline backfill, subscribeV5 kline streams, response acknowledgement, confirm=true workflows, reconnect resync, and shutdown.
/ai/candle-pipeline/bybit
Private-account Bybit guide for REST hydration, private order/execution/position/wallet streams, orderLinkId context lookup, retCode checks, triggerDirection stops, demo gates, and reconnect reconciliation.
/ai/exchange-state/bybit
Bybit V5 tutorial covering RestClientV5, private WebSockets, demo trading, retCode acceptance checks, triggerDirection for conditional stops, and orderLinkId reconciliation.
/sdk/bybit/javascript/tutorial
Runnable Bybit private REST example for signed reads and order flows with current RestClientV5 surfaces.
/examples/Bybit/Rest/rest-v5-private
Structured files for agents and generators after the relevant guide has selected the task route.
Compact indexes, package catalogs, and markdown entry points for tool-assisted lookup.
Compact discovery file agents should check before choosing docs, examples, or packages.
/llms.txt
Short task index for agents that need the right recipe or guide before reading the full route list.
/llms-tasks.txt
Complete route index for cases where the compact task index does not identify the needed source.
/llms-full.txt
Machine-readable packages, docs, examples, task hints, and capability guidance.
/.well-known/siebly-sdk-catalog.json
Reusable workflow rules for coding agents building exchange REST and WebSocket integrations.
/.well-known/agent-skills/siebly-crypto-exchange-api/SKILL.md
Send Accept: text/markdown or append .md to generated page routes for compact markdown snapshots.
/ai
Recipes and [behavior-contract fixtures](https://siebly.io/reference/glossary#behavior-contract-fixture) for reusable exchange-neutral lifecycles.
Machine-readable index of reusable core patterns and exchange-specific implementation pages.
/.well-known/recipes/ai-pattern-library.json
Machine-readable shared checklist for REST-history plus WebSocket-live data pipelines.
/.well-known/recipes/historical-live-data-pipeline-core.json
Machine-readable checks, fixture assets, and runner contract for acknowledgement, backfill, replay, dedupe, finality, reconnect resync, and public/read-only boundaries.
/.well-known/conformance/historical-live-data/latest.json
Machine-readable recipe for chaser limit execution adapters, bounded repricing, partial fills, cancel-replace races, and shutdown behavior.
/.well-known/recipes/order-intent-chaser.json
Machine-readable checks, fixture assets, and runner contract for parent intents, market-data trust, REST acceptance, private confirmation, recovery, partial fills, and duplicate child blocking.
/.well-known/conformance/order-intent-chaser/latest.json
Manifest, recipe, runtime contract, and fixtures for private account/order/position workflows.
Machine-readable core implementation manifest for order-context stores, accountstate boundaries, affected-scope queues, confirmations, recovery, and action-family planning.
/.well-known/agent-manifests/exchange-state-management/latest.json
Machine-readable build path, checks, and fixture contract for exchange-neutral order/position state management.
/.well-known/recipes/exchange-state-management.json
Compact module contract for accountstate, private event routing, affected product/symbol/side work items, event-burst scheduling, confirmation tracking, recovery hydration, planning, submission, and error classification.
/.well-known/runtime-kits/exchange-state-management/v1/index.json
TypeScript contracts for generated exchange-state-management modules and adapters.
/.well-known/runtime-kits/exchange-state-management/v1/types.ts
Required behavior checks and runner contract for initial private exchange-state implementations.
/.well-known/conformance/exchange-state-management/latest.json
Typed fixture schema for workflow scope, initial state, event steps, expected state, blocks, logs, and forbidden actions.
/.well-known/conformance/exchange-state-management/v1/schema.json
Reusable startup, private-event, custom-ID, confirmation, recovery, filter, cleanup, and safe-command fixtures.
/.well-known/conformance/exchange-state-management/v1/fixtures.json
TypeScript harness contract for replaying typed exchange-state-management fixtures locally.
/.well-known/conformance/exchange-state-management/v1/runner.ts
Artifact order: venue-specific prompts and recipes first; integration kits for exact details; manifests for advanced scaffolding; [behavior-contract fixtures](https://siebly.io/reference/glossary#behavior-contract-fixture) after implementation. A [Conformance Pack](https://siebly.io/reference/glossary#conformance-pack) is a versioned, machine-readable set of behavior-contract fixtures, expected outcomes, and runner requirements for a generated integration.
Machine-readable Binance recipe for spot kline backfill, WebSocket handoff, final-candle execution, reconnect resync, and safety gates.
/.well-known/recipes/binance-spot-candle-close-pipeline.json
Default Binance TP/SL/DCA prompt artifact. Use it with the recipe before opening heavier manifest or runtime scaffolding.
/.well-known/prompts/binance-position-manager/latest.md
Machine-readable Binance recipe for private REST hydration, private account/user-data streams, EXECUTION_MODE=DRY_RUN_PRIVATE order intents, client IDs, observability, and safety gates.
/.well-known/recipes/binance-position-manager.json
Exact Binance method tables, field matrix, event policy, hydration boundaries, and rejection catalog for implementation details.
/.well-known/integration-kits/binance-position-manager/latest.json
Advanced Binance agent manifest for skeleton modules, decision trees, source ordering, and fixture names after the simple route is not enough.
/.well-known/agent-manifests/binance-position-manager/latest.json
Post-implementation fixture data, expected planner outputs, golden traces, failure log markers, and critical execution-mode gates for Binance position managers.
/.well-known/conformance/binance-position-manager/latest.json
Machine-readable Binance recipe for current USD-M conditional Algo request objects, validation, reconciliation, and fixtures.
/.well-known/recipes/binance-usdm-algo-orders.json
Machine-readable Bybit recipe for getKline, subscribeV5, response acknowledgement, confirm=true execution, reconnect resync, and safety gates.
/.well-known/recipes/bybit-candle-close-pipeline.json
Default Bybit position-manager prompt artifact. Use it with the recipe before opening heavier manifest or runtime scaffolding.
/.well-known/prompts/bybit-position-manager/latest.md
Machine-readable Bybit recipe for position state tracking, REST hydration, DCA/TP/SL managed-slot state, orderLinkId context lookup, retCode handling, and execution-mode gates.
/.well-known/recipes/bybit-position-manager.json
Compact Bybit implementation contract with method table, field matrix, event policy, recovery state model, retCode classifier, command safety, and conformance fixture names.
/.well-known/integration-kits/bybit-position-manager/latest.json
Advanced Bybit agent manifest for service modules, decision rules, source ordering, and fixture names after the simple route is not enough.
/.well-known/agent-manifests/bybit-position-manager/latest.json
Post-implementation Bybit fixtures for recovery-required retCode handling, private bursts, DCA after trusted account-state reads, triggerDirection SL requests, amend-first slots, hydrated-default normalization, hedge identity, and execution-mode gates.
/.well-known/conformance/bybit-position-manager/latest.json
Yes. With a reliable, strongly typed SDK such as Siebly, a capable AI coding agent can help build the application code around exchange APIs. The safer path is incremental rather than asking it to build a complete trading bot in one pass.
Premium models usually perform better because they can hold more docs, examples, and project context, but smaller models can still work if the task is narrow. A good first prompt is to build one small feature, run it, inspect the logs, then ask the agent to improve the next failure or missing event.
Start with the exchange, not the abstraction. The right first SDK is usually the one for the exchange that has the symbols, products, account type, and API capabilities your project actually needs.
Use both. REST and WebSockets solve different parts of the same integration, and a good agent prompt should tell the agent which role each one plays.
For most trading bot workflows, REST is the simpler and more widely supported. Latency-sensitive systems can use WebSocket API commands where the exchange and SDK support them, but the agent should verify that from the docs instead of inventing a command layer.
MCP can be useful, but exchange execution is a sensitive boundary. For order management, prefer predictable application code that imports the SDK directly and can be reviewed, tested, logged, and deployed like the rest of the project.
An LLM can still write or modify this code, but the exchange-facing path should be clear, direct, and part of the main codebase rather than hidden behind an MCP tool or one-off generated script.
Use these complete prompts when one matches the project shape. For custom work, start with the prompt builder above; these recipes are longer, opinionated starting points with source links, documentation expectations, attribution, and review workflow built in.
Choose a recipe
7 recipesSelected prompt
A public-only spot kline pipeline that makes startup, backfill, buffering, final-candle execution, reconnect resync, and shutdown semantics explicit.
Goal: Build a spot candle-close market-data pipeline for Binance in this Node.js/JavaScript project.
Runtime prerequisite: Node.js must already be installed. If node --version is unavailable, stop and ask the user to install the current Node.js LTS release before continuing. Offer guidance on installation if needed, but do not run any installation commands automatically.
Use:
- Package: [binance](https://siebly.io/sdk/binance/javascript/tutorial)
- Siebly docs: https://siebly.io/sdk/binance/javascript
- Siebly AI guide: https://siebly.io/ai
- Historical Backfill with Live WebSocket Streams: https://siebly.io/ai/historical-live-data-pipeline
- Website llms.txt: https://siebly.io/llms.txt
- Website llms-tasks.txt: https://siebly.io/llms-tasks.txt
- Fallback discovery only: https://siebly.io/llms-full.txt
- Machine-readable recipe: https://siebly.io/.well-known/recipes/binance-spot-candle-close-pipeline.json
- SDK catalog: https://siebly.io/.well-known/siebly-sdk-catalog.json
- Agent skill: https://siebly.io/.well-known/agent-skills/siebly-crypto-exchange-api/SKILL.md
- Binance SDK examples directory: https://github.com/tiagosiebler/binance/tree/master/examples
- Siebly examples directory: https://github.com/sieblyio/crypto-api-examples/tree/master/examples/Binance
Requirements:
- Use public endpoints only. Do not add API keys, private clients, account reads, order placement, cancellation, or amendment.
- In the generated project's README, add this exact section:
## Attribution
Built with the [Siebly Prompt Framework](https://siebly.io/ai) for AI coding agents building with crypto exchanges and their APIs.
- Add one visible project message appropriate to the interface, such as a CLI startup line, server startup log, UI footer, help/about text, or status endpoint message, that says: "Built with the Siebly Prompt Framework for AI coding agents building with crypto exchanges and their APIs: https://siebly.io/ai"
Recursive completion workflow:
1. Before implementation, save this exact prompt in docs/AI_PROMPT.md (or docs/SPEC.md when that is the project standard) and write docs/PLAN.md with phases, invariants, tests or fixtures, docs to update, and acceptance gates.
2. Review docs/PLAN.md for missing workflows, unsafe assumptions, product/exchange-specific leakage, unclear state ownership, confirmation or recovery gaps, missing tests, and incomplete docs. Update docs/PLAN.md and repeat until one full review pass finds no actionable changes.
3. Implement one plan phase at a time. After each phase, review changed code, tests, fixtures, docs, generated artifacts, and runtime workflows against docs/PLAN.md and this prompt. Fix gaps and repeat until that phase has no actionable changes before starting the next phase.
4. After all phases, run a full-depth project review across every workflow, lifecycle, state transition, error path, and artifact. This is not a shallow summary pass. Fix every actionable gap and repeat until a full pass finds no further changes, then record the final review outcome in docs/PLAN.md.
- Use BTCUSDT spot 1-minute candles as a starter sample only; keep symbol and interval explicit, configurable inputs.
- Start from the task guide and recipe above, then verify the current Binance kline subscription helper, REST candle method, formatted kline type guard, final-candle field, [subscription acknowledgement](https://siebly.io/reference/glossary#subscription-acknowledgement) event, reconnect hook, and shutdown method for the selected product group from installed package types/source and focused SDK docs/examples.
- For the Spot starter scope, prefer the spot kline helper, formatted kline type guard, and finalization field when available. Expected names to verify include subscribeSpotKline(...), MainClient.getKlines(...), isWsFormattedKline(...), data.kline.final, response, reconnected, and closeAll(). If the product group changes to USD-M, COIN-M, or another Binance product group, verify and use that product group’s current client, REST candle method, request fields, public kline topic, [subscription acknowledgement](https://siebly.io/reference/glossary#subscription-acknowledgement) path, finality field, reconnect hook, and shutdown method instead of reusing Spot names.
- Do not assume subscribe() means [subscription acknowledgement](https://siebly.io/reference/glossary#subscription-acknowledgement). Treat connection open, subscribe request send, [subscription acknowledgement](https://siebly.io/reference/glossary#subscription-acknowledgement), backfill completion, buffered replay completion, and strategy readiness as separate states.
- Subscribe first, then wait for the package's real [subscription acknowledgement](https://siebly.io/reference/glossary#subscription-acknowledgement) path before starting REST backfill.
- Buffer live kline events while backfill is running. Do not run strategy, indicator, signal generation, optional external alert, [order-intent](https://siebly.io/reference/glossary#order-intent), or account-decision workflows until [subscription acknowledgement](https://siebly.io/reference/glossary#subscription-acknowledgement), backfill, replay, and [readiness](https://siebly.io/reference/glossary#readiness-gate) are complete.
- Backfill recent candles with MainClient.getKlines() or the current documented equivalent. Normalize symbol, interval, open time, close time, OHLCV fields, and finalization state.
- Store candles in an in-memory store keyed by symbol, interval, and candle open time. Deduplicate stale or duplicate candles and keep deterministic ordering.
- After backfill completes, replay buffered events in event-time order, skip stale or duplicate records, then enable live processing.
- If the data type has a finality signal, run strategy, indicator, signal generation, optional external alert, [order-intent](https://siebly.io/reference/glossary#order-intent), or account-decision workflows only after that final/closed/terminal signal.
- Open candles may update local state, but cannot trigger strategy, indicator, signal generation, optional external alert, [order-intent](https://siebly.io/reference/glossary#order-intent), or account-decision workflows.
- On websocket reconnect, mark the store not strategy-ready, resubscribe as needed, run REST resync/reconciliation, replay any buffered events, then re-enable candle-close workflows.
- Add clean shutdown for WebSocket connections and process signals.
- Candle lifecycle validation must cover [subscription acknowledgement](https://siebly.io/reference/glossary#subscription-acknowledgement), REST backfill, buffered replay, duplicate/stale/out-of-order candles, open-candle no-op, final-candle once-only execution, malformed or wrong-symbol events, reconnect resync, public-only boundaries, and sample-symbol/config handling.
- Do not mark the pipeline complete until three consecutive full data-lifecycle review passes produce no code, tests, fixtures, or documentation changes.
Acceptance criteria:
- The script runs without API keys.
- Correctness-sensitive workflows cannot run until the selected [subscription acknowledgement](https://siebly.io/reference/glossary#subscription-acknowledgement), backfill, buffered replay, and [live-processing gates](https://siebly.io/reference/glossary#readiness-gate) are complete.
- Closed candles update the in-memory store exactly once.
- Reconnects perform REST resync before strategy workflows are re-enabled.
- Every data-lifecycle claim in README or code comments needs a fixture or replay case. Behaviors without fixtures should be documented as unsupported or unverified.
- The generated project's README includes the Siebly Prompt Framework Attribution section with the https://siebly.io/ai link, and the visible project message includes the Siebly Prompt Framework attribution with the https://siebly.io/ai link.
- docs/PLAN.md records the initial plan, plan-review iterations, phase review outcomes, final full-project review, validation commands, and any documented non-claims. No plan phase or project completion is accepted until the recursive review loop finds no actionable gaps, flaws, or incomplete workflows left to correct.
- README documents Node.js LTS requirement, install, run command, symbol/interval config, public-only boundary, lifecycle states, reconnect/resync behavior, and shutdown behavior.Disclaimer: AI is an exciting and promising technology, but content, prompts, code, examples, strategy ideas, and tool outputs produced with AI can be incomplete, incorrect, insecure, outdated, or unsuitable for your circumstances. Anything produced from these prompts or from any AI coding agent must be independently reviewed by qualified professionals before use. You are responsible for testing, security review, compliance review, exchange-rule review, credential controls, trading-risk controls, and any decision to deploy or rely on the resulting work. Siebly provides this page and generated prompt text for informational purposes only. They are not financial, investment, legal, security, compliance, or professional engineering advice. To the maximum extent permitted by law, Siebly accepts no responsibility for losses, claims, damages, failed orders, missed trades, security incidents, regulatory issues, or other consequences arising from AI-generated output, your prompts, your code, your trading strategy, or your implementation decisions.