private void Initialize(TransactionConstructParams param, ITransactionServiceFactory serviceFactory) { _settings = new TransactionSettings(this, param); _orders = new BusinessRecordList <Order>("Orders", this, DEFAULT_ITEMS_CAPACITY); _autoFillService = new Lazy <AutoFillServiceBase>(() => serviceFactory.CreateAutoFillService()); _ifDoneService = new Lazy <IfDoneService>(() => new IfDoneService(this, _settings)); _executeService = new Lazy <TransactionExecuteService>(() => serviceFactory.CreateExecuteService(this, _settings)); _cancelService = new Lazy <BLL.TransactionBusiness.CancelService>(() => new BLL.TransactionBusiness.CancelService(this, _settings)); _precheckVerifier = new Lazy <PreCheckVerifierBase>(() => serviceFactory.CreatePreCheckVerifier(this)); _preCheckService = new Lazy <TransactionPreCheckService>(() => serviceFactory.CreatePreCheckService(this)); _fillService = new Lazy <FillServiceBase>(() => serviceFactory.CreateFillService(this, _settings)); _executeNecessaryCheckService = new Lazy <TransactionExecuteNecessaryCheckServiceBase>(() => serviceFactory.CreateExecuteNecessaryCheckService()); _instrumentId = _settings.InstrumentId; _settingInstrument = Setting.Default.GetInstrument(_instrumentId); }
internal void OnInstrumentUpdated(Settings.Instrument instrument, Settings.InstrumentUpdateType updateType) { lock (_mutex) { Logger.InfoFormat("TradingSetting update instrument, updateType = {0}, instrument = {1}", updateType, instrument); if (updateType == Settings.InstrumentUpdateType.Add) { if (!_instrumentDict.ContainsKey(instrument.Id)) { _instrumentDict.Add(instrument.Id, new TradingInstrument(instrument)); } } else if (updateType == Settings.InstrumentUpdateType.Delete) { if (_instrumentDict.ContainsKey(instrument.Id)) { _instrumentDict.Remove(instrument.Id); } } } }