Choose the measured account or account group first. A deposit from outside that boundary is an external inflow; a withdrawal outside it is an external outflow. Moving collateral between two included subaccounts is internal to the group, although it may be external when measuring only one of them.
Trading PnL, funding and trading costs are part of the account's trading result, not external deposits. Keep trade reconciliation for matching those ledger records. This page assumes consistent USDT valuations and does not claim that a particular platform automatically produces a cashflow-adjusted report.