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.

Создание ExpressionIndexSecurity

  1. Объявить составные инструменты, которые будут входить в ExpressionIndexSecurity и сам ExpressionIndexSecurity:

    C#
    private Security _instr1;
    private Security _instr2;
    
    private ExpressionIndexSecurity _indexInstr;
    
    private const string _secCode1 = "GZM5";
    private const string _secCode2 = "LKM5";
  2. Создать ExpressionIndexSecurity:

    C#
    _indexInstr = new ExpressionIndexSecurity
    {
        Id = "IndexInstr@FORTS",
        Expression = "GZM5@FORTS/LKM5@FORTS",
        Board = ExchangeBoard.Forts,
    };

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);