Worked exercise
In Demo or with a prior receipt, identify the pair, direction and order identifier. Match each execution price and quantity; multiply, add the notionals and divide by the filled units. Then find the currency and amount of the fees before comparing balances.
Limitations
A canceled order can still have partial fills. A market preview is not a guaranteed price. Make sure the order was spot rather than a margin or perpetual position before using the calculator.