Exemplo n.º 1
0
        public void SetUp()
        {
            filePath         = string.Format("{0}/{1}/{2}/{3}/{4}/{5}.zip", TestConfiguration.Parameters["dataPath"], "forex", "oanda", "minute", "eurusd", "20171022_quote");
            filePathDaily    = string.Format("{0}/{1}/{2}/{3}/{4}.zip", TestConfiguration.Parameters["dataPath"], "forex", "oanda", "daily", "eurusd");
            filePathCfdDaily = string.Format("{0}/{1}/{2}/{3}/{4}.zip", TestConfiguration.Parameters["dataPath"], "cfd", "oanda", "daily", "bcousd");

            _dataProvider = new QuantConnect.Lean.Engine.DataFeeds.OandaDataProvider();
        }
Exemplo n.º 2
0
        public void DataIsCorrect()
        {
            var date   = new DateTime(2017, 10, 22);
            var config = new SubscriptionDataConfig(
                typeof(QuoteBar),
                Symbol.Create("OANDA/EURUSD", SecurityType.Forex, Market.Oanda),
                Resolution.Minute,
                TimeZones.NewYork,
                TimeZones.NewYork,
                true,
                true,
                false);
            //var dataCacheProvider = new CustomEphemeralDataCacheProvider { IsDataEphemeral = true };
            var dataProvider = new QuantConnect.Lean.Engine.DataFeeds.OandaDataProvider();
            //dataProvider.Initialize(TestConfiguration.Parameters["token"], TestConfiguration.Parameters["dataPath"]);

            var dataCacheProvider = new SingleEntryDataCacheProvider(dataProvider);
            var reader            = new TextSubscriptionDataSourceReader(
                dataCacheProvider,
                config,
                date,
                false);

            Config.Set("oanda-data-access-token", TestConfiguration.Parameters["token"]);
            Config.Set("data-folder", TestConfiguration.Parameters["dataPath"]);
            Globals.Reset();
            var source = (new ForexOandaVolume()).GetSource(config, date, false);

            var dataBars = reader.Read(source);

            decimal[] prices = { 1.176455m, 1.17648m };

            BaseData[] data = dataBars.ToArray();
            Assert.AreEqual(data[0].Price, prices[0]);
            Assert.AreEqual(data[1].Price, prices[1]);
        }