private void MergeFields(AccountDataFieldList srcList, AccountDataFieldList dstList) { foreach (AccountDataField accountDataField in srcList) { dstList[accountDataField.Name, accountDataField.Currency] = accountDataField.Value; } }
private void CopyFields(AccountDataFieldList srcList, AccountDataFieldList dstList) { foreach (AccountDataField accountDataField in srcList) { dstList.Add(accountDataField.Name, accountDataField.Currency, accountDataField.Value); } }
public AccountData(DateTime datetime, AccountDataType type, string account, byte providerId, byte route) : base(datetime) { this.Type = type; this.Account = account; this.ProviderId = providerId; this.Route = route; this.Fields = new AccountDataFieldList(); }
internal void OnAccountData(AccountData data) { AccountDataTable table = this.GetTable(data.ProviderId, data.Route, true); lock (table) { AccountDataTableItem accountDataTableItem; if (!table.Items.TryGetValue(data.Account, out accountDataTableItem)) { accountDataTableItem = new AccountDataTableItem(); table.Items.Add(data.Account, accountDataTableItem); } switch (data.Type) { case AccountDataType.AccountValue: this.MergeFields(data.Fields, accountDataTableItem.Values); break; case AccountDataType.Position: { AccountDataKey key = new AccountDataKey(data, new string[] { "Symbol", "Maturity", "PutOrCall", "Strike" }); AccountDataFieldList accountDataFieldList; if (!accountDataTableItem.Positions.TryGetValue(key, out accountDataFieldList)) { accountDataFieldList = new AccountDataFieldList(); accountDataTableItem.Positions.Add(key, accountDataFieldList); } accountDataFieldList.Clear(); this.CopyFields(data.Fields, accountDataFieldList); break; } case AccountDataType.Order: { AccountDataKey key2 = new AccountDataKey(data, new string[] { "OrderID" }); AccountDataFieldList accountDataFieldList2; if (!accountDataTableItem.Orders.TryGetValue(key2, out accountDataFieldList2)) { accountDataFieldList2 = new AccountDataFieldList(); accountDataTableItem.Orders.Add(key2, accountDataFieldList2); } accountDataFieldList2.Clear(); this.CopyFields(data.Fields, accountDataFieldList2); break; } } } }