/// <summary>
 /// Constructor
 /// </summary>
 /// <see cref="DailyStatisticsMessage"/>
 /// <param name="message">Source message.</param>
 public DailyStatisticsData(DailyStatisticsMessage message)
 {
     Gross          = DWConverter.FromProtoDecimal(message.Gross);
     HighPrice      = DWConverter.FromProtoDecimal(message.HighPrice);
     LowPrice       = DWConverter.FromProtoDecimal(message.LowPrice);
     StartTimestamp = DWConverter.FromLongDateTime(message.StartTimestamp);
     Volume         = DWConverter.FromProtoDecimal(message.Volume);
 }
示例#2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <see cref="OHLCVMessage"/>
 /// <param name="message">Source message.</param>
 public OHLCVData(OHLCVMessage message)
 {
     TimeStamp          = DWConverter.FromLongDateTime(message.Timestamp);
     OpenPrice          = DWConverter.FromProtoDecimal(message.OpenPrice);
     HighPrice          = DWConverter.FromProtoDecimal(message.HighPrice);
     LowPrice           = DWConverter.FromProtoDecimal(message.LowPrice);
     ClosePrice         = DWConverter.FromProtoDecimal(message.ClosePrice);
     AverageOraclePrice = DWConverter.FromProtoDecimal(message.AverageOraclePrice);
     Volume             = DWConverter.FromProtoDecimal(message.Volume);
 }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <see cref="Message"/>
        /// <param name="message">Source message.</param>
        public TraderStatusData(Message message)
        {
            MarketId = message.MarketId;
            TraderStatusMessage traderStatusMessage = message.TraderStatusMsg.Clone();

            TraderId      = message.TraderId;
            Symbol        = SymbolsContainer.GetSymbol(message.MarketId);
            Upnl          = DWConverter.FromProtoDecimal(traderStatusMessage.Upnl);
            Pnl           = DWConverter.FromProtoDecimal(traderStatusMessage.Pnl);
            AccumQuantity = DWConverter.FromProtoDecimal(traderStatusMessage.AccumQuantity);
            MarkPrice     = DWConverter.FromProtoDecimal(traderStatusMessage.MarkPrice);
            Orders        = new List <OrderBase>();
            foreach (OrderMessage orderMessage in traderStatusMessage.Orders)
            {
                OrderBase order = orderMessage.OrderType == OrderType.Market ? (OrderBase) new OrderMarket(orderMessage, SymbolsContainer.GetSymbol(message.MarketId)) :
                                  orderMessage.OrderType == OrderType.Limit ? (OrderBase) new OrderLimit(orderMessage, SymbolsContainer.GetSymbol(message.MarketId)) :
                                  null;

                order.Status = OrderStatus.Accepted;

                Orders.Add(order);
            }
            Trades = new List <Trade>();
            foreach (TradeMessage tradeMessage in traderStatusMessage.Trades)
            {
                Trade trade = new Trade(tradeMessage, Symbol);
                if (tradeMessage.TradeTimestamp == 0)
                {
                    trade.TradeTimeStamp = DWConverter.FromLongDateTime(message.Timestamp);
                }
                this.Trades.Add(trade);
            }
            Leverage                  = traderStatusMessage.Leverage;
            BuyOrderQuantity          = DWConverter.FromProtoDecimal(traderStatusMessage.BuyOrderQuantity);
            SellOrderQuantity         = DWConverter.FromProtoDecimal(traderStatusMessage.SellOrderQuantity);
            TraderBalance             = DWConverter.FromProtoDecimal(traderStatusMessage.TraderBalance);
            TraderBalance2            = DWConverter.FromProtoDecimal(traderStatusMessage.TraderBalance2);
            PositionMargin            = DWConverter.FromProtoDecimal(traderStatusMessage.PositionMargin);
            OrderMargin               = DWConverter.FromProtoDecimal(traderStatusMessage.OrderMargin);
            BuyOrderMargin            = DWConverter.FromProtoDecimal(traderStatusMessage.BuyOrderMargin);
            LastTradePrice            = DWConverter.FromProtoDecimal(traderStatusMessage.LastTradePrice);
            LastTradeQuantity         = DWConverter.FromProtoDecimal(traderStatusMessage.LastTradeQuantity);
            PositionBankruptcyVolume  = DWConverter.FromProtoDecimal(traderStatusMessage.PositionBankruptcyVolume);
            PositionContracts         = DWConverter.FromProtoDecimal(traderStatusMessage.PositionContracts);
            PositionLiquidationVolume = DWConverter.FromProtoDecimal(traderStatusMessage.PositionLiquidationVolume);
            PositionType              = traderStatusMessage.PositionType;
            PositionVolume            = DWConverter.FromProtoDecimal(traderStatusMessage.PositionVolume);
            SellOrderMargin           = DWConverter.FromProtoDecimal(traderStatusMessage.SellOrderMargin);
        }
