Ejemplo n.º 1
0
        internal void OnAccountData(AccountData data)
        {
            var @class = GetTable(data.ProviderId, data.Route, true);

            lock (@class)
            {
                AccountDataTableItem class2;
                if ([email protected](data.Account, out class2))
                {
                    class2 = new AccountDataTableItem();
                    @class.Items.Add(data.Account, class2);
                }
                switch (data.Type)
                {
                case AccountDataType.AccountValue:
                    MergeFields(data.Fields, class2.Values);
                    break;

                case AccountDataType.Position:
                {
                    AccountDataKey       key = new AccountDataKey(data, new[] { "Symbol", "Maturity", "PutOrCall", "Strike" });
                    AccountDataFieldList list;
                    if (!class2.Positions.TryGetValue(key, out list))
                    {
                        list = new AccountDataFieldList();
                        class2.Positions.Add(key, list);
                    }
                    list.Clear();
                    CopyFields(data.Fields, list);
                    break;
                }

                case AccountDataType.Order:
                {
                    AccountDataKey       key2 = new AccountDataKey(data, new[] { "OrderID" });
                    AccountDataFieldList list;
                    if (!class2.Orders.TryGetValue(key2, out list))
                    {
                        list = new AccountDataFieldList();
                        class2.Orders.Add(key2, list);
                    }
                    list.Clear();
                    CopyFields(data.Fields, list);
                    break;
                }
                }
            }
        }
Ejemplo n.º 2
0
 internal void OnAccountData(AccountData data)
 {
     var @class = GetTable(data.ProviderId, data.Route, true);
     lock (@class)
     {
         AccountDataTableItem class2;
         if ([email protected](data.Account, out class2))
         {
             class2 = new AccountDataTableItem();
             @class.Items.Add(data.Account, class2);
         }
         switch (data.Type)
         {
             case AccountDataType.AccountValue:
                 MergeFields(data.Fields, class2.Values);
                 break;
             case AccountDataType.Position:
                 {
                     AccountDataKey key = new AccountDataKey(data, new[] { "Symbol", "Maturity", "PutOrCall", "Strike" });
                     AccountDataFieldList list;
                     if (!class2.Positions.TryGetValue(key, out list))
                     {
                         list = new AccountDataFieldList();
                         class2.Positions.Add(key, list);
                     }
                     list.Clear();
                     CopyFields(data.Fields, list);
                     break;
                 }
             case AccountDataType.Order:
                 {
                     AccountDataKey key2 = new AccountDataKey(data, new[] { "OrderID" });
                     AccountDataFieldList list;
                     if (!class2.Orders.TryGetValue(key2, out list))
                     {
                         list = new AccountDataFieldList();
                         class2.Orders.Add(key2, list);
                     }
                     list.Clear();
                     CopyFields(data.Fields, list);
                     break;
                 }
         }
     }
 }