Esempio n. 1
0
        public void ConsumeEvent(object sender, OrderPlacedEventArgs ea)
        {
            if (ea.Order.IsOpened())
            {
                var trade = new TradeContract
                {
                    Id          = Guid.NewGuid().ToString("N"),
                    AccountId   = ea.Order.AccountId,
                    ClientId    = ea.Order.ClientId,
                    OrderId     = ea.Order.Id,
                    AssetPairId = ea.Order.Instrument,
                    Date        = ea.Order.OpenDate.Value,
                    Price       = ea.Order.OpenPrice,
                    Volume      = ea.Order.MatchedOrders.SummaryVolume,
                    Type        = ea.Order.GetOrderType().ToType <TradeType>()
                };

                _rabbitMqNotifyService.NewTrade(trade);
            }
        }
Esempio n. 2
0
        public void ConsumeEvent(object sender, OrderExecutedEventArgs ea)
        {
            var tradeType = ea.Order.Direction.ToType <TradeType>();

            var trade = new TradeContract
            {
                Id          = ea.Order.Id,
                AccountId   = ea.Order.AccountId,
                OrderId     = ea.Order.Id,
                AssetPairId = ea.Order.AssetPairId,
                Date        = ea.Order.Executed.Value,
                Price       = ea.Order.ExecutionPrice.Value,
                Volume      = ea.Order.Volume,
                Type        = tradeType
            };

            _rabbitMqNotifyService.NewTrade(trade);
        }