private static ReactiveTable GetRatesTable()
        {
            var fxRates = new ReactiveTable();

            fxRates.AddColumn(new ReactiveColumn <string>(FxTableDefinitions.FxRates.CcyPairId));
            fxRates.AddColumn(new ReactiveColumn <double>(FxTableDefinitions.FxRates.Bid));
            fxRates.AddColumn(new ReactiveColumn <double>(FxTableDefinitions.FxRates.Ask));
            fxRates.AddColumn(new ReactiveColumn <double>(FxTableDefinitions.FxRates.Open));
            fxRates.AddColumn(new ReactiveColumn <double>(FxTableDefinitions.FxRates.Close));
            fxRates.AddColumn(new ReactiveColumn <double>(FxTableDefinitions.FxRates.YearRangeStart));
            fxRates.AddColumn(new ReactiveColumn <double>(FxTableDefinitions.FxRates.YearRangeEnd));
            fxRates.AddColumn(new ReactiveColumn <double>(FxTableDefinitions.FxRates.Change));
            var timeColumn = new ReactiveColumn <DateTime>(FxTableDefinitions.FxRates.Time);

            fxRates.AddColumn(timeColumn);
//            var tickColumn = new ReactiveColumn<long>(FxTableDefinitions.FxRates.Ticks);
//            fxRates.AddColumn(tickColumn);
            fxRates.AddColumn(new ReactiveCalculatedColumn1 <double, DateTime>(CalculateColumns.FxRates.LongTime,
                                                                               timeColumn,
                                                                               time => (DateTime.UtcNow - time).TotalMilliseconds));

            /*fxRates.AddColumn(new ReactiveCalculatedColumn1<long, long>(CalculateColumns.FxRates.Micros,
             *                                                          tickColumn,
             *                                                          tickStart =>
             *                                                          {
             *                                                              var ticksElapsed = DateTime.Now.Ticks - _start.Ticks;
             *                                                              return (ticksElapsed - tickStart) * 10;
             *                                                          }));*/
            return(fxRates);
        }
 public OneSimpleTableTest(int?initialSize = null)
 {
     _table = new ReactiveTable();
     _table.AddColumn(new ReactiveColumn <int>("IdCol", initialSize: initialSize));
     _table.AddColumn(new ReactiveColumn <string>("TextCol", initialSize: initialSize));
     _table.AddColumn(new ReactiveColumn <decimal>("ValueCol", initialSize: initialSize));
 }
Exemple #3
0
        public SimpleGroupTestViewModel()
        {
            _table1 = new ReactiveTable();
            var groupColumn = new ReactiveColumn <string>(GroupColumnId);

            _table1.AddColumn(groupColumn);
            var valueColumn = new ReactiveColumn <int>(ValueColumnId);

            _table1.AddColumn(valueColumn);
//            ReactiveTable table2 = new ReactiveTable();
//            table2.AddColumn(new ReactiveColumn<string>("GroupColumn2"));
//            table2.AddColumn(new ReactiveColumn<int>("ValueColumn2"));

            _groupedTable = new AggregatedTable(_table1);
            _groupedTable.GroupBy <string>(groupColumn.ColumnId);
            _groupedTable.AddAggregate(groupColumn, CountColumnId, () => new Count <string>());
            _groupedTable.AddAggregate(valueColumn, SumColumnId, () => new Sum <int>());
            _groupedTable.AddAggregate(valueColumn, AverageColumnId, () => new Average <int>());
            _groupedTable.AddAggregate(valueColumn, MinColumnId, () => new Min <int>());
            _groupedTable.AddAggregate(valueColumn, MaxColumnId, () => new Max <int>());

            LoadDataCommand = new DelegateCommand(LoadData);
            Items           = new ObservableCollection <SimpleGroupItem>();

            _groupedTable.RowUpdates().Subscribe(OnRowUpdate);
        }
Exemple #4
0
        public static ReactiveTable CreateIndexedReactiveTable()
        {
            var table = new ReactiveTable();

            table.AddColumn(new ReactiveColumn <int>(TestTableColumns.IdColumn, new ColumnIndex <int>()));
            table.AddColumn(new ReactiveColumn <string>(TestTableColumns.StringColumn, new ColumnIndex <string>()));
            table.AddColumn(new ReactiveColumn <decimal>(TestTableColumns.DecimalColumn, new ColumnIndex <decimal>()));
            return(table);
        }
Exemple #5
0
 public TestBase(int?initialSize)
 {
     Table = new ReactiveTable();
     Table.AddColumn(new ReactiveColumn <int>(IdCol, initialSize: initialSize));
     Table.AddColumn(new ReactiveColumn <string>(TextCol, initialSize: initialSize));
     Table.AddColumn(new ReactiveColumn <decimal>(ValueCol, initialSize: initialSize));
     Table.AddColumn(new ReactiveColumn <double>(DoubleCol, initialSize: initialSize));
     Table.AddColumn(new ReactiveColumn <bool>(BoolCol, initialSize: initialSize));
 }
