# Copy & Mirror Source: https://quantform.io/ai-tools/claude-code Configure Claude Code for your documentation workflow Set up Claude Code to help you write and maintain your Mintlify documentation. ## Prerequisites * Active Claude subscription (Pro, Max, or API access) ## Setup ```bash theme={null} npm install -g @anthropic-ai/claude-code ``` In your docs directory, run: ```bash theme={null} npx skills add https://mintlify.com/docs ``` This gives Claude Code Mintlify's component reference, writing standards, and workflow guidance. Edit `AGENTS.md` in your project root to add project-specific terminology, style preferences, and content boundaries. ```bash theme={null} claude ``` # Funding Rate Arbitrage Source: https://quantform.io/ai-tools/cursor Configure Cursor for your documentation workflow Set up Cursor to help you write and maintain your Mintlify documentation. ## Prerequisites * Cursor editor installed ## Setup Open the root of your documentation repository where `docs.json` is located. In the integrated terminal, run: ```bash theme={null} npx skills add https://mintlify.com/docs ``` This gives Cursor Mintlify's component reference, writing standards, and workflow guidance. Edit `AGENTS.md` in your project root to add project-specific terminology, style preferences, and content boundaries. Open a file and use Cursor's AI features to draft and edit documentation. # Simulation Source: https://quantform.io/essentials/code Display inline code and code blocks ## Inline code To denote a `word` or `phrase` as code, enclose it in backticks (\`). ```text theme={null} To denote a `word` or `phrase` as code, enclose it in backticks (`). ``` ## Code blocks Use [fenced code blocks](https://www.markdownguide.org/extended-syntax/#fenced-code-blocks) by enclosing code in three backticks and follow the leading ticks with the programming language of your snippet to get syntax highlighting. Optionally, you can also write the name of your code after the programming language. ```java HelloWorld.java theme={null} class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } } ``` ````md theme={null} ```java HelloWorld.java class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } } ``` ```` # Composition Source: https://quantform.io/essentials/dependency-injection Compose strategies from dependencies Register dependencies once (options, storages, custom services) and consume them anywhere in your strategy tree without threading parameters through every function. ## Registering dependencies Dependencies are plain objects with a `provide` token and either `useValue` or `useClass`: ```ts theme={null} import { Dependency } from '@quantform/core'; const MyConfig = Symbol('my-config'); export function myConfigOptions(config: { apiUrl: string }): Dependency { return { provide: MyConfig, useValue: config }; } ``` Return them from your `strategy(() => [...])` array (and merge with adapter packages): ```ts theme={null} import { EMPTY } from 'rxjs'; import { behavior, strategy, useContext } from '@quantform/core'; const MyConfig = Symbol('my-config'); export default strategy(() => { behavior(() => { const cfg = useContext<{ apiUrl: string }>(MyConfig); // ... return EMPTY; }); return [myConfigOptions({ apiUrl: 'https://api.example.com' })]; }); ``` Core registers defaults via `core()`; your entries extend or override that graph. ## Pattern: token + hook + options Built-in hooks follow the same shape: a private `Symbol`, a hook that calls `useContext`, and an `options` helper that returns a `Dependency`: ```ts theme={null} import { Dependency, useContext } from '@quantform/core'; const MyService = Symbol('my-service'); export interface MyServiceApi { fetchBalance(): Promise; } export function useMyService() { return useContext(MyService); } useMyService.options = (impl: MyServiceApi): Dependency => ({ provide: MyService, useValue: impl }); ``` Consumers import `useMyService()` in `behavior` / components; wiring happens in the strategy’s dependency list. ## Rules of thumb * Call `useContext` only from code that runs **inside** the module context (strategy hooks, helpers invoked from there). * Do not call it from top-level module scope or from random timers unless that code was scheduled from within `act`. * Prefer **symbols** or stable object tokens for `provide` to avoid collisions across packages. ## `throwWithContext` `throwWithContext()` throws if a module context **is** active. Use it to guard code paths that must **not** run under DI (for example utilities that should stay free of hooks). ## How this fits composition | Layer | Role | | ----------------------------- | --------------------------------- | | `Dependency[]` | Declares what the run needs | | `useContext` | Reads those bindings inside hooks | | RxJS `pipe` / `combineLatest` | Composes event logic | Together, dependency injection composes **services and config**, while observables compose **data flow**. Use both so strategies stay modular and testable. Read more about `Module`, `awake`, and `act`. # Backtest Source: https://quantform.io/essentials/images Add image, video, and other HTML elements ## Image ### Using Markdown The [markdown syntax](https://www.markdownguide.org/basic-syntax/#images) lets you add images using the following code ```md theme={null} ![title](/path/image.jpg) ``` Note that the image file size must be less than 5MB. Otherwise, we recommend hosting on a service like [Cloudinary](https://cloudinary.com/) or [S3](https://aws.amazon.com/s3/). You can then use that URL and embed. ### Using embeds To get more customizability with images, you can also use [embeds](/writing-content/embed) to add images ```html theme={null} ``` ## Embeds and HTML elements ``` # Execution Source: https://quantform.io/essentials/navigation Execution mode defines runtime semantics for strategy behavior, timestamps, storage usage, and execution side effects. Use one strategy shape and choose the mode based on where you are in the development lifecycle. ## Modes at a glance | Mode | Purpose | Typical use | | -------- | -------------------------------------- | -------------------------------------------------------------------- | | `paper` | Simulation with live-like runtime flow | Validate logic against current market streams without real execution | | `replay` | Historical backtest flow | Deterministic strategy verification on a fixed time window | | `live` | Production execution | Real order/transaction execution after validation | ## Runtime API Use `useExecutionMode()` to inspect the active mode: ```ts theme={null} const { isReplay, isSimulation } = useExecutionMode(); ``` * `isSimulation` is `true` for non-live modes * `recording` is configured through CLI mode options for `paper` and `live` ## CLI commands * `qf paper ` * `qf replay --from --to ` * `qf live ` All commands load the same strategy module and inject mode-specific dependencies. ## Paper mode Use `paper` when strategy logic is still evolving and you want real-time behavior without real capital impact. Typical characteristics: * live-like event flow * simulated execution paths * optional recording for diagnostics (`--recording`) ```bash theme={null} qf paper pipeline --id paper-sol-v1 --recording ``` ## Replay mode Use `replay` for deterministic backtesting over a fixed period. Replay characteristics: * uses historical storage streams * aligns runtime time with replay scheduler * allows reproducible validations when window and inputs are fixed ```bash theme={null} qf replay pipeline --from 2025-01-01 --to 2025-01-07 --id replay-week-1 ``` For replay-safe code paths, use `useTimestamp` and replay-aware branching. ## Live mode Use `live` only after paper + replay confidence gates pass. Typical characteristics: * production connectors and execution * real risk and real fills * optional recording for audit and analysis ```bash theme={null} qf live pipeline --id live-main --recording ``` ## Mode-aware branching patterns `useSimulator(simulated, real)` picks simulated logic for any non-live run. `useReplay(backtest, real)` picks backtest logic only in replay mode. ```ts theme={null} import { useReplay, useSimulator } from '@quantform/core'; const orderExecutor = useSimulator(simulatedExecutor, liveExecutor); const marketSource = useReplay(historicalSource, realtimeSource); ``` Use this approach to keep strategy orchestration stable while switching execution internals per mode. ## Recommended promotion flow 1. Build logic in `paper` mode. 2. Validate deterministically in `replay` mode on targeted windows. 3. Promote to `live` with explicit session ID and recording where needed. 4. Keep mode branching explicit and minimal to reduce divergence. ## Common mistakes * Using `Date.now()` instead of `useTimestamp` in replay-sensitive logic * Mixing live side effects into replay code paths * Skipping paper/replay validation before live rollout * Over-branching strategy flow by mode instead of branching only execution edges # Research Source: https://quantform.io/essentials/reusable-snippets Reusable, custom snippets to keep content in sync One of the core principles of software development is DRY (Don't Repeat Yourself). This is a principle that applies to documentation as well. If you find yourself repeating the same content in multiple places, you should consider creating a custom snippet to keep your content in sync. ## Creating a custom snippet **Pre-condition**: You must create your snippet file in the `snippets` directory. Any page in the `snippets` directory will be treated as a snippet and will not be rendered into a standalone page. If you want to create a standalone page from the snippet, import the snippet into another file and call it as a component. ### Default export 1. Add content to your snippet file that you want to re-use across multiple locations. Optionally, you can add variables that can be filled in via props when you import the snippet. ```mdx snippets/my-snippet.mdx theme={null} Hello world! This is my content I want to reuse across pages. My keyword of the day is {word}. ``` The content that you want to reuse must be inside the `snippets` directory in order for the import to work. 2. Import the snippet into your destination file. ```mdx destination-file.mdx theme={null} --- title: My title description: My Description --- import MySnippet from '/snippets/path/to/my-snippet.mdx'; ## Header Lorem impsum dolor sit amet. ``` ### Reusable variables 1. Export a variable from your snippet file: ```mdx snippets/path/to/custom-variables.mdx theme={null} export const myName = 'my name'; export const myObject = { fruit: 'strawberries' }; ``` 2. Import the snippet from your destination file and use the variable: ```mdx destination-file.mdx theme={null} --- title: My title description: My Description --- import { myName, myObject } from '/snippets/path/to/custom-variables.mdx'; Hello, my name is {myName} and I like {myObject.fruit}. ``` ### Reusable components 1. Inside your snippet file, create a component that takes in props by exporting your component in the form of an arrow function. ```mdx snippets/custom-component.mdx theme={null} export const MyComponent = ({ title }) => (

