Exemplo n.º 1
0
        public void SetUp()
        {
            _executedQueries.Clear();
            _dataPumpProvider = Substitute.For <IDataPumpProvider>();
            _dataPumpProvider.GetTableName(StockType.Stock, StockDataRange.Daily, 0).Returns("at_dzienne0");
            _dataPumpProvider.GetTableName(StockType.Index, StockDataRange.Daily, 0).Returns("at_dzienne1");
            _dataPumpProvider.ExecuteSQL(Arg.Compat.Do <string>(s => _executedQueries.Add(s)));

            _stockDataToDBWriter = new DataPumpStockDataToDBWriter(_dataPumpProvider, new InsertCommandGenerator(_dataPumpProvider));
            _dataFileIterator    = new DailyDataFileIterator();
            _lineToStockData     = new DailyDataFileLineToStockData();

            TestObj = new MarketOps.DataPump.Bossa.DataPump(_dataPumpProvider, _dataFileIterator, _stockDataToDBWriter, _lineToStockData, _dataFileDownloader, _downloadDirectories);
        }
Exemplo n.º 2
0
        public void Update(StockType stockType)
        {
            string updateQuery =
                $"update at_spolki2 " +
                $"set start_ts=t.ts " +
                $"from " +
                $"( " +
                $"select fk_id_spolki, min(ts) as \"ts\" " +
                $"from {_dataPumpProvider.GetTableName(stockType, StockDataRange.Daily, 0)} " +
                $"where fk_id_spolki in (select id from at_spolki2 where start_ts is null) " +
                $"group by fk_id_spolki " +
                $") t " +
                $"where id=t.fk_id_spolki";

            _dataPumpProvider.ExecuteSQL(updateQuery);
        }
 public void WriteDaily(DataPumpStockData data, StockDefinition stockDefinition)
 {
     _dataPumpProvider.ExecuteSQL(_commandGenerator.InsertDaily(data, stockDefinition));
 }