Esempio n. 1
0
        /// <inheritdoc />
        protected override ExecutionMessage Read(FastCsvReader reader, IMarketDataMetaInfo metaInfo)
        {
            var ol = new ExecutionMessage
            {
                SecurityId    = SecurityId,
                ExecutionType = ExecutionTypes.OrderLog,
                ServerTime    = reader.ReadTime(metaInfo.Date),
                TransactionId = reader.ReadLong(),
                OrderId       = reader.ReadLong(),
                OrderPrice    = reader.ReadDecimal(),
                OrderVolume   = reader.ReadDecimal(),
                Side          = reader.ReadEnum <Sides>(),
                OrderState    = reader.ReadEnum <OrderStates>(),
                TimeInForce   = reader.ReadNullableEnum <TimeInForce>(),
                TradeId       = reader.ReadNullableLong(),
                TradePrice    = reader.ReadNullableDecimal(),
                PortfolioName = reader.ReadString(),
                IsSystem      = reader.ReadNullableBool(),
            };

            if ((reader.ColumnCurr + 1) < reader.ColumnCount)
            {
                ol.Balance = reader.ReadNullableDecimal();
            }

            return(ol);
        }
Esempio n. 2
0
        /// <inheritdoc />
        protected override ExecutionMessage Read(FastCsvReader reader, IMarketDataMetaInfo metaInfo)
        {
            var ol = new ExecutionMessage
            {
                SecurityId    = SecurityId,
                DataTypeEx    = DataType.OrderLog,
                ServerTime    = reader.ReadTime(metaInfo.Date),
                TransactionId = reader.ReadLong(),
                OrderId       = reader.ReadNullableLong(),
                OrderPrice    = reader.ReadDecimal(),
                OrderVolume   = reader.ReadDecimal(),
                Side          = reader.ReadEnum <Sides>(),
                OrderState    = reader.ReadEnum <OrderStates>(),
                TimeInForce   = reader.ReadNullableEnum <TimeInForce>(),
                TradeId       = reader.ReadNullableLong(),
                TradePrice    = reader.ReadNullableDecimal(),
                PortfolioName = reader.ReadString(),
                IsSystem      = reader.ReadNullableBool(),
            };

            if ((reader.ColumnCurr + 1) < reader.ColumnCount)
            {
                ol.Balance = reader.ReadNullableDecimal();
            }

            if ((reader.ColumnCurr + 1) < reader.ColumnCount)
            {
                ol.SeqNum = reader.ReadNullableLong() ?? 0L;
            }

            if ((reader.ColumnCurr + 1) < reader.ColumnCount)
            {
                ol.OrderStringId = reader.ReadString();
                ol.TradeStringId = reader.ReadString();

                ol.OrderBuyId  = reader.ReadNullableLong();
                ol.OrderSellId = reader.ReadNullableLong();

                ol.IsUpTick     = reader.ReadNullableBool();
                ol.Yield        = reader.ReadNullableDecimal();
                ol.TradeStatus  = reader.ReadNullableInt();
                ol.OpenInterest = reader.ReadNullableDecimal();
                ol.OriginSide   = reader.ReadNullableEnum <Sides>();
            }

            return(ol);
        }
 /// <summary>
 /// Read data from the specified reader.
 /// </summary>
 /// <param name="reader">CSV reader.</param>
 /// <param name="metaInfo">Meta-information on data for one day.</param>
 /// <returns>Data.</returns>
 protected override NullableTimeQuoteChange Read(FastCsvReader reader, IMarketDataMetaInfo metaInfo)
 {
     return(new NullableTimeQuoteChange
     {
         ServerTime = reader.ReadTime(metaInfo.Date),
         Price = reader.ReadNullableDecimal(),
         Volume = reader.ReadDecimal(),
         Side = reader.ReadEnum <Sides>()
     });
 }
Esempio n. 4
0
 /// <summary>
 /// Read data from the specified reader.
 /// </summary>
 /// <param name="reader">CSV reader.</param>
 /// <param name="date">Date.</param>
 /// <returns>Data.</returns>
 protected override TimeQuoteChange Read(FastCsvReader reader, DateTime date)
 {
     return(new TimeQuoteChange
     {
         ServerTime = ReadTime(reader, date),
         Price = reader.ReadDecimal(),
         Volume = reader.ReadDecimal(),
         Side = reader.ReadEnum <Sides>()
     });
 }
