Exemple #1
0
        /// <summary>Add a batch of candles</summary>
        public void Add(ETimeFrame tf, PriceCandles candles)
        {
            // Insert the candles into the database
            using (var t = m_db.NewTransaction())
                using (var query = new Sqlite.Query(m_db, SqlExpr.InsertCandle(tf)))
                {
                    foreach (var candle in candles.AllCandles.Select(x => new Candle(x)))
                    {
                        query.Reset();
                        query.BindParms(1, SqlExpr.InsertCandleParams(candle));
                        query.Run();
                    }
                    t.Commit();
                }

            // Don't bother maintaining the cache, just invalidate it
            InvalidateCachedData();

            // Record the last time data was received
            LastUpdatedUTC = Model.UtcNow;

            // Notify data added/changed
            DataChanged.Raise(this, new DataEventArgs(this, tf, null, false));
        }
Exemple #2
0
 public void OnDataChanged(DataEventArgs args)
 {
     DataChanged.Raise(this, args);
 }
Exemple #3
0
 private void OnDataChanged(DataEventArgs args)
 {
     DataChanged.Raise(this, args);
 }