tradingFee function

BigInt tradingFee(
  1. FeePolicy policy,
  2. Boundaries boundaries,
  3. BigInt quantity,
  4. BigInt timeToExpiryMs,
)

strike_exposure_config::trading_fee — the fee for a whole range, charged PER FINITE BOUNDARY with each leg floored and ramped independently. A binary order has one finite boundary and pays one leg; a two-sided range pays two, so it is not the same fee as the range's own probability would suggest.

Implementation

BigInt tradingFee(FeePolicy policy, Boundaries boundaries, BigInt quantity,
    BigInt timeToExpiryMs) {
  _assertFeePolicy(policy);
  _assertBoundaries(boundaries);
  _assertUint(quantity, 'quantity');
  _assertUint(timeToExpiryMs, 'timeToExpiryMs');
  final lowerUp = boundaries.lowerUp;
  final higherUp = boundaries.higherUp;
  final lower = lowerUp == null
      ? BigInt.zero
      : _legTradingFee(policy, lowerUp, quantity, timeToExpiryMs);
  final higher = higherUp == null
      ? BigInt.zero
      : _legTradingFee(policy, higherUp, quantity, timeToExpiryMs);
  return lower + higher;
}