Instrument identifier

In S#, instruments from different sources use a unified Security.Id. This keeps trading algorithm code independent of the connection type, such as OpenECry, Rithmic, or Interactive Brokers.

Instrument identifiers use the following syntax: [instrument code]@[board code]. For Apple Inc. shares, the identifier is AAPL@NASDAQ. For derivatives, the board code is the board on which the contract is traded. For example, the June futures contract on the ES index can be identified as ESM5@NYSE.

Tip

Hydra uses the same mechanism to name folders with historical market data.

Overriding the identifier generation algorithm

  1. To generate instrument identifiers with your own algorithm, create a descendant of the SecurityIdGenerator class and override the SecurityIdGenerator.GenerateId(System.String secCode, System.String boardCode ) method:

    class CustomSecurityIdGenerator : SecurityIdGenerator
    {
       public override string GenerateId(string secCode, string boardCode)
       {
          // generate identifiers in CODE--BOARD format
          return secCode + "--" + boardCode;
       }
    }
    
  2. Pass the created generator to the connector:

    connector.SecurityIdGenerator = new CustomSecurityIdGenerator();