예제 #1
0
 private static void CopyFields(AccountDataFieldList srcList, AccountDataFieldList dstList)
 {
     foreach (AccountDataField f in srcList)
     {
         dstList.Add(f.Name, f.Currency, f.Value);
     }
 }
예제 #2
0
 private static void MergeFields(AccountDataFieldList srcList, AccountDataFieldList dstList)
 {
     foreach (AccountDataField f in srcList)
     {
         dstList[f.Name, f.Currency] = f.Value;
     }
 }
예제 #3
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;
                }
                }
            }
        }
예제 #4
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;
                 }
         }
     }
 }
예제 #5
0
 private static void CopyFields(AccountDataFieldList srcList, AccountDataFieldList dstList)
 {
     foreach (AccountDataField f in srcList)
         dstList.Add(f.Name, f.Currency, f.Value);
 }
예제 #6
0
 private static void MergeFields(AccountDataFieldList srcList, AccountDataFieldList dstList)
 {
     foreach (AccountDataField f in srcList)
         dstList[f.Name, f.Currency] = f.Value;
 }