#[non_exhaustive]pub enum RebalanceMode {
AvailableCapital,
EqualWeight,
CustomWeights(HashMap<String, f64>),
}Expand description
Controls how capital is divided among symbols when opening new positions.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
AvailableCapital
Use the base config’s position_size_pct of current available cash for each trade.
Natural “greedy” allocation — new positions are funded from whatever cash is on hand.
EqualWeight
Divide the initial capital equally among all available position slots.
Slot count = max_total_positions if set, else the number of symbols.
The per-slot target is initial_capital / slots, capped by available cash.
§Important: Anchored to Initial Capital
The allocation target is anchored to initial_capital, not to current
portfolio equity. This has two consequences:
-
Profitable portfolios: profits accumulate as uninvested cash — each new position still receives
initial_capital / slots. UseAvailableCapitalif you want profits to compound into new positions. -
Sequential positions in the same symbol: each entry (enter, exit, re-enter) independently receives the full slot allocation. The
max_total_positionscap controls only concurrent open positions, not lifetime capital per symbol.
CustomWeights(HashMap<String, f64>)
Custom per-symbol weight as a fraction of initial capital (0.0 – 1.0).
Symbols not present in the map receive no allocation. Weights do not need to sum to 1.0 — they can total less (leaving spare cash).
Trait Implementations§
Source§impl Clone for RebalanceMode
impl Clone for RebalanceMode
Source§fn clone(&self) -> RebalanceMode
fn clone(&self) -> RebalanceMode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RebalanceMode
impl Debug for RebalanceMode
Source§impl Default for RebalanceMode
impl Default for RebalanceMode
Source§fn default() -> RebalanceMode
fn default() -> RebalanceMode
Source§impl<'de> Deserialize<'de> for RebalanceMode
impl<'de> Deserialize<'de> for RebalanceMode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for RebalanceMode
impl RefUnwindSafe for RebalanceMode
impl Send for RebalanceMode
impl Sync for RebalanceMode
impl Unpin for RebalanceMode
impl UnsafeUnpin for RebalanceMode
impl UnwindSafe for RebalanceMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more