internal void InitializeTransaction(IDataReader dr, Dictionary <Guid, Transaction> trans) { try { Guid accountId = (Guid)dr["AccountID"]; Account account = _tradingSetting.GetAccount(accountId); if (account == null) { Logger.WarnFormat("account = {0} not exist but exist transaction", accountId); return; } var orderType = (OrderType)(int)dr["OrderTypeID"]; var instrumentCategory = (InstrumentCategory)dr["InstrumentCategory"]; TransactionPhase phase = (TransactionPhase)(byte)dr["Phase"]; if (phase == TransactionPhase.Canceled) { return; } var factory = TransactionFacade.CreateAddTranCommandFactory(orderType, instrumentCategory); var command = factory.Create(account, new DBReader(dr), OperationType.None); command.Execute(); var tran = command.Result; trans.Add(tran.Id, tran); } catch (Exception ex) { Logger.Error(ex); } }
internal void InitializeInstrumentResetStatus(IDBRow dr) { if (dr["LastResetDay"] == DBNull.Value) { return; } Guid accountId = (Guid)dr["AccountID"]; Guid instrumentId = (Guid)dr["InstrumentID"]; DateTime lastResetDay = (DateTime)dr["LastResetDay"]; var account = _tradingSetting.GetAccount(accountId); if (account == null) { Logger.ErrorFormat("ParseInstrumentLastResetDay can't find account = {0}, instrumentId= {1}, lastResetDay = {2}", accountId, instrumentId, lastResetDay); return; } var instrument = account.GetOrCreateInstrument(instrumentId); instrument.LastResetDay = lastResetDay; }