Expand description
Price and size calculation utilities
Functionsยง
- calculate_
slippage - Calculate maximum slippage for market order
- decimal_
to_ token_ units - Convert decimal to token units (6 decimal places)
- is_
valid_ price - Check if price is within valid range [tick_size, 1-tick_size]
- is_
valid_ price_ fast - Check if price is within valid range (FAST VERSION)
- mid_
price - Calculate mid price (LEGACY - use fixed-point version when possible)
- mid_
price_ fast - Calculate mid price (FAST VERSION)
- notional
- Calculate notional value (price * size) (LEGACY - use fixed-point version when possible)
- notional_
fast - Calculate notional value (price * size) (FAST VERSION)
- round_
to_ tick - Round price to tick size (LEGACY - use fixed-point version when possible)
- round_
to_ tick_ fast - Round price to tick size (FAST VERSION)
- spread_
fast - Calculate spread in ticks (FAST VERSION)
- spread_
pct - Calculate spread as percentage (LEGACY - use fixed-point version when possible)
- spread_
pct_ fast - Calculate spread as percentage (FAST VERSION)
- token_
units_ to_ decimal - Convert token units back to decimal