示例#4
0
        public LeverageData(Message message)
        {
            if (message.KontentCase != Message.KontentOneofCase.LeverageMsg)
            {
                throw new ArgumentException($"Error: Message containis KontentCase {message.KontentCase} " +
                                            $" instead of LeverageMsg.");
            }
            Symbol          symbol          = SymbolsContainer.GetSymbol(message.MarketId);
            LeverageMessage leverageMessage = message.LeverageMsg;

            DWConverter.FromProtoDecimal(leverageMessage.AccumQuantity);
            BuyOrderMargin     = DWConverter.FromProtoDecimal(leverageMessage.BuyOrderMargin);
            BuyOrderQuantity   = DWConverter.FromProtoDecimal(leverageMessage.BuyOrderQuantity);
            LastTradePrice     = DWConverter.FromProtoDecimal(leverageMessage.LastTradePrice);
            LastTradeQuantity  = DWConverter.FromProtoDecimal(leverageMessage.LastTradeQuantity);
            LastTradeTimestamp = DWConverter.FromLongDateTime(leverageMessage.LastTradeTimestamp);
            Leverage           = leverageMessage.Leverage;
            OrderMargin        = DWConverter.FromProtoDecimal(leverageMessage.OrderMargin);

            Orders = new List <OrderBase>();
            foreach (OrderMessage orderMessage in leverageMessage.Orders)
            {
                OrderBase order = new OrderLimit(orderMessage, symbol);
                Orders.Add(order);
            }

            Pnl = DWConverter.FromProtoDecimal(leverageMessage.Pnl);
            PositionBankruptcyVolume  = DWConverter.FromProtoDecimal(leverageMessage.PositionBankruptcyVolume);
            PositionContracts         = DWConverter.FromProtoDecimal(leverageMessage.PositionContracts);
            PositionLiquidationVolume = DWConverter.FromProtoDecimal(leverageMessage.PositionLiquidationVolume);
            PositionMargin            = DWConverter.FromProtoDecimal(leverageMessage.PositionMargin);
            PositionType      = leverageMessage.PositionType;
            PositionVolume    = DWConverter.FromProtoDecimal(leverageMessage.PositionVolume);
            SellOrderMargin   = DWConverter.FromProtoDecimal(leverageMessage.SellOrderMargin);
            SellOrderQuantity = DWConverter.FromProtoDecimal(leverageMessage.SellOrderQuantity);
            TraderBalance     = DWConverter.FromProtoDecimal(leverageMessage.TraderBalance);

            Trades = new List <Trade>();
            foreach (TradeMessage tradeMessage in leverageMessage.Trades)
            {
                Trade trade = new Trade(tradeMessage, symbol);
                Trades.Add(trade);
            }

            Upnl = DWConverter.FromProtoDecimal(leverageMessage.Upnl);
        }
