# Building A Strategy

{% hint style="info" %}
Strategies will soon be deprecated in favour of Solvers.
{% endhint %}

You can start building your first strategy by forking the [starter repo](https://github.com/haiko-xyz/strategy-template) and reading through the sample code to get started.

In this section, we explain some core concepts that will help with building your first strategy.

## Placing and updating positions

Haiko strategies rely on a push rather than pull architecture for position updates.

Rather than periodically submitting updates to the contract, positions are updated only when a swap is executed (and crucially, _before_ the swap occurs).&#x20;

The lifecycle of a swap is as follows:

1. User submits swap via `MarketManager`
2. `MarketManager` calls `update_positions()` and passes the execution context to the `Strategy` contract
3. Strategy executes logic to place, update or withdraw positions
4. Strategy passes execution context back to `MarketManager`
5. `MarketManager` executes swap

## Deploying a strategy

Strategies are deployed by creating a market and registering the strategy to that market upon deployment. At the moment, each market can have at most one strategy to limit the gas costs of swap execution.

Strategies must first be whitelisted by the protocol owner in order to be deployed.

## Deposits, withdrawals and fees

Strategy writers are free to implement proprietary logic for enabling third-party LP deposits and withdrawals, and charging associated fees on these actions.&#x20;

While official Haiko strategies will charge a small fee on withdrawals, this is not prescribed for third party strategies, but rather left at the discretion of strategy builders.