{title}

... snippet content ...

); ``` MDX does not compile inside the body of an arrow function. Stick to HTML syntax when you can or use a default export if you need to use MDX. 2. Import the snippet into your destination file and pass in the props ```mdx destination-file.mdx theme={null} --- title: My title description: My Description --- import { MyComponent } from '/snippets/custom-component.mdx'; Lorem ipsum dolor sit amet. ``` # Components Source: https://quantform.io/essentials/settings Create, use, and combine reusable Quantform components. Components are reusable functions that return observable pipelines or runtime behavior blocks. In Quantform, components help you split complex strategies into small, testable pieces that you can compose together. ## Why components * Keep strategy files focused on orchestration * Reuse logic across multiple strategies * Isolate adapter-specific details behind clean functions * Make testing simpler by validating component outputs in isolation ## 1) Create a component A component usually: 1. Accepts inputs (symbol, timeframe, thresholds) 2. Calls one or more connectors/adapters 3. Returns a normalized stream ```ts theme={null} import { map } from 'rxjs'; import { useHyperliquid } from '@quantform/hyperliquid'; export function watchFundingRate(symbol = 'SOL') { const { watchHyperliquidFundingFee } = useHyperliquid(); return watchHyperliquidFundingFee(symbol).pipe( map(event => ({ timestamp: event.timestamp, venue: 'hyperliquid', rate: event.rate })) ); } ``` ## 2) Use a component inside strategy behavior ```ts theme={null} import { behavior, strategy, useLogger } from '@quantform/core'; import { tap } from 'rxjs'; import { watchFundingRate } from './components/watch-funding-rate'; export default strategy(() => { behavior(() => { const { info } = useLogger('funding'); return watchFundingRate('SOL').pipe( tap(event => info(`rate=${event.rate} venue=${event.venue}`)) ); }); return []; }); ``` ## 3) Combine components from multiple venues This pattern is useful when you want one strategy signal from many data sources. ```ts theme={null} import { combineLatest, map } from 'rxjs'; import { useBackpack } from '@quantform/backpack'; import { useHyperliquid } from '@quantform/hyperliquid'; /* * Combines funding rates from multiple venues into a single stream * and computes the funding fee premium between them. */ export function watchFundingPremium(symbol = 'SOL') { const { watchHyperliquidFundingFee } = useHyperliquid(); const { watchBackpackFundingFee } = useBackpack(); return combineLatest([ watchHyperliquidFundingFee(symbol), watchBackpackFundingFee(`${symbol}_USD_PERP`) ]).pipe(map(([hl, bp]) => hl.rate - bp.rate)); } ``` Then consume `watchFundingPremium()` in behavior and attach execution logic when premium crosses your threshold. ## Component design tips * Normalize shapes early (`{ timestamp, symbol, venue, value }`) * Keep side effects near strategy behavior (`tap`, execution calls) * Prefer small, composable components over one giant pipeline * Use execution mode checks when behavior should differ in replay/paper/live Learn where components fit in `before`, `behavior`, and `after` execution stages. # Time Source: https://quantform.io/essentials/time Use useTimestamp as the single source of truth for time Quantform treats time as **64-bit integer timestamps in nanoseconds** (`bigint`) for storage, replay windows, and ordering. Sticking to **ns** end-to-end avoids drift between live runs and backtests. ## Why nanoseconds * **Single precision** — Internal APIs (replay bounds, event ordering, storage queries) expect **`Timestamp<'ns'>`**. Values in other units are **tagged** (`'us' | 'ms' | 's'`) so you cannot mix units by accident. * **Conversion, not guessing** — Anything you read from the outside world (milliseconds from `Date`, microseconds from an exchange) should be wrapped with the right helper and **`convert(..., from, 'ns')`** before passing it into core that require ns. ## `useTimestamp`: one clock for strategy code Call **`useTimestamp()`** when you need “now” inside code that must agree with **replay** and **live/paper**. It returns **`{ timestamp: Timestamp<'ns'> }`**: * **Live and paper** — Uses **`now()`**: wall time expressed in **nanoseconds**, stabilized with `process.hrtime` so the clock is monotonic within the process. * **Replay** — Uses the **replay scheduler’s** current sample time (the event being processed), **not** wall clock. That keeps logs, ordering, and time-based branches aligned with the backtest stream. Do **not** use **`Date.now()`** or **`new Date()`** for strategy semantics: in replay, wall clock has nothing to do with the simulated period. ## Helpers: tag values and convert to ns From [`use-timestamp.ts`](https://github.com/quantform/quantform/blob/main/packages/core/src/use-timestamp.ts): | Helper | Meaning | | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | | **`ns(n)`**, **`us(n)`**, **`ms(n)`**, **`s(n)`** | Tag a `bigint` or `number` as that **unit** (not a conversion by itself). | | **`convert(value, from, to)`** | Scale between **`ns` / `us` / `ms` / `s`**. Use this to produce **`Timestamp<'ns'>`** for core APIs. | | **`add(a, b)`** | Add two timestamps **in the same unit**. | | **`now()`** | Wall-clock-aligned **nanoseconds** (when you need explicit time outside `useTimestamp`, still inside a valid runtime context). | **Example — milliseconds from JS → nanoseconds for an API that expects ns:** ```ts theme={null} import { convert, ms } from '@quantform/core'; const wallMs = Date.now(); const asNs = convert(ms(wallMs), 'ms', 'ns'); ``` **Example — combine a duration in ns with a base in ns:** ```ts theme={null} import { add, ns } from '@quantform/core'; const later = add(baseNsTimestamp, ns(1_000_000_000n)); // +1s in nanoseconds ``` ## Replay and “backend” time Replay options (**`from` / `to`**) are **`Timestamp<'ns'>`**. The CLI builds those from date strings by converting wall-clock bounds into ns before **`run`**. While a replay is executing, **`useTimestamp().timestamp`** tracks the **current replay sample**, not the machine clock. Treat that as the **authoritative “current time”** for anything that should behave the same in live and replay. ## Practical pattern Tag events with the replay-aware clock when the observation happens in your pipeline (must run under the module / strategy context): ```ts theme={null} import { map, type Observable } from 'rxjs'; import { useTimestamp } from '@quantform/core'; export function withEventTime(source: Observable) { return source.pipe( map(payload => { const { timestamp } = useTimestamp(); return { timestamp, payload }; }) ); } ``` If an external feed already carries an **exchange timestamp**, keep it for **market time**; use **`useTimestamp()`** when you need **run time** (when this node saw the event in this execution). ## Summary | Context | What you get from `useTimestamp().timestamp` | | ------------ | -------------------------------------------- | | Live / paper | Nanoseconds, wall-aligned via `now()` | | Replay | Nanoseconds for the **current replay event** | **Rule of thumb:** persist and compare in **ns**; convert **into** ns at system boundaries; use **`useTimestamp()`** anywhere strategy behavior depends on “now.” See replay execution and npm scripts in the guided walkthrough. # Overview Source: https://quantform.io/index Event-driven automation runtime for financial markets and protocols. It's an event-driven, composable runtime that models markets and protocols as deterministic streams and executes reactive backtesting-to-live workflows through reusable, environment-agnostic components. ## Your strategy, your control A developer-first runtime with full control over execution: * **You own the logic** - decisions are defined by your code. * **You choose the mode** - run in `paper`, `replay`, or `live`. * **You compose strategies** - reusable, reactive components. * **You keep one codebase** - promote the same code from test to production. Scaffold a project, compose streams with hooks, and run in paper, live, or replay. Combine funding streams across venues and derive a premium signal (example walkthrough). ## What you can build With quantform, you can build: * Systematic strategies across spot, derivatives, and multiple venues, * Execution systems with dynamic routing based on market conditions, * Automate workflows for portfolio, position, and risk management * Integrate with DeFi protocols for on-chain operations and trigger-based actions * Create real-time monitoring pipelines that detect events and respond programmatically quantform is an execution framework, not a profit guarantee. Always test in `paper` and `replay` modes before running any live strategy. ## What this means in practice Quantform turns market and protocol activity into event streams, so your automation can react to data in real time with deterministic behavior in testing. * **Works across venues and protocols** - connect centralized exchanges, DeFi protocols, and wallets in one system. * **Real-time by default** - react when market state changes, not through slow polling loops. * **One strategy, multiple environments** - run the same strategy in replay, paper, and live modes. * **Built for full automation** - automate more than orders, including rebalancing and execution workflows. ## Getting started Ready to build your first strategy? Scaffold a project, compose streams with hooks, and run in paper, live, or replay. Combine funding streams across venues and derive a premium signal (example walkthrough). # Quickstart Source: https://quantform.io/quickstart Scaffold a project, compose market streams with hooks, and run the same strategy in paper, live, or replay. This guide is about **getting oriented**, not about a particular trading idea. You will **scaffold a project**, then step through how market data becomes **streams of updates**, how **hooks** plug together, and how **one strategy** can run in **paper**, **live**, or **replay** mode. ## What this walkthrough covers You will learn how to: * **Define a strategy** as streams of events instead of manual polling loops. * **Combine streams** so derived values (“signals”) refresh whenever any input changes. * **Run on live venue data** real-time feeds, with reconnect/retry so the pipeline survives network hiccups. * **Backtest on stored history**: fetch, persist, replay; **same codebase** as live, no forked project. * **Hooks and composition**—bundle connections, storage, and logging once; reuse them and keep strategy files small. The sample uses **Binance**: live streams come from Binance’s public market feed, and replay pulls **historical trades from Binance Vision**. Those downloads can be **large**; the first sync for a wide date range may take noticeable time and bandwidth while data is fetched and stored. *** ## Create the project ### Prerequisites * Node.js and **npm** (the scaffold uses `npm` to install dependencies). * Network access when you run **live** or when **replay** syncs historical files from remote archives. Run the create tool with your project directory name (replace `my-strategy` if you like): ```bash theme={null} npx @quantform/create my-strategy ``` The CLI expects that folder name as its argument. ```bash theme={null} cd my-strategy ``` You should see a `src/` tree like: ```text theme={null} src/ app.ts # app entry: wires storage and starts your strategy function binance/ use-binance.ts # venue hook: bundles trade streams behind one API watch-trade.ts # chooses live vs replay, maps events to price stream watch-trade.live.ts # real-time trades from the public market feed watch-trade.replay.ts # historical trades: sync into storage, replay in order ``` The generated `package.json` includes scripts such as: * **`npm run start`** — paper / simulation run (non-live execution mode). * **`npm run live`** — live run with a real-time market feed. * **`npm run replay`** — backtest-style run over a date range (from / to are set in the script). *** ## Build the strategy Start from the entry [`app.ts`](https://github.com/quantform/quantform/blob/main/packages/create/template/app.ts). The first step is to define a **strategy hook**, your main entry, that **pulls in other hooks** and **turns their streams into signals** you can act on. In this walkthrough the strategy **listens to three Binance trade streams** (three symbols), **folds them into one combined stream** so you always see the latest prices together, and from that joint view **computes a spread** to surface **cross-market inefficiency**. ```ts theme={null} export function triangularArbitrageInefficiency() { const { watchTrade } = useBinance(); const { info } = useLogger('arbitrage'); return combineLatest([ watchTrade('btcusdc'), watchTrade('ethusdc'), watchTrade('ethbtc') ]).pipe( tap(([btcusdc, ethusdc, ethbtc]) => { const spread = ethusdc.div(btcusdc).sub(ethbtc).abs(); info(`spread: ${spread.toFixed(6)}`); }) ); } ``` The second half of [`app.ts`](https://github.com/quantform/quantform/blob/main/packages/create/template/app.ts) **registers modules**, exposes the **entry handle**, and **binds** your strategy to the runtime: ```ts theme={null} export default app().use(sqlite()).start(triangularArbitrageInefficiency); ``` * **`app()`** creates the base runtime and its **default dependency graph** (logging, execution context, in-memory storage factory, and other services hooks expect). * **`.use(sqlite())`** **registers** the SQLite-backed module so persistence-backed parts of the strategy resolve storage through the same graph. * **`.start(triangularArbitrageInefficiency)`** **binds** the strategy function to the runner: the runtime invokes it and **drives** the **main stream** it returns—your **strategy entry** tied to the running process. *** ## Strategy execution: live & replay **Live** — **Command** (project root): ```bash theme={null} npm run live ``` **Expect** — The **live** script drives the feed. For **BTCUSDC**, **ETHUSDC**, and **ETHBTC**, each update **recomputes** the spread and **prints** one log line (values follow the live market). **Replay (backtest)** — **Command** (project root). Change **`from` / `to`** in `package.json` if you need another window: ```bash theme={null} npm run replay ``` **Expect** — **First run** for a range: fetch historical trades from **external** sources, **persist** them, then **replay** in time order through the **same** strategy. **Output** matches live: **spread** lines from **stored** history. **First sync** can take longer while downloads finish. *** ## Technical walkthrough The sections below step through the strategy implementation: live feed, replay storage, switching live versus replay, venue hooks, and how they connect back to `app.ts`. ### 1. Real-time trades: `watchTradeLive` [`watch-trade.live.ts`](https://github.com/quantform/quantform/blob/main/packages/create/template/binance/watch-trade.live.ts) uses **`useSocket`** to subscribe to Binance **spot** composite stream trades. Incoming messages are schema validated, retried on failure, and mapped to a normalized `{ timestamp, payload: { price, size } }` shape. ```ts theme={null} export function watchTradeLive(symbol: string) { const { watch } = useSocket( `wss://stream.binance.com/stream?streams=${symbol.toLowerCase()}@trade` ); return watch().pipe( retry(), map(({ timestamp, payload }) => { const { data } = schema.parse(payload); return { timestamp, payload: { price: d(data.p), size: d(data.q) } }; }) ); } ``` `d(...)` builds decimal values suitable for precise math in the strategy layer. ### 2. Historical trades: `watchTradeReplay` [`watch-trade.replay.ts`](https://github.com/quantform/quantform/blob/main/packages/create/template/binance/watch-trade.replay.ts) uses **`useReplayStorage`** to manage historical data. The **`sync`** callback is invoked for the replay time range: it walks each day, downloads the Binance Vision **spot** daily trades ZIP for that symbol, parses CSV rows, and \*\*`storage.save`\*\*s normalized events. Then **`watch()`** emits events in timestamp order through the same `map` as live for a consistent payload shape. ```ts theme={null} export function watchTradeReplay(symbol: string) { const { watch } = useReplayStorage(uri(`binance://trade`, { symbol }), { sync: async (query, storage) => { const { min, max } = query.where.timestamp; // ... iterate days, fetch ZIP, parse rows, await storage.save([...]) } }); return watch().pipe( map(({ timestamp, payload }) => { const { 1: price, 2: quantity } = schema.parse(payload); return { timestamp, payload: { price: d(price), size: d(quantity) } }; }) ); } ``` ### 3. Execution mode: `useReplay` [`watch-trade.ts`](https://github.com/quantform/quantform/blob/main/packages/create/template/binance/watch-trade.ts) delegates to **`useReplay(watchTradeReplay, watchTradeLive)`**. That helper reads **`useExecutionMode()`**: in **replay** runs it uses the first function; otherwise it uses the second (live/paper paths both use the “real-time” implementation). ```ts theme={null} export function watchTrade(symbol: string) { return useReplay( watchTradeReplay, watchTradeLive )(symbol).pipe(map(it => it.payload.price)); } ``` The **`qf paper`**, **`qf live`**, and **`qf replay`** commands each inject the appropriate execution mode and replay options when they call **`run`** on your default export. ### 4. Venue composition: `useBinance` [`use-binance.ts`](https://github.com/quantform/quantform/blob/main/packages/create/template/binance/use-binance.ts) exposes a single object so strategy code does not import every low-level file: ```ts theme={null} export function useBinance() { return { watchTrade }; } ``` Keeping **venue-specific** wiring behind **`useBinance()`** lets you **reuse** the same Binance implementation in **other strategies** without copying imports or stream setup. ## Next steps Return to the product overview and execution model summary. Go deeper on hooks, tokens, and dependency wiring.