DEV Community

Gueta Quant
Gueta Quant

Posted on Originally published at guetaquant.com AI-assisted

Measuring Currency Drift and Withdrawal Spreads on USD Trading Accounts in Python

Traders outside the United States often track equity curves strictly in USD, even when deposits, living expenses, and tax filings happen in local currency.

Over a multi-month period, exchange rate drift and payment-rail spreads can dominate strategy returns. If your account gains 10% in USD while the local currency strengthens by 8% against the dollar, your net return in local purchasing power drops to +1.20% before withdrawal fees.

Waterfall diagram showing official TRM vs gateway spread and transfer fees

Read the full Spanish analysis and access our live TRM converter at Riesgo cambiario y TRM en trading desde Colombia.

Modeling net local-currency proceeds

The function below separates strategy PnL, spot FX drift, percentage gateway spread, and fixed wire fees into a transparent waterfall:

def net_local_proceeds(
    deposit_cop: float,
    trm_entry: float,
    trm_exit: float,
    r_usd: float,
    gateway_spread_pct: float = 0.015,
    wire_fee_usd: float = 25.0,
) -> dict[str, float]:
    initial_usd = deposit_cop / trm_entry
    ending_usd = initial_usd * (1.0 + r_usd)
    withdrawable_usd = max(0.0, ending_usd - wire_fee_usd)
    effective_rate = trm_exit * (1.0 - gateway_spread_pct)
    net_cop = withdrawable_usd * effective_rate
    return {
        "ending_usd": round(ending_usd, 2),
        "gross_cop_at_trm": round(ending_usd * trm_exit, 0),
        "net_cop_received": round(net_cop, 0),
        "net_return_cop_pct": round((net_cop / deposit_cop - 1.0) * 100.0, 2),
    }


print(net_local_proceeds(10_000_000, 4100.0, 3950.0, 0.10))
Enter fullscreen mode Exit fullscreen mode

Logging both the USD statement and the official reference rate at deposit and withdrawal dates keeps operational attribution clean and simplifies annual tax reconciliation.

Educational and statistical analysis only (SFC Colombia Decreto 2555 de 2010). Not financial or tax advice.

Top comments (0)