示例#1
0
        public IdGenerator(ISecuritiesRepository securitiesRepository)
        {
            var securities = securitiesRepository.GetSecurityCodes().ToArray();
            var idLength   = (securities.Length - 1).ToString().Length;

            _securityPrefixes = securitiesRepository.GetSecurityCodes()
                                .OrderBy(s => s)
                                .Select((s, i) => new { Security = s, Prefix = i.ToString().PadLeft(idLength, '0') })
                                .ToDictionary(s => s.Security, s => s.Prefix);
        }
示例#2
0
 public OrdersRouter(IIdGenerator idGenerator, ISecuritiesRepository securitiesRepository, IServiceProvider serviceProvider)
 {
     _idGenerator      = idGenerator;
     _executionEngines = securitiesRepository.GetSecurityCodes()
                         .ToDictionary(s => _idGenerator.GetIdPrefix(s), s => (IExecutionEngine)serviceProvider.GetService(typeof(IExecutionEngine)));
 }
示例#3
0
 public OrderValidator(ISecuritiesRepository securitiesRepository)
 {
     _validSecurityCodes = new HashSet <string>(securitiesRepository.GetSecurityCodes());
 }