Esempio n. 5
0
        /// <inheritdoc />
        protected override BoardStateMessage Read(FastCsvReader reader, IMarketDataMetaInfo metaInfo)
        {
            var state = new BoardStateMessage
            {
                ServerTime = reader.ReadTime(metaInfo.Date),
                BoardCode  = reader.ReadString(),
                State      = reader.ReadEnum <SessionStates>()
            };

            return(state);
        }
 /// <summary>
 /// Load data from the specified reader.
 /// </summary>
 /// <param name="reader">CSV reader.</param>
 /// <param name="date">Date.</param>
 /// <returns>Data.</returns>
 protected override ExecutionMessage Read(FastCsvReader reader, DateTime date)
 {
     return(new ExecutionMessage
     {
         SecurityId = SecurityId,
         ExecutionType = ExecutionTypes.OrderLog,
         ServerTime = reader.ReadTime(date),
         TransactionId = reader.ReadLong(),
         OrderId = reader.ReadLong(),
         OrderPrice = reader.ReadDecimal(),
         OrderVolume = reader.ReadDecimal(),
         Side = reader.ReadEnum <Sides>(),
         OrderState = reader.ReadEnum <OrderStates>(),
         TimeInForce = reader.ReadNullableEnum <TimeInForce>(),
         TradeId = reader.ReadNullableLong(),
         TradePrice = reader.ReadNullableDecimal(),
         PortfolioName = reader.ReadString(),
         IsSystem = reader.ReadNullableBool(),
     });
 }
        /// <inheritdoc />
        protected override NullableTimeQuoteChange Read(FastCsvReader reader, IMarketDataMetaInfo metaInfo)
        {
            var quote = new NullableTimeQuoteChange
            {
                ServerTime = reader.ReadTime(metaInfo.Date),
            };

            var price  = reader.ReadNullableDecimal();
            var volume = reader.ReadNullableDecimal();

            quote.Side = reader.ReadEnum <Sides>();

            int?ordersCount = null;

            if ((reader.ColumnCurr + 1) < reader.ColumnCount)
            {
                ordersCount = reader.ReadNullableInt();
            }

            QuoteConditions condition = default;

            if ((reader.ColumnCurr + 1) < reader.ColumnCount)
            {
                condition = reader.ReadNullableEnum <QuoteConditions>() ?? default;
            }

            if (price != null)
            {
                var qq = new QuoteChange
                {
                    Price       = price.Value,
                    Volume      = volume ?? 0,
                    OrdersCount = ordersCount,
                    Condition   = condition,
                };

                quote.Quote = qq;

                if ((reader.ColumnCurr + 1) < reader.ColumnCount)
                {
                    qq.StartPosition = reader.ReadNullableInt();
                    qq.EndPosition   = reader.ReadNullableInt();
                    qq.Action        = reader.ReadNullableEnum <QuoteChangeActions>();
                }
            }

            return(quote);
        }
