> For the complete documentation index, see [llms.txt](https://quantinfra.gitbook.io/quantinfra-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://quantinfra.gitbook.io/quantinfra-docs/strategies/deploying-strategies.md).

# Deploying strategies

Once you [implement a strategy](/quantinfra-docs/strategies/implementing-strategies.md), you can launch it.

When creating a new instance of a strategy in the Control Panel, the following must be provided:

* Name of the C# class containing the strategy
* [Strategy config](/quantinfra-docs/strategies/strategy-configuration.md) containing the list of contracts the strategy trades, market data it uses, and parameters
* Type of the account on which the strategy will be executed:
  * Virtual account — a paper-trading account inside the platform. Results of the trading may be copied to one or several ESAs (Executable Subaccounts).
  * Strategy subaccount — a subaccount within some Broker Account configured in the platform.
* Accounts Service instance to host the account
* Strategies Service instance to host the strategy
  * There is 1:N link between AS and SS — multiple instances of Strategies Service can use one Accounts Service
  * Every Strategies Service can host one or several strategies

Deploying a new strategy requires restarting the respective Strategies Service.

## States

A strategy can be in one of 4 states:

* Stopped
* Running
* Paused
  * Positions, if any, remain open, but Strategies Service doesn’t invoke any callbacks of the strategy
* Stopping
  * Strategies Service invokes the OnStopRequested callback and waits for the strategy to close all positions and confirm it is now stopped

Transition between states can be triggered from the Control Panel.

## Strategy subaccounts and broker accounts

One broker account can host multiple strategies, each running on its own subaccount. A particular strategy operates within its subaccount and therefore sees only the orders and positions belonging to it.

A subaccount may be linked to one or several broker accounts. The latter is required if your strategy trades different contracts provided by different brokers. The contract specification defines which of the broker accounts an order will be routed to.

Once the broker account is determined, the platform will populate the order's BrokerAccountId property. All orders from different strategies can be viewed in the broker account.

> Note: virtual orders (Stop, Market-if-touched, and synthetic contract orders) are not reflected in the broker account until the platform triggers them and sends them for execution.

The broker account receives all broker updates and forwards execution reports to the strategy subaccounts.

The trades received from the broker are first booked to the broker account, so the aggregated position and balances are tracked there and can be reconciled against the broker. When an incoming trade can be linked to a specific order coming from one of the subaccounts, it will be automatically allocated to that account, so that the strategy’s position is updated. The allocation is a separate trade, linked to the original one using the OrigTradeId property.

When an order or a trade received from the broker cannot be traced to a subaccount (for instance, because the order was submitted from the broker’s trading platform) it will be booked only to the broker account. A special report available in the Control Panel allows to reconcile all holdings, positions, and PnL of the broker account against its subaccounts.

## Virtual accounts

A strategy may be executed on a virtual (paper trading) account inside the platform.

Execution of orders is checked against the incoming market data. The frequency of ticks is configured at the platform level.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://quantinfra.gitbook.io/quantinfra-docs/strategies/deploying-strategies.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
