Exemple #1
0
        private void EmitTradeTick(Symbol symbol, string[] entries)
        {
            try
            {
                var time   = Time.UnixTimeStampToDateTime(double.Parse(entries[0], NumberStyles.Float, CultureInfo.InvariantCulture));
                var price  = decimal.Parse(entries[1], NumberStyles.Float, CultureInfo.InvariantCulture);
                var amount = decimal.Parse(entries[2], NumberStyles.Float, CultureInfo.InvariantCulture);

                lock (_brokerage.TickLocker)
                {
                    _brokerage.EmitTick(new Tick
                    {
                        Value    = price,
                        Time     = time,
                        Symbol   = symbol,
                        TickType = TickType.Trade,
                        Quantity = Math.Abs(amount)
                    });
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
                throw;
            }
        }
 private void EmitTradeTick(Symbol symbol, DateTime time, decimal price, decimal amount)
 {
     try
     {
         lock (_brokerage.TickLocker)
         {
             _brokerage.EmitTick(new Tick
             {
                 Value    = price,
                 Time     = time,
                 Symbol   = symbol,
                 TickType = TickType.Trade,
                 Quantity = Math.Abs(amount)
             });
         }
     }
     catch (Exception e)
     {
         Log.Error(e);
         throw;
     }
 }