Exemple #6
0
        public static ReactiveTable CreateReactiveTable2()
        {
            var table = new ReactiveTable();

            table.AddColumn(new ReactiveColumn <int>(TestTableColumns.IdColumn2));
            table.AddColumn(new ReactiveColumn <int>(TestTableColumns.OtherIdColumn2));
            table.AddColumn(new ReactiveColumn <string>(TestTableColumns.StringColumn2));
            table.AddColumn(new ReactiveColumn <decimal>(TestTableColumns.DecimalColumn2));
            return(table);
        }
Exemple #7
0
        private static ReactiveTable GetCurrenciesTable()
        {
            var currencies = new ReactiveTable();

            currencies.AddColumn(new ReactiveColumn <int>(FxTableDefinitions.CurrencyPair.Id));
            currencies.AddColumn(new ReactiveColumn <string>(FxTableDefinitions.CurrencyPair.CcyPair));
            currencies.AddColumn(new ReactiveColumn <string>(FxTableDefinitions.CurrencyPair.Ccy1));
            currencies.AddColumn(new ReactiveColumn <string>(FxTableDefinitions.CurrencyPair.Ccy2));
            return(currencies);
        }
        public void TestGrouping()
        {
            var table1        = new ReactiveTable();
            var GroupColumnId = "GroupCol";
            var groupColumn   = new ReactiveColumn <string>(GroupColumnId);

            table1.AddColumn(groupColumn);
            var ValueColumnId  = "ValueCol";
            var reactiveColumn = new ReactiveColumn <int>(ValueColumnId);
            var valueColumn    = reactiveColumn;

            table1.AddColumn(valueColumn);
            //            ReactiveTable table2 = new ReactiveTable();
            //            table2.AddColumn(new ReactiveColumn<string>("GroupColumn2"));
            //            table2.AddColumn(new ReactiveColumn<int>("ValueColumn2"));

            var groupedTable = new AggregatedTable(table1);

            groupedTable.GroupBy <string>(groupColumn.ColumnId);
            var CountColumnId = "Count";

            groupedTable.AddAggregate(groupColumn, CountColumnId, () => new Count <string>());
            var SumColumnId = "Sum";

            groupedTable.AddAggregate(valueColumn, SumColumnId, () => new Sum <int>());
            var AverageColumnId = "Average";

            groupedTable.AddAggregate(valueColumn, AverageColumnId, () => new Average <int>());
            var MinColumnId = "Min";

            groupedTable.AddAggregate(valueColumn, MinColumnId, () => new Min <int>());
            var MaxColumnId = "Max";

            groupedTable.AddAggregate(valueColumn, MaxColumnId, () => new Max <int>());

            RunTest(
                count =>
            {
                for (var i = 0; i < count; i++)
                {
                    var name1 = "Mendel" + i;
                    var name2 = "Marie" + i;
                    AddRow(name1, 42, table1, GroupColumnId, ValueColumnId);
                    AddRow(name2, 43, table1, GroupColumnId, ValueColumnId);
                    AddRow(name1, 44, table1, GroupColumnId, ValueColumnId);
                    AddRow(name2, 45, table1, GroupColumnId, ValueColumnId);
                    AddRow(name1, 46, table1, GroupColumnId, ValueColumnId);
                    AddRow(name2, 45, table1, GroupColumnId, ValueColumnId);
                }
            }, 10000);
        }
Exemple #9
0
        public FullJoinedTablesTest()
        {
            _table = new ReactiveTable();
            _table.AddColumn(new ReactiveColumn <int>("IdCol"));
            _table.AddColumn(new ReactiveColumn <string>("TextCol"));
            _table.AddColumn(new ReactiveColumn <decimal>("ValueCol"));

            _table2 = new ReactiveTable();
            _table2.AddColumn(new ReactiveColumn <int>("IdCol2"));
            _table2.AddColumn(new ReactiveColumn <string>("TextCol2"));
            _table2.AddColumn(new ReactiveColumn <decimal>("ValueCol2"));

            _joinedTable = _table.Join(_table2, new Join <int>(_table, "IdCol", _table2, "IdCol2"));
        }
        public CalculatedColumnTableTest()
        {
            _table = new ReactiveTable();
            var idCol = new ReactiveColumn <int>("IdCol");

            _table.AddColumn(idCol);
            var textCol = new ReactiveColumn <string>("TextCol");

            _table.AddColumn(textCol);
            var valueCol = new ReactiveColumn <decimal>("ValueCol");

            _table.AddColumn(valueCol);

            _table.AddColumn(new ReactiveCalculatedColumn2 <decimal, int, decimal>(
                                 "CalcCol1", idCol, valueCol, (id, val) => id * val));

            _table.AddColumn(new ReactiveCalculatedColumn2 <string, int, string>(
                                 "CalcCol2", idCol, textCol, (id, text) => text + id));
        }
