avantis_trader_sdk.compute reimplements the Avantis app’s math as pure functions: no I/O, human units in and out. Numbers match what the UI displays.
PnL
Liquidation
Position.liquidation_price from the core API is authoritative.
Fees & liquidity
TP/SL conversion
Convert between trigger prices and gain/loss percentages, as the UI does:pnl_order_min_sl(leverage) gives the minimum SL percent for Upside positions.
Pre-trade validation
Run the UI’s full pre-trade rulebook locally before submitting:skip_validation=True.