Optimize strategy weights, apply vol targeting, and automate order placement.
The management system reads backtest results from all your strategies, finds the weight allocation that maximizes portfolio momentum, and turns it into a dollar amount per strategy. The reconciler then keeps your live exchange positions in line with those amounts.
strategy.py ──► state.json ──────────┐
(cron) stats.json ├──► reconciler.py ──► exchange
manager.py ──► portfolio_config.json ┘
Run a backtest for each strategy. This writes stats.json (including daily returns) to the strategy folder.
python3 strategies/my_strategy/strategy.py
Strategies without stats.json are skipped by the manager.
Run the portfolio optimizer. It reads all stats.json files and finds weights that maximize the slope/std of the combined equity curve.
python3 manager/manager.py --target-vol 0.30
--target-vol 0.30 sets your target annual volatility (30%). The manager computes leverage = target_vol / portfolio_vol and stores it in portfolio_config.json.
Review manager/portfolio_config.json. It holds each strategy's dollar amount (amounts) — the live sizing base — plus exchange routing and the optimizer's weights and leverage.
{
"amounts": {
"btc_ti_24h": 6000,
"btc_ti_24h_short": 4000
},
"exchanges": {
"btc_ti_24h": "bingx",
"btc_ti_24h_short": "bingx"
},
"weights": {
"btc_ti_24h": 0.60,
"btc_ti_24h_short": 0.40
},
"leverage": 2.62
}
Sizing is amount-based: target = amount × position. Never edit this file by hand — set amounts from the workspace Trading setup page (or ask the agent), and apply optimizer weights only via manager.py --apply.
Start the reconciler. It polls every 5 seconds and reconciles whenever a strategy signal, your amounts, or the kill switch changes — plus a safety-net pass every 5 minutes.
bash manager/start_reconciler.sh
Connecting an exchange wires get_positions() and place_order() to that exchange's order library — the agent does this for you.
The manager maximizes slope / std of the portfolio equity curve over the last N days (default 365). Slope is computed by fitting a linear regression to the cumulative return series — a steeper upward curve scores higher. Dividing by std penalizes volatility, so the optimizer naturally favors steady-climbing strategies over erratic ones.
After finding the optimal weights, the manager computes the portfolio's annualized volatility and derives a leverage factor: leverage = target_vol / ann_vol. This scales all position sizes so the portfolio's realized risk matches your target regardless of how volatile the underlying strategies are.