Esempio n. 8
0
        /// <inheritdoc />
        protected override NullableTimeQuoteChange Read(FastCsvReader reader, IMarketDataMetaInfo metaInfo)
        {
            var quote = new NullableTimeQuoteChange
            {
                ServerTime = reader.ReadTime(metaInfo.Date),
                Price      = reader.ReadNullableDecimal(),
                Volume     = reader.ReadDecimal(),
                Side       = reader.ReadEnum <Sides>()
            };

            if ((reader.ColumnCurr + 1) < reader.ColumnCount)
            {
                quote.OrdersCount = reader.ReadNullableInt();
            }

            return(quote);
        }
        /// <inheritdoc />
        protected override ExecutionMessage Read(FastCsvReader reader, IMarketDataMetaInfo metaInfo)
        {
            var msg = new ExecutionMessage
            {
                SecurityId            = SecurityId,
                ExecutionType         = ExecutionTypes.Transaction,
                ServerTime            = reader.ReadTime(metaInfo.Date),
                TransactionId         = reader.ReadLong(),
                OriginalTransactionId = reader.ReadLong(),
                OrderId       = reader.ReadNullableLong(),
                OrderStringId = reader.ReadString(),
                OrderBoardId  = reader.ReadString(),
                UserOrderId   = reader.ReadString(),
                OrderPrice    = reader.ReadDecimal(),
                OrderVolume   = reader.ReadNullableDecimal(),
                Balance       = reader.ReadNullableDecimal(),
                VisibleVolume = reader.ReadNullableDecimal(),
                Side          = reader.ReadEnum <Sides>(),
                OriginSide    = reader.ReadNullableEnum <Sides>(),
                OrderState    = reader.ReadNullableEnum <OrderStates>(),
                OrderType     = reader.ReadNullableEnum <OrderTypes>(),
                TimeInForce   = reader.ReadNullableEnum <TimeInForce>(),
                TradeId       = reader.ReadNullableLong(),
                TradeStringId = reader.ReadString(),
                TradePrice    = reader.ReadNullableDecimal(),
                TradeVolume   = reader.ReadNullableDecimal(),
                PortfolioName = reader.ReadString(),
                ClientCode    = reader.ReadString(),
                BrokerCode    = reader.ReadString(),
                DepoName      = reader.ReadString(),
                IsSystem      = reader.ReadNullableBool(),
                HasOrderInfo  = reader.ReadBool(),
                HasTradeInfo  = reader.ReadBool(),
                Commission    = reader.ReadNullableDecimal(),
                Currency      = reader.ReadNullableEnum <CurrencyTypes>(),
                Comment       = reader.ReadString(),
                SystemComment = reader.ReadString(),
                //DerivedOrderId = reader.ReadNullableLong(),
                //DerivedOrderStringId = reader.ReadString(),
            };

            reader.ReadNullableLong();
            reader.ReadString();

            msg.IsUpTick       = reader.ReadNullableBool();
            msg.IsCancellation = reader.ReadBool();
            msg.OpenInterest   = reader.ReadNullableDecimal();
            msg.PnL            = reader.ReadNullableDecimal();
            msg.Position       = reader.ReadNullableDecimal();
            msg.Slippage       = reader.ReadNullableDecimal();
            msg.TradeStatus    = reader.ReadNullableInt();
            msg.OrderStatus    = reader.ReadNullableLong();
            msg.Latency        = reader.ReadNullableLong().To <TimeSpan?>();

            var error = reader.ReadString();

            if (!error.IsEmpty())
            {
                msg.Error = new InvalidOperationException(error);
            }

            var dtStr = reader.ReadString();

            if (dtStr != null)
            {
                msg.ExpiryDate = (dtStr.ToDateTime() + reader.ReadString().ToTimeMls()).ToDateTimeOffset(TimeSpan.Parse(reader.ReadString().Remove("+")));
            }
            else
            {
                reader.Skip(2);
            }

            msg.LocalTime     = reader.ReadTime(metaInfo.Date);
            msg.IsMarketMaker = reader.ReadNullableBool();

            if ((reader.ColumnCurr + 1) < reader.ColumnCount)
            {
                msg.CommissionCurrency = reader.ReadString();
            }

            if ((reader.ColumnCurr + 1) < reader.ColumnCount)
            {
                msg.IsMargin = reader.ReadNullableBool();
                msg.IsManual = reader.ReadNullableBool();
            }

            return(msg);
        }
