Skip to content

Instantly share code, notes, and snippets.

@sambacha
Created November 21, 2025 17:48
Show Gist options
  • Select an option

  • Save sambacha/51da46002857924df1991fd9b89be519 to your computer and use it in GitHub Desktop.

Select an option

Save sambacha/51da46002857924df1991fd9b89be519 to your computer and use it in GitHub Desktop.
CSRU Cost for Venue trading

Cost Components per Trade

Tading costs at the unit level. For a single round-trip trade (buy and sell), the total cost comprises:

$$C_{\text{unit}} = \text{Commission}_{\text{per unit}} + \text{Slippage}_{\text{per unit}}$$

Where slippage represents the market impact and execution shortfall. For retail traders:

$$\text{Slippage}_{\text{per unit}} \approx \frac{1}{2} \times \text{Bid-Ask Spread}_{\text{per unit}}$$

Sharpe Ratio Units

CSRU - basis points per year Sharpe ratio is degraded by trading costs

$$\text{CSRU} = \frac{\text{Total Annualized Cost}}{\sigma_{\text{annual}}}$$

Where:

  • $\sigma_{\text{annual}}$ = annualized volatility of the asset
  • Total Annualized Cost = $f(C_{\text{unit}}, T_V)$
  • $T_V$ = annual turnover of the trading system

Dynamic Trading Speed Calibration

  • High-cost markets: Require larger window sizes → Lower turnover → Reduced total costs
  • Low-cost markets: Permit smaller window sizes → Higher turnover → Still acceptable total costs

Implementation Formula

For a trend-following system using linear regression over $n$ periods, the window size selection can be approximated as:

$$n_{\text{optimal}} \propto \sqrt{\frac{C_{\text{unit}} \cdot \text{Volatility}}{\text{Cost Threshold}}}$$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment