Module trading

Source
Expand description

Trading constants and utilities

Constants§

DEFAULT_MAKER_FEE_RATE
Default maker fee rate (0.1%)
DEFAULT_STOP_LOSS_BPS
Default stop loss in basis points.
DEFAULT_TAKER_FEE_RATE
Default taker fee rate (0.1%)
DEFAULT_TAKE_PROFIT_BPS
Default take profit in basis points.
HIGH_FEE_BPS
High fee in basis points.
MAKER_FEE_BPS
Common fee rates in basis points (compile-time calculated)
MAX_LEVERAGE
Risk management constants
MAX_OPEN_ORDERS_PER_SYMBOL
Maximum number of open orders per symbol
MAX_ORDER_SIZE
Maximum order size (safety limit)
MAX_POSITION_PCT
Maximum position size as percentage of account balance
MIN_ORDER_SIZE
Minimum order size (common across many exchanges)
TAKER_FEE_BPS
Default taker fee in basis points.

Functions§

calculate_fee_bps
Const fn helpers for trading calculations
max_position_size
Calculates the maximum position size based on account balance and risk percentage.
optimal_order_count
Calculates the optimal number of orders based on total size and minimum order size.
risk_adjusted_size
Adjusts the order size based on a risk factor.