Click or drag to resize

Index

IndexSecurity - the index built from instruments.

And its implementation WeightedIndexSecurity - the index built from instruments with the use of weighting factors.

For example, when you want to build a spread between the two instruments ESM5 and APM5.

WeightedIndexSecurity creating

  1. To declare the compound instruments that will be included in WeightedIndexSecurity and in the WeightedIndexSecurity itself:

    C#
    private Security _instr1;
    private Security _instr2;
    private WeightedIndexSecurity _indexInstr;
    
    private const string _secCode1 = "ESM5";
    private const string _secCode2 = "APM5";
  2. To create the WeightedIndexSecurity:

    C#
    _indexInstr = new WeightedIndexSecurity() { ExchangeBoard = ExchangeBoard.Associated, Id = "IndexInstr" };
  3. To add the compound instruments in it:

    C#
    _indexInstr.Weights.Add(_instr1, 1);
    _indexInstr.Weights.Add(_instr2, -1);