Exemple #11
0
 public OneWideTableTest()
 {
     _table = new ReactiveTable();
     _table.AddColumn(new ReactiveColumn <int>("IdCol"));
     _table.AddColumn(new ReactiveColumn <string>("TextCol"));
     _table.AddColumn(new ReactiveColumn <decimal>("ValueCol1"));
     _table.AddColumn(new ReactiveColumn <double>("ValueCol2"));
     _table.AddColumn(new ReactiveColumn <float>("ValueCol3"));
     _table.AddColumn(new ReactiveColumn <bool>("ValueCol4"));
     _table.AddColumn(new ReactiveColumn <string>("ValueCol5"));
     _table.AddColumn(new ReactiveColumn <DateTime>("ValueCol6"));
 }
Exemple #12
0
        private static ReactiveTable GetRatesTable()
        {
            var fxRates = new ReactiveTable();

            fxRates.AddColumn(new ReactiveColumn <string>(FxTableDefinitions.FxRates.CcyPairId));
            fxRates.AddColumn(new ReactiveColumn <double>(FxTableDefinitions.FxRates.Bid));
            fxRates.AddColumn(new ReactiveColumn <double>(FxTableDefinitions.FxRates.Ask));
            fxRates.AddColumn(new ReactiveColumn <double>(FxTableDefinitions.FxRates.Open));
            fxRates.AddColumn(new ReactiveColumn <double>(FxTableDefinitions.FxRates.Close));
            fxRates.AddColumn(new ReactiveColumn <double>(FxTableDefinitions.FxRates.YearRangeStart));
            fxRates.AddColumn(new ReactiveColumn <double>(FxTableDefinitions.FxRates.YearRangeEnd));
            fxRates.AddColumn(new ReactiveColumn <double>(FxTableDefinitions.FxRates.Change));
            fxRates.AddColumn(new ReactiveColumn <DateTime>(FxTableDefinitions.FxRates.Time));
//            fxRates.AddColumn(new ReactiveColumn<long>(FxTableDefinitions.FxRates.Ticks));
            return(fxRates);
        }
        public GroupedTableTest(int?drainTableLimit = null)
        {
            _drainTableLimit = drainTableLimit;
            _table1          = new ReactiveTable();
            var groupColumn = new ReactiveColumn <string>(GroupColumnId);

            _table1.AddColumn(groupColumn);
            var valueColumn = new ReactiveColumn <int>(ValueColumnId);

            _table1.AddColumn(valueColumn);

            var groupedTable = new AggregatedTable(_table1);

            groupedTable.GroupBy <string>(groupColumn.ColumnId);
            groupedTable.AddAggregate(groupColumn, CountColumnId, () => new Count <string>());
            groupedTable.AddAggregate(valueColumn, SumColumnId, () => new Sum <int>());
            groupedTable.AddAggregate(valueColumn, AverageColumnId, () => new Average <int>());
            groupedTable.AddAggregate(valueColumn, MinColumnId, () => new Min <int>());
            groupedTable.AddAggregate(valueColumn, MaxColumnId, () => new Max <int>());
        }
Exemple #14
0
        public static ReactiveTable CreateReactiveTableFull()
        {
            var table = new ReactiveTable();

            table.AddColumn(new ReactiveColumn <int>(TestTableColumns.IdColumn));
            table.AddColumn(new ReactiveColumn <string>(TestTableColumns.StringColumn));
            table.AddColumn(new ReactiveColumn <decimal>(TestTableColumns.DecimalColumn));
            table.AddColumn(new ReactiveColumn <bool>(TestTableColumns.BoolColumn));
            table.AddColumn(new ReactiveColumn <double>(TestTableColumns.DoubleColumn));
            table.AddColumn(new ReactiveColumn <short>(TestTableColumns.ShortColumn));
            table.AddColumn(new ReactiveColumn <long>(TestTableColumns.LongColumn));
            table.AddColumn(new ReactiveColumn <DateTime>(TestTableColumns.DateTimeColumn));
            table.AddColumn(new ReactiveColumn <TimeSpan>(TestTableColumns.TimespanColumn));
            table.AddColumn(new ReactiveColumn <Guid>(TestTableColumns.GuidColumn));
            table.AddColumn(new ReactiveColumn <float>(TestTableColumns.FloatColumn));
            table.AddColumn(new ReactiveColumn <byte>(TestTableColumns.ByteColumn));
            table.AddColumn(new ReactiveColumn <char>(TestTableColumns.CharColumn));
            return(table);
        }
Exemple #15
0
 public BrokerFeedDataService()
 {
     BrokerTableDefinition.SetupFeedTable(_feeds);
     BrokerTableDefinition.SetupClientFeedTable(_currencyPairs);
     _currencyPairs.AddColumn(new ReactiveColumn <bool>(BrokerTableDefinition.BrokerClientColumns.ClientSide.Selected));
 }