Skip to main content

SizingError

Enum SizingError 

Source
pub enum SizingError {
Show 23 variants InvalidRiskMultiplier { value: f64, }, InvalidFixedLots { value: f64, }, InvalidFixedRiskAmount { value: f64, }, InvalidBalanceRiskPercent { value: f64, }, InvalidBalanceBefore { value: f64, }, InvalidEntryPrice { value: f64, }, InvalidProtectiveStop { value: f64, }, MissingProtectiveStop, InvalidStopGeometry { side: Side, entry_price: f64, stop_price: f64, }, StopDistanceBelowTick { entry_price: f64, stop_price: f64, digits: u16, }, PriceOutOfRange { field: &'static str, value: f64, digits: u16, }, MissingAccountLossPerLot, InvalidAccountLossPerLot { value: f64, }, InvalidPricePrecision { digits: u16, pip_position: u16, }, InvalidLotBaseUnits { value: i64, }, InvalidLotStepUnits { value: i64, }, InvalidMinimumLotSteps { value: i64, }, InvalidMaximumLotSteps { maximum: i64, minimum: i64, }, InvalidScaledPolicyValue { base_value: f64, risk_multiplier: f64, }, InvalidScaledRawLot { value: f64, }, InvalidNativeLossPerLot { entry_price: f64, stop_price: f64, }, BelowMinimumLot { scaled_raw_lot: f64, floored_lot_steps: u64, minimum_lot_steps: u64, }, LotStepOverflow { scaled_raw_lot: f64, },
}
Expand description

Stable structured failures from compute_size.

Variants§

§

InvalidRiskMultiplier

The signal risk multiplier is not usable.

Fields

§value: f64

Invalid multiplier.

§

InvalidFixedLots

The fixed lot policy value is not usable.

Fields

§value: f64

Invalid lot quantity.

§

InvalidFixedRiskAmount

The fixed account risk policy value is not usable.

Fields

§value: f64

Invalid account-currency amount.

§

InvalidBalanceRiskPercent

The balance percentage policy value is not usable.

Fields

§value: f64

Invalid percentage.

§

InvalidBalanceBefore

The realized balance required by a balance policy is not usable.

Fields

§value: f64

Invalid realized balance.

§

InvalidEntryPrice

The authoritative entry price is not usable.

Fields

§value: f64

Invalid entry price.

§

InvalidProtectiveStop

The supplied protective stop is not usable.

Fields

§value: f64

Invalid stop price.

§

MissingProtectiveStop

A monetary policy was used without a protective stop.

§

InvalidStopGeometry

A stop is not on the loss side of the authoritative entry.

Fields

§side: Side

Trade side.

§entry_price: f64

Authoritative entry price.

§stop_price: f64

Protective stop price.

§

StopDistanceBelowTick

Entry and stop collapse to the same tick at the symbol price precision.

Fields

§entry_price: f64

Authoritative entry price.

§stop_price: f64

Protective stop price.

§digits: u16

Symbol price digits.

§

PriceOutOfRange

A price cannot be represented safely at the symbol precision.

Fields

§field: &'static str

Price field name.

§value: f64

Out-of-range price.

§digits: u16

Symbol price digits.

§

MissingAccountLossPerLot

A monetary policy did not receive an account-currency loss per lot.

§

InvalidAccountLossPerLot

The supplied account-currency loss per lot is not usable.

Fields

§value: f64

Invalid account-currency loss per lot.

§

InvalidPricePrecision

The symbol price precision is internally inconsistent or unsupported.

Fields

§digits: u16

Number of symbol price digits.

§pip_position: u16

Position of one pip.

§

InvalidLotBaseUnits

The symbol lot base unit count is invalid.

Fields

§value: i64

Invalid base unit count.

§

InvalidLotStepUnits

The symbol lot step unit count is invalid.

Fields

§value: i64

Invalid lot step unit count.

§

InvalidMinimumLotSteps

The symbol minimum lot step count is invalid.

Fields

§value: i64

Invalid minimum lot step count.

§

InvalidMaximumLotSteps

The symbol maximum lot step count is invalid.

Fields

§maximum: i64

Invalid maximum lot step count.

§minimum: i64

Configured minimum lot step count.

§

InvalidScaledPolicyValue

Applying the signal multiplier produced an unusable policy value.

Fields

§base_value: f64

Unscaled fixed lots or account risk.

§risk_multiplier: f64

Signal risk multiplier.

§

InvalidScaledRawLot

Monetary division produced an unusable raw lot quantity.

Fields

§value: f64

Invalid raw lot quantity.

§

InvalidNativeLossPerLot

The computed native loss for one lot overflowed.

Fields

§entry_price: f64

Authoritative entry price.

§stop_price: f64

Protective stop price.

§

BelowMinimumLot

The floored lot quantity does not meet the symbol minimum.

Fields

§scaled_raw_lot: f64

Lot quantity before constraints.

§floored_lot_steps: u64

Lot steps after flooring.

§minimum_lot_steps: u64

Required minimum lot steps.

§

LotStepOverflow

The lot quantity cannot be represented by the authoritative step count.

Fields

§scaled_raw_lot: f64

Lot quantity before constraints.

Trait Implementations§

Source§

impl Clone for SizingError

Source§

fn clone(&self) -> SizingError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SizingError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SizingError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for SizingError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for SizingError

Source§

fn eq(&self, other: &SizingError) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SizingError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V