Click or drag to resize

Index

IndexSecurity - the index built from instruments. For example, to set a spread in arbitrage or pair trading. It has the following implementations.

1. ExpressionIndexSecurity - is the index built from a combination of several instruments through the ExpressionFormula mathematical formula.

2. WeightedIndexSecurity - is the index built from instruments using weighting factors.

The ExpressionIndexSecurity creating

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

    C#
    private Security _instr1;
    private Security _instr2;
    
    private ExpressionIndexSecurity _indexInstr;
    
    private const string _secCode1 = "GZM5";
    private const string _secCode2 = "LKM5";
  2. To create the ExpressionIndexSecurity:

    C#
    _indexInstr = new ExpressionIndexSecurity
    {
        Id = "IndexInstr@NYSE",
        Expression = "ESM5@NYSE/APM5@NYSE",
        Board = ExchangeBoard.Nyse,
    };

The WeightedIndexSecurity creating

  1. 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 = "GZM5";
    private const string _secCode2 = "LKM5";
  2. To create the WeightedIndexSecurity:

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

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