Skip to content

Commisions

Ben Bell edited this page Nov 15, 2024 · 1 revision

Commission Calculation Function Documentation

The commissions.py module contains a function for calculating the commission for trades based on different commission types.

Functions

calculate_commission(commisionType: str, commision: float, price: float, numShares: int) -> float

Calculates the commission for a trade based on the commission type and rate.

Parameters

  • commisionType (str): The type of commission (e.g., "FLAT", "PERCENTAGE", "PERCENTAGE_PER_SHARE", "PER_SHARE").
  • commision (float): The commission rate.
  • price (float): The price per share.
  • numShares (int): The number of shares.

Returns

  • float: The calculated commission.

Raises

  • InvalidCommissionTypeError: If the commission type is invalid.

Clone this wiki locally