예제 #1
0
        public bool insert(Tick tick, Action callback = null)
        {
            double timestamp = tick.Time.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds;

            try
            {
                // Partie aleatoire pour que chaque clef soit unique (cas où plusieurs ticks par millisecondes)
                db.SortedSetAdd(tick.Symbol + "_ask", timestamp.ToString() + m_random.Next(0, 99999) + m_random.Next(0, 99999), (double)tick.Ask);
                db.SortedSetAdd(tick.Symbol + "_bid", timestamp.ToString() + m_random.Next(0, 99999) + m_random.Next(0, 99999), (double)tick.Bid);
            }
            catch (Exception e)
            {
                Console.WriteLine("Insertion failed -> " + e.Message);
                return(false);
            }

            return(true);
        }