Skip to main content

Module sizing

Module sizing 

Source
Expand description

Notional-based position sizing.

Generalized from kucoin/bot/sizing.rs. Computes the integer number of contracts (or base-asset units) that corresponds to a desired margin commitment at the current price and leverage:

notional   = margin_usd × leverage
contracts  = floor(notional / (price × contract_value))
contracts  = min(contracts, max_contracts)

The contract_value is exchange- and symbol-specific (0.001 BTC for XBTUSDTM, 0.01 ETH for ETHUSDTM, 1.0 SOL for SOLUSDTM). The framework gets it from the ExchangeClient adapter — see the v0 trait extension discussed in kucoin-v2/DESIGN_NOTES.md.

Structs§

PositionSizer
Computes order sizes from margin + leverage + price + contract multiplier.
SizingConfig
Configuration for PositionSizer.