# How It Works

## Flow

1. **Provider executes trade** (manual or AI bot).
2. **Execution Engine** listens for the trade.
3. **Risk Manager** scales trade to each follower’s portfolio.
4. **Avantis SDK** executes on-chain.
5. **Performance Engine** updates dashboards & leaderboards.

## Avantis SDK Integration

* Market Data: `priceFeed.getPrice(pair)`
* Pairs Info: `pairs.getAllPairs()`
* Trade: `trade.openTrade()`, `trade.closeTrade()`
* Risk: `trade.updateSLTP()`, `trade.updateMargin()`
* Orders: `orders.createLimitOrder()`, `orders.cancelLimitOrder()`
* Account: `user.getPositions()`, `user.getCollateralBalance()`
