```\nfunction _placePerpOrder(\n    uint256 amount,\n    bool isShort,\n    bool amountIsInput,\n    uint160 sqrtPriceLimit\n) private returns (uint256, uint256) {\n    uint256 upperBound = 0; // 0 = no limit, limit set by sqrtPriceLimit\n\n    IClearingHouse.OpenPositionParams memory params = IClearingHouse\n        .OpenPositionParams({\n            baseToken: market,\n            isBaseToQuote: isShort, // true for short\n            isExactInput: amountIsInput, // we specify exact input amount\n            amount: amount, // collateral amount - fees\n            oppositeAmountBound: upperBound, // output upper bound\n            // solhint-disable-next-line not-rely-on-time\n            deadline: block.timestamp,\n            sqrtPriceLimitX96: sqrtPriceLimit, // max slippage\n            referralCode: 0x0\n        });\n\n    (uint256 baseAmount, uint256 quoteAmount) = clearingHouse.openPosition(\n        params\n    );\n\n    uint256 feeAmount = _calculatePerpOrderFeeAmount(quoteAmount);\n    totalFeesPaid += feeAmount;\n\n    emit PositionOpened(isShort, amount, amountIsInput, sqrtPriceLimit);\n    return (baseAmount, quoteAmount);\n}\n\nfunction _calculatePerpOrderFeeAmount(uint256 amount)\n    internal\n    view\n    returns (uint256)\n{\n    return amount.mulWadUp(getExchangeFeeWad());\n}\n```\n