Ejemplo n.º 1
0
        private IEnumerable <BaseRow> GetGenericResponse(O2GTablesUpdatesReader reader)
        {
            var rows = new List <BaseRow>();

            for (var i = 0; i < reader.Count; i++)
            {
                var type = reader.getUpdateTable(i);

                BaseRow row = null;

                switch (type)
                {
                case O2GTableType.Accounts:
                {
                    // AccountRowEx - so we can get hold of O2GAccountRow internally when needed.
                    row = this.GetRow <AccountRowEx, O2GAccountRow>(reader.getAccountRow(i));
                    break;
                }

                case O2GTableType.ClosedTrades:
                {
                    row = this.GetRow <ClosedTradeRow, O2GClosedTradeRow>(reader.getClosedTradeRow(i));
                    break;
                }

                case O2GTableType.Messages:
                {
                    row = this.GetRow <MessageRow, O2GMessageRow>(reader.getMessageRow(i));
                    break;
                }

                case O2GTableType.Offers:
                {
                    row = this.GetRow <OfferRow, O2GOfferRow>(reader.getOfferRow(i));
                    break;
                }

                case O2GTableType.Orders:
                {
                    row = this.GetRow <OrderRow, O2GOrderRow>(reader.getOrderRow(i));
                    break;
                }

                case O2GTableType.Trades:
                {
                    row = this.GetRow <TradeRow, O2GTradeRow>(reader.getTradeRow(i));
                    break;
                }
                }

                if (row != null)
                {
                    row.UpdateType = ConvertersInternal.GetUpdateType(reader.getUpdateType(i));
                    rows.Add(row);
                }
            }

            return(rows);
        }
Ejemplo n.º 2
0
        private IEnumerable <LastOrderUpdateRow> GetGenericResponse(O2GLastOrderUpdateResponseReader reader)
        {
            var rows = new List <LastOrderUpdateRow>();

            var r = this.GetRow <LastOrderUpdateRow, O2GOrderRow>(reader.Order);

            r.UpdateType = ConvertersInternal.GetUpdateType(reader.UpdateType);

            rows.Add(r);

            return(rows);
        }