Table of Contents

Struct VolumeValueFactor

Namespace
ATAS.Indicators
Assembly
ATAS.Indicators.dll

Converts a traded volume of an instrument into money of one currency: money = volume × Multiplier × (PriceDependent ? price : 1).

Not in ATAS 8.0.15 yet: available from the next version.

public readonly struct VolumeValueFactor
Extension Methods

Remarks

Linear contracts (spot, USDT-margined futures, stock, CME futures) are price dependent: the multiplier is the contract size (point value) times the exchange rate. Inverse contracts have a fixed money value per contract, so the multiplier alone gives the value.

Constructors

VolumeValueFactor(decimal, bool, string)

Creates a factor.

public VolumeValueFactor(decimal multiplier, bool priceDependent, string currency)

Parameters

multiplier decimal

Money value of one unit of volume (per unit of price when priceDependent is true).

priceDependent bool

True when the money value depends on the trade price.

currency string

Currency code of the money value.

Properties

Currency

Currency code of the resulting money value.

public string Currency { get; }

Property Value

string

IsValid

True when the factor can convert volumes (a positive multiplier and a currency).

public bool IsValid { get; }

Property Value

bool

Multiplier

Money value of one unit of volume (per unit of price when PriceDependent is true).

public decimal Multiplier { get; }

Property Value

decimal

PriceDependent

True when the money value of a volume depends on the trade price.

public bool PriceDependent { get; }

Property Value

bool

Methods

Equals(VolumeValueFactor)

Determines whether the factor has the same multiplier, price dependence and currency (compared without regard to case).

public bool Equals(VolumeValueFactor other)

Parameters

other VolumeValueFactor

The factor to compare with.

Returns

bool

true when the factors are equal.

Equals(object?)

Determines whether the object is a factor with the same multiplier, price dependence and currency (compared without regard to case).

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with.

Returns

bool

true when the factors are equal.

GetHashCode()

Returns a hash code consistent with Equals(object?).

public override int GetHashCode()

Returns

int

The hash code.

ToMoney(decimal, decimal)

Returns the money value of a volume traded at a price.

public decimal ToMoney(decimal volume, decimal price)

Parameters

volume decimal
price decimal

Returns

decimal

ToString()

Returns the factor as text, for example 50 × price USD.

public override string ToString()

Returns

string

The text.

ToVolume(decimal, decimal)

Returns the volume worth money at a price. Returns decimal.MaxValue when the price or the multiplier does not allow the conversion.

public decimal ToVolume(decimal money, decimal price)

Parameters

money decimal
price decimal

Returns

decimal

WithRate(decimal, string)

Returns a copy of the factor with the multiplier scaled by an exchange rate into another currency.

public VolumeValueFactor WithRate(decimal rate, string currency)

Parameters

rate decimal
currency string

Returns

VolumeValueFactor

Operators

operator ==(VolumeValueFactor, VolumeValueFactor)

Equality operator.

public static bool operator ==(VolumeValueFactor left, VolumeValueFactor right)

Parameters

left VolumeValueFactor
right VolumeValueFactor

Returns

bool

operator !=(VolumeValueFactor, VolumeValueFactor)

Inequality operator.

public static bool operator !=(VolumeValueFactor left, VolumeValueFactor right)

Parameters

left VolumeValueFactor
right VolumeValueFactor

Returns

bool