Example #1
0
 private void _timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     if (isLastOrderComplete() && !_lastOrderMatched)
     {
         xlTradeOrder        last;
         OrderMatchEventArgs match = new OrderMatchEventArgs();
         _lastOrderMatched = true;
         match.LastOrder   = _lastOrder;
         match.Matched     = true;
         onMatch(this, match);
         _timer.Stop();
     }
     Disconnect();
 }
        private void _timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            
            if (isLastOrderComplete() && !_lastOrderMatched)
            {
                xlTradeOrder last;
                OrderMatchEventArgs match = new OrderMatchEventArgs();
                _lastOrderMatched = true;             
                match.LastOrder = _lastOrder;
                match.Matched = true;
                onMatch(this, match);
                _timer.Stop();
                
            }
            Disconnect();

        }
        void e_onMatch(object sender, OrderMatchEventArgs e)
        {
            var et = e.LastOrder;


            Trade t = new Trade()
            {
                TimeStamp = e.Matched ? e.LastOrder.TimeStamp : DateTime.UtcNow.AddHours(2),
                TradedPrice = et.Price,
                TradeVolume = et.Volume,
                BuyorSell = et.BS,
                InstrumentName = et.Contract,
                xlRef = et.Reference,
                xlMatched = e.Matched,

            };
            OrderMatchEvent ome = new OrderMatchEvent();
            ome.Success = true;
            ome.Trade = t;
            onOrderMatch(this, ome);
        }