/// <summary> /// Сохраняет свою сделку. /// </summary> /// <param name="fill">Данные своей сделки.</param> protected void AddFill(FillMessage fill) { if (!storeFillsInMemory) { return; } if (!IsPermittedAccount(fill.Account)) { return; } using (SyncRoot.Lock()) { Dictionary <Instrument, List <FillMessage> > accountFills; if (!AvailableAccounts.Contains(fill.Account)) { AvailableAccounts.Add(fill.Account); accountFills = new Dictionary <Instrument, List <FillMessage> >(); Fills.Add(fill.Account, accountFills); } else { accountFills = Fills[fill.Account]; } List <FillMessage> instrumentFills; if (!accountFills.TryGetValue(fill.Instrument, out instrumentFills)) { instrumentFills = new List <FillMessage>(); accountFills.Add(fill.Instrument, instrumentFills); } instrumentFills.Add(fill); } }
protected bool AddAccount(string account) { if (string.IsNullOrWhiteSpace(account)) { return(false); } if (!IsPermittedAccount(account)) { return(false); } using (SyncRoot.Lock()) { if (AvailableAccounts.Contains(account)) { return(false); } AvailableAccounts.Add(account); Fills.Add(account, new Dictionary <Instrument, List <FillMessage> >()); return(true); } }