Esempio n. 10
0
        /// <summary>
        /// Load data from the specified reader.
        /// </summary>
        /// <param name="reader">CSV reader.</param>
        /// <param name="date">Date.</param>
        /// <returns>Data.</returns>
        protected override ExecutionMessage Read(FastCsvReader reader, DateTime date)
        {
            var msg = new ExecutionMessage
            {
                SecurityId            = SecurityId,
                ExecutionType         = ExecutionTypes.Transaction,
                ServerTime            = reader.ReadTime(date),
                TransactionId         = reader.ReadLong(),
                OriginalTransactionId = reader.ReadLong(),
                OrderId              = reader.ReadNullableLong(),
                OrderStringId        = reader.ReadString(),
                OrderBoardId         = reader.ReadString(),
                UserOrderId          = reader.ReadString(),
                OrderPrice           = reader.ReadDecimal(),
                OrderVolume          = reader.ReadNullableDecimal(),
                Balance              = reader.ReadNullableDecimal(),
                VisibleVolume        = reader.ReadNullableDecimal(),
                Side                 = reader.ReadEnum <Sides>(),
                OriginSide           = reader.ReadNullableEnum <Sides>(),
                OrderState           = reader.ReadNullableEnum <OrderStates>(),
                OrderType            = reader.ReadNullableEnum <OrderTypes>(),
                TimeInForce          = reader.ReadNullableEnum <TimeInForce>(),
                TradeId              = reader.ReadNullableLong(),
                TradeStringId        = reader.ReadString(),
                TradePrice           = reader.ReadNullableDecimal(),
                TradeVolume          = reader.ReadNullableDecimal(),
                PortfolioName        = reader.ReadString(),
                ClientCode           = reader.ReadString(),
                BrokerCode           = reader.ReadString(),
                DepoName             = reader.ReadString(),
                IsSystem             = reader.ReadNullableBool(),
                HasOrderInfo         = reader.ReadBool(),
                HasTradeInfo         = reader.ReadBool(),
                Commission           = reader.ReadNullableDecimal(),
                Currency             = reader.ReadNullableEnum <CurrencyTypes>(),
                Comment              = reader.ReadString(),
                SystemComment        = reader.ReadString(),
                DerivedOrderId       = reader.ReadNullableLong(),
                DerivedOrderStringId = reader.ReadString(),
                IsUpTick             = reader.ReadNullableBool(),
                IsCancelled          = reader.ReadBool(),
                OpenInterest         = reader.ReadNullableDecimal(),
                PnL         = reader.ReadNullableDecimal(),
                Position    = reader.ReadNullableDecimal(),
                Slippage    = reader.ReadNullableDecimal(),
                TradeStatus = reader.ReadNullableInt(),
                OrderStatus = reader.ReadNullableEnum <OrderStatus>(),
                Latency     = reader.ReadNullableLong().To <TimeSpan?>(),
            };

            var error = reader.ReadString();

            if (!error.IsEmpty())
            {
                msg.Error = new InvalidOperationException(error);
            }

            var dt = reader.ReadNullableDateTime(DateFormat);

            if (dt != null)
            {
                msg.ExpiryDate = (dt.Value + reader.ReadDateTime(TimeFormat).TimeOfDay).ToDateTimeOffset(TimeSpan.Parse(reader.ReadString().Replace("+", string.Empty)));
            }

            return(msg);
        }
Esempio n. 11
0
        /// <inheritdoc />
        protected override NullableTimeQuoteChange Read(FastCsvReader reader, IMarketDataMetaInfo metaInfo)
        {
            var quote = new NullableTimeQuoteChange
            {
                ServerTime = reader.ReadTime(metaInfo.Date),
            };

            var price  = reader.ReadNullableDecimal();
            var volume = reader.ReadNullableDecimal();

            quote.Side = reader.ReadEnum <Sides>();

            int?ordersCount = null;

            if ((reader.ColumnCurr + 1) < reader.ColumnCount)
            {
                ordersCount = reader.ReadNullableInt();
            }

            QuoteConditions condition = default;

            if ((reader.ColumnCurr + 1) < reader.ColumnCount)
            {
                condition = reader.ReadNullableEnum <QuoteConditions>() ?? default;
            }

            QuoteChange?qq = null;

            if (price != null)
            {
                qq = quote.Quote = new QuoteChange
                {
                    Price       = price.Value,
                    Volume      = volume ?? 0,
                    OrdersCount = ordersCount,
                    Condition   = condition,
                };
            }

            if ((reader.ColumnCurr + 1) < reader.ColumnCount)
            {
                var startPosition = reader.ReadNullableInt();
                var endPosition   = reader.ReadNullableInt();
                var action        = reader.ReadNullableEnum <QuoteChangeActions>();

                if (qq != null)
                {
                    var temp = qq.Value;

                    temp.StartPosition = startPosition;
                    temp.EndPosition   = endPosition;
                    temp.Action        = action;

                    quote.Quote = temp;
                }
            }

            if ((reader.ColumnCurr + 1) < reader.ColumnCount)
            {
                quote.State     = reader.ReadNullableEnum <QuoteChangeStates>();
                quote.SeqNum    = reader.ReadNullableLong();
                quote.BuildFrom = reader.ReadBuildFrom();
            }

            return(quote);
        }