示例#5
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <see cref="Message"/>
        /// <param name="message">Source message.</param>
        public OrderStatusData(Message message)
        {
            OrderStatusMessage orderStatusMessage = message.OrderStatusMsg.Clone();

            TraderId       = message.TraderId;
            ClientId       = DWConverter.FromProtoUuid(message.ClientId);
            Symbol         = SymbolsContainer.GetSymbol(message.MarketId);
            Direction      = orderStatusMessage.Side;
            Status         = orderStatusMessage.Status;
            PositionMargin = DWConverter.FromProtoDecimal(orderStatusMessage.PositionMargin);
            OrderMargin    = DWConverter.FromProtoDecimal(orderStatusMessage.OrderMargin);
            TraderBalance  = DWConverter.FromProtoDecimal(orderStatusMessage.TraderBalance);
            TraderBalance2 = DWConverter.FromProtoDecimal(orderStatusMessage.TraderBalance2);
            MarkPrice      = DWConverter.FromProtoDecimal(orderStatusMessage.MarkPrice);
            PaidPrice      = DWConverter.FromProtoDecimal(orderStatusMessage.PaidPrice);
            Price          = DWConverter.FromProtoDecimal(orderStatusMessage.Price);
            Quantity       = DWConverter.FromProtoDecimal(orderStatusMessage.Quantity);
            //this.TakeProfitPrice = message.FromProtoDecimal(orderStatusMessage.TakeProfitPrice);
            Upnl           = DWConverter.FromProtoDecimal(orderStatusMessage.Upnl);
            BuyOrderMargin = DWConverter.FromProtoDecimal(orderStatusMessage.BuyOrderMargin);
            Duration       = orderStatusMessage.Duration;
            Leverage       = orderStatusMessage.Leverage;
            OldContractId  = orderStatusMessage.OldContractId;
            OrderClientId  = DWConverter.FromProtoUuid(orderStatusMessage.OrderClientId);
            if (orderStatusMessage.OrderTimestamp == 0)
            {
                OrderTimestamp = DWConverter.FromLongDateTime(message.Timestamp);
            }
            else
            {
                OrderTimestamp = DWConverter.FromLongDateTime(orderStatusMessage.OrderTimestamp);
            }
            OrderType       = orderStatusMessage.OrderType;
            PaidPrice       = DWConverter.FromProtoDecimal(orderStatusMessage.PaidPrice);
            SellOrderMargin = DWConverter.FromProtoDecimal(orderStatusMessage.SellOrderMargin);
            Side            = orderStatusMessage.Side;
            //this.TakeProfitType = orderStatusMessage.TakeProfitType;
            Pnl = DWConverter.FromProtoDecimal(orderStatusMessage.Pnl);
            BuyOrderQuantity  = DWConverter.FromProtoDecimal(orderStatusMessage.BuyOrderQuantity);
            SellOrderQuantity = DWConverter.FromProtoDecimal(orderStatusMessage.SellOrderQuantity);
            AccumQuantity     = DWConverter.FromProtoDecimal(orderStatusMessage.AccumQuantity);
            OpenTime          = DWConverter.FromLongDateTime(orderStatusMessage.OpenTime);
            OrigClientId      = DWConverter.FromProtoUuid(orderStatusMessage.OrigClientId);
            OrigQuantity      = DWConverter.FromProtoDecimal(orderStatusMessage.OrigQuantity);
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <see cref="Message"/>
        /// <param name="message">Source message.</param>
        public MarketStateUpdateData(Message message)
        {
            Symbol = SymbolsContainer.GetSymbol(message.MarketId);
            MarketStateUpdateMessage marketStateUpdateMessage = message.MarketStateUpdateMsg.Clone();

            MarketId = message.MarketId;
            Symbol symbol = SymbolsContainer.GetSymbol(MarketId);

            DailyStats = new List <DailyStatisticsData>();
            foreach (DailyStatisticsMessage dailyStats in marketStateUpdateMessage.DailyStats)
            {
                DailyStatisticsData stats = new DailyStatisticsData(dailyStats);
                DailyStats.Add(stats);
            }
            DgtxToBasePrice    = DWConverter.FromProtoDecimal(marketStateUpdateMessage.DgtxToBasePrice);
            FundingInterval    = marketStateUpdateMessage.FundingInterval;
            PayoutPerContract  = DWConverter.FromProtoDecimal(marketStateUpdateMessage.PayoutPerContract);
            EventTimestamp     = DWConverter.FromLongDateTime(marketStateUpdateMessage.EventTimestamp);
            FundingRate        = DWConverter.FromProtoDecimal(marketStateUpdateMessage.FundingRate);
            FundingTime        = marketStateUpdateMessage.FundingTime;
            FutureCount        = DWConverter.FromProtoDecimal(marketStateUpdateMessage.FutureCount);
            FutureValue        = DWConverter.FromProtoDecimal(marketStateUpdateMessage.FutureValue);
            ImpactAskCount     = DWConverter.FromProtoDecimal(marketStateUpdateMessage.ImpactAskCount);
            ImpactAskValue     = DWConverter.FromProtoDecimal(marketStateUpdateMessage.ImpactAskValue);
            ImpactBaseQuantity = DWConverter.FromProtoDecimal(marketStateUpdateMessage.ImpactBaseQuantity);
            ImpactBidCount     = DWConverter.FromProtoDecimal(marketStateUpdateMessage.ImpactBidCount);
            ImpactBidValue     = DWConverter.FromProtoDecimal(marketStateUpdateMessage.ImpactBidValue);
            ImpactQuantity     = DWConverter.FromProtoDecimal(marketStateUpdateMessage.ImpactQuantity);
            ImpactValue        = DWConverter.FromProtoDecimal(marketStateUpdateMessage.ImpactValue);
            LastTradePrice     = DWConverter.FromProtoDecimal(marketStateUpdateMessage.LastTradePrice);
            LastTradeQuantity  = DWConverter.FromProtoDecimal(marketStateUpdateMessage.LastTradeQuantity);
            Ohlcvs             = new List <OHLCVData>();
            foreach (OHLCVMessage ohlcv in marketStateUpdateMessage.Ohlcvs)
            {
                OHLCVData ohlc = new OHLCVData(ohlcv);
                Ohlcvs.Add(ohlc);
            }
            SpotPrice = DWConverter.FromProtoDecimal(marketStateUpdateMessage.SpotPrice);
            Trades    = new List <Trade>();
            foreach (TradeMessage trade in marketStateUpdateMessage.Trades)
            {
                Trade tTrade = new Trade(trade, symbol);
                Trades.Add(tTrade);
            }
        }
示例#7
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="message">Original message. <see cref="TradeMessage"/></param>
 public Trade(TradeMessage message, Symbol symbol)
 {
     TradeTraderId    = message.TradeTraderId;
     TradeTimeStamp   = DWConverter.FromLongDateTime(message.TradeTimestamp);
     Position         = message.Position;
     Price            = DWConverter.FromProtoDecimal(message.Price);
     Quantity         = DWConverter.FromProtoDecimal(message.Quantity);
     PaidPrice        = DWConverter.FromProtoDecimal(message.PaidPrice);
     LiquidationPrice = DWConverter.FromProtoDecimal(message.LiquidationPrice);
     ExitPrice        = DWConverter.FromProtoDecimal(message.ExitPrice);
     Leverage         = message.Leverage;
     ContractId       = message.ContractId;
     OldContractId    = message.OldContractId;
     OldClientId      = DWConverter.FromProtoUuid(message.OldClientId);
     IsIncrease       = message.IsIncrease;
     IsLiquidation    = message.IsLiquidation;
     Symbol           = symbol;
 }
 protected OrderBase(OrderMessage message, Symbol symbol)
 {
     ClientId      = DWConverter.FromProtoUuid(message.OrderClientId);
     TimeStamp     = DWConverter.FromLongDateTime(message.OrderTimestamp);
     Type          = message.OrderType;
     Side          = message.Side;
     Leverage      = message.Leverage;
     Duration      = message.Duration;
     Price         = DWConverter.FromProtoDecimal(message.Price);
     Quantity      = DWConverter.FromProtoDecimal(message.Quantity);
     PaidPrice     = DWConverter.FromProtoDecimal(message.PaidPrice);
     status        = null;
     TargetSymbol  = symbol;
     ContractId    = message.ContractId;
     OldClientId   = DWConverter.FromProtoUuid(message.OldClientId);
     OpenTime      = DWConverter.FromLongDateTime(message.OpenTime);
     OrderTraderId = message.OrderTraderId;
     OrigClientId  = DWConverter.FromProtoUuid(message.OrigClientId);
     OrigQuantity  = DWConverter.FromProtoDecimal(message.OrigQuantity);
 }
示例#9
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <see cref="Message"/>
        /// <param name="message">Source message.</param>
        public FundingData(Message message)
        {
            FundingMessage fundingMessage = message.FundingMsg.Clone();

            TraderId          = message.TraderId;
            Symbol            = SymbolsContainer.GetSymbol(message.MarketId);
            MarkPrice         = DWConverter.FromProtoDecimal(fundingMessage.MarkPrice);
            OrderMargin       = DWConverter.FromProtoDecimal(fundingMessage.OrderMargin);
            PositionMargin    = DWConverter.FromProtoDecimal(fundingMessage.PositionMargin);
            TraderBalance     = DWConverter.FromProtoDecimal(fundingMessage.TraderBalance);
            Upnl              = DWConverter.FromProtoDecimal(fundingMessage.Upnl);
            Pnl               = DWConverter.FromProtoDecimal(fundingMessage.Pnl);
            AccumQuantity     = DWConverter.FromProtoDecimal(fundingMessage.AccumQuantity);
            BuyOrderMargin    = DWConverter.FromProtoDecimal(fundingMessage.BuyOrderMargin);
            LastTradePrice    = DWConverter.FromProtoDecimal(fundingMessage.LastTradePrice);
            LastTradeQuantity = DWConverter.FromProtoDecimal(fundingMessage.LastTradeQuantity);
            PayoutPerContract = DWConverter.FromProtoDecimal(fundingMessage.PayoutPerContract);
            SellOrderMargin   = DWConverter.FromProtoDecimal(fundingMessage.SellOrderMargin);
            Trades            = new List <Trade>();
            foreach (TradeMessage tradeMessage in fundingMessage.Trades)
            {
                Trade trade = new Trade(tradeMessage, SymbolsContainer.GetSymbol(message.MarketId));
                if (tradeMessage.TradeTimestamp == 0)
                {
                    trade.TradeTimeStamp = DWConverter.FromLongDateTime(message.Timestamp);
                }
                Trades.Add(trade);
            }
            PositionContracts         = DWConverter.FromProtoDecimal(fundingMessage.PositionContracts);
            PositionVolume            = DWConverter.FromProtoDecimal(fundingMessage.PositionVolume);
            PositionLiquidationVolume = DWConverter.FromProtoDecimal(fundingMessage.PositionLiquidationVolume);
            PositionBankruptcyVolume  = DWConverter.FromProtoDecimal(fundingMessage.PositionBankruptcyVolume);
            BuyOrderQuantity          = DWConverter.FromProtoDecimal(fundingMessage.BuyOrderQuantity);
            SellOrderQuantity         = DWConverter.FromProtoDecimal(fundingMessage.SellOrderQuantity);
            Payout               = DWConverter.FromProtoDecimal(fundingMessage.Payout);
            PositionType         = fundingMessage.PositionType;
            PositionMarginChange = DWConverter.FromProtoDecimal(fundingMessage.PositionMarginChange);
        }
示例#10
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <see cref="Message"/>
        /// <param name="message">Source message.</param>
        public OrderBookFullUpdateData(Message message)
        {
            Symbol = SymbolsContainer.GetSymbol(message.MarketId);
            OrderBookUpdatedMessage orderBookUpdatedMessage = message.OrderBookUpdatedMsg.Clone();

            MarketId   = message.MarketId;
            AskUpdates = new List <Tuple <decimal, decimal> >();
            BidUpdates = new List <Tuple <decimal, decimal> >();
            Trades     = new List <Tuple <decimal, decimal> >();
            foreach (OrderBookEntryMessage trade in orderBookUpdatedMessage.Trades)
            {
                decimal price    = DWConverter.FromProtoDecimal(trade.Price);
                decimal quantity = DWConverter.FromProtoDecimal(trade.Quantity);
                Tuple <decimal, decimal> tuple = new Tuple <decimal, decimal>(price, quantity);
                Trades.Add(tuple);
            }
            foreach (OrderBookEntryMessage ask in orderBookUpdatedMessage.AskUpdates)
            {
                decimal price    = DWConverter.FromProtoDecimal(ask.Price);
                decimal quantity = DWConverter.FromProtoDecimal(ask.Quantity);
                Tuple <decimal, decimal> tuple = new Tuple <decimal, decimal>(price, quantity);
                AskUpdates.Add(tuple);
            }
            foreach (OrderBookEntryMessage bid in orderBookUpdatedMessage.BidUpdates)
            {
                decimal price    = DWConverter.FromProtoDecimal(bid.Price);
                decimal quantity = DWConverter.FromProtoDecimal(bid.Quantity);
                Tuple <decimal, decimal> tuple = new Tuple <decimal, decimal>(price, quantity);
                BidUpdates.Add(tuple);
            }
            LastFullTimestamp = DWConverter.FromLongDateTime(orderBookUpdatedMessage.LastFullTimestamp);
            LastTradePrice    = DWConverter.FromProtoDecimal(orderBookUpdatedMessage.LastTradePrice);
            LastTradeQuantity = DWConverter.FromProtoDecimal(orderBookUpdatedMessage.LastTradeQuantity);
            MarkPrice         = DWConverter.FromProtoDecimal(orderBookUpdatedMessage.MarkPrice);
            UpdateSerial      = orderBookUpdatedMessage.UpdateSerial;
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <see cref="Message"/>
        /// <param name="message">Surce message.</param>
        public MarketStateData(Message message)
        {
            Symbol = SymbolsContainer.GetSymbol(message.MarketId);
            MarketStateMessage marketStateMessage = message.MarketStateMsg.Clone();

            MarketId      = message.MarketId;
            ContractValue = DWConverter.FromProtoDecimal(marketStateMessage.ContractValue);
            DailyStats    = new List <DailyStatisticsData>();
            foreach (DailyStatisticsMessage dailyStats in marketStateMessage.DailyStats)
            {
                DailyStatisticsData stats = new DailyStatisticsData(dailyStats);
                DailyStats.Add(stats);
            }
            EventTimestamp    = DWConverter.FromLongDateTime(marketStateMessage.EventTimestamp);
            FundingRate       = DWConverter.FromProtoDecimal(marketStateMessage.FundingRate);
            FundingTime       = marketStateMessage.FundingTime;
            LastTradePrice    = DWConverter.FromProtoDecimal(marketStateMessage.LastTradePrice);
            LastTradeQuantity = DWConverter.FromProtoDecimal(marketStateMessage.LastTradeQuantity);
            NextFundingRate   = DWConverter.FromProtoDecimal(marketStateMessage.NextFundingRate);
            Ohlcvs            = new List <OHLCVData>();
            foreach (OHLCVMessage ohlcv in marketStateMessage.Ohlcvs)
            {
                OHLCVData ohlc = new OHLCVData(ohlcv);
                Ohlcvs.Add(ohlc);
            }
            TickPrice = DWConverter.FromProtoDecimal(marketStateMessage.TickPrice);
            TickValue = DWConverter.FromProtoDecimal(marketStateMessage.TickValue);
            Trades    = new List <Trade>();
            foreach (TradeMessage trade in marketStateMessage.Trades)
            {
                Trade tTrade = new Trade(trade, SymbolsContainer.GetSymbol(MarketId));
                Trades.Add(tTrade);
            }
            FundingInterval   = marketStateMessage.FundingInterval;
            PayoutPerContract = DWConverter.FromProtoDecimal(marketStateMessage.PayoutPerContract);
        }
示例#12
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <see cref="Message"/>
        /// <param name="message">Source message.</param>
        public OrderFilledData(Message message)
        {
            OrderFilledMessage orderFilledMessage = message.OrderFilledMsg.Clone();

            TraderId          = message.TraderId;
            ClientId          = DWConverter.FromProtoUuid(message.ClientId);
            Symbol            = SymbolsContainer.GetSymbol(message.MarketId);
            Status            = orderFilledMessage.Status;
            AccumQuantity     = DWConverter.FromProtoDecimal(orderFilledMessage.AccumQuantity);
            BuyOrderQuantity  = DWConverter.FromProtoDecimal(orderFilledMessage.BuyOrderQuantity);
            SellOrderQuantity = DWConverter.FromProtoDecimal(orderFilledMessage.SellOrderQuantity);
            PositionType      = orderFilledMessage.PositionType;
            PositionMargin    = DWConverter.FromProtoDecimal(orderFilledMessage.PositionMargin);
            OrderMargin       = DWConverter.FromProtoDecimal(orderFilledMessage.OrderMargin);
            TraderBalance     = DWConverter.FromProtoDecimal(orderFilledMessage.TraderBalance);
            TraderBalance2    = DWConverter.FromProtoDecimal(orderFilledMessage.TraderBalance2);
            Pnl                       = DWConverter.FromProtoDecimal(orderFilledMessage.Pnl);
            Upnl                      = DWConverter.FromProtoDecimal(orderFilledMessage.Upnl);
            NewClientId               = Status == OrderStatus.Partial ? DWConverter.FromProtoUuid(orderFilledMessage.NewClientId) : Guid.Empty;
            BuyOrderMargin            = DWConverter.FromProtoDecimal(orderFilledMessage.BuyOrderMargin);
            DroppedQuantity           = DWConverter.FromProtoDecimal(orderFilledMessage.DroppedQuantity);
            Duration                  = orderFilledMessage.Duration;
            LastTradePrice            = DWConverter.FromProtoDecimal(orderFilledMessage.LastTradePrice);
            LastTradeQuantity         = DWConverter.FromProtoDecimal(orderFilledMessage.LastTradeQuantity);
            Leverage                  = orderFilledMessage.Leverage;
            MarkPrice                 = DWConverter.FromProtoDecimal(orderFilledMessage.MarkPrice);
            OrderType                 = orderFilledMessage.OrderType;
            PaidPrice                 = DWConverter.FromProtoDecimal(orderFilledMessage.PaidPrice);
            PositionBankruptcyVolume  = DWConverter.FromProtoDecimal(orderFilledMessage.PositionBankruptcyVolume);
            PositionContracts         = DWConverter.FromProtoDecimal(orderFilledMessage.PositionContracts);
            PositionLiquidationVolume = DWConverter.FromProtoDecimal(orderFilledMessage.PositionLiquidationVolume);
            PositionVolume            = DWConverter.FromProtoDecimal(orderFilledMessage.PositionVolume);
            Price                     = DWConverter.FromProtoDecimal(orderFilledMessage.Price);
            Quantity                  = DWConverter.FromProtoDecimal(orderFilledMessage.Quantity);

            RawTrades = new List <Trade>();
            foreach (TradeMessage trade in orderFilledMessage.RawTrades)
            {
                Trade rawTrade = new Trade(trade, SymbolsContainer.GetSymbol(message.MarketId));
                if (trade.TradeTimestamp == 0)
                {
                    rawTrade.TradeTimeStamp = DWConverter.FromLongDateTime(message.Timestamp);
                }
                RawTrades.Add(rawTrade);
            }
            SellOrderMargin = DWConverter.FromProtoDecimal(orderFilledMessage.SellOrderMargin);
            Side            = orderFilledMessage.Side;
            Trades          = new List <Trade>();
            foreach (TradeMessage trade in orderFilledMessage.Trades)
            {
                Trade tempTrade = new Trade(trade, SymbolsContainer.GetSymbol(message.MarketId));
                if (trade.TradeTimestamp == 0)
                {
                    tempTrade.TradeTimeStamp = DWConverter.FromLongDateTime(message.Timestamp);
                }
                Trades.Add(tempTrade);
            }
            OpenTime     = DWConverter.FromLongDateTime(orderFilledMessage.OpenTime);
            OrigClientId = DWConverter.FromProtoUuid(orderFilledMessage.OrigClientId);
            OrigQuantity = DWConverter.FromProtoDecimal(orderFilledMessage.OrigQuantity);
        }