Table of Contents

Class ConstraintAttribute

Namespace
Balsam
Assembly
Balsam.Backtester.dll

An attribute used to constrain values in an optimization relative to another value.

[AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
public sealed class ConstraintAttribute : Attribute
Inheritance
ConstraintAttribute
Inherited Members
Extension Methods

Constructors

ConstraintAttribute(string)

Initializes a new ConstraintAttribute using the specified string (e.g. Property1 >= Property2).

public ConstraintAttribute(string constraint)

Parameters

constraint string

ConstraintAttribute(string, ComparisonOperator, string)

Initializes a new ConstraintAttribute using the specified parameters.

public ConstraintAttribute(string leftProperty, ComparisonOperator comparison, string rightProperty)

Parameters

leftProperty string
comparison ComparisonOperator
rightProperty string

Properties

Comparison

Gets the comparison operator.

public ComparisonOperator Comparison { get; }

Property Value

ComparisonOperator

LeftProperty

Gets the left hand side of the comparison.

public string LeftProperty { get; }

Property Value

string

RightProperty

Gets the right hand side of the comparison.

public string RightProperty { get; }

Property Value

string

Methods

IsValid(IEnumerable<KeyValuePair<string, double>>)

Returns true if none of the specified key value pairs violate this constraint.

public bool IsValid(IEnumerable<KeyValuePair<string, double>> targetValues)

Parameters

targetValues IEnumerable<KeyValuePair<string, double>>

Returns

bool

ToString()

Returns a string representation of this constraint.

public override string ToString()

Returns

string