Example #1
0
        public void AggreegatingFilesDownload()
        {
            System.Diagnostics.Stopwatch stopWatch = null;

            var logger = TestLogManager.Instance.GetLogger("B3ProviderTesting");

            //var summary = BenchmarkRunner.Run<BenchmarkDownloader>();


            // create a configuration instance
            var config = new B3ProviderConfig();

            // define properties
            config.ReplaceExistingFiles = true;

            // create an instance of the client
            var client = new B3ProviderClient(config);

            stopWatch = System.Diagnostics.Stopwatch.StartNew();
            client.LoadHistoricQuotes(2018);
            stopWatch.Stop();
            logger.Info(string.Format("loaded in: {0:hh\\:mm\\:ss\\.fff}", stopWatch.Elapsed));
            stopWatch = System.Diagnostics.Stopwatch.StartNew();
            client.LoadHistoricQuotes(2017);
            stopWatch.Stop();
            logger.Info(string.Format("loaded in: {0:hh\\:mm\\:ss\\.fff}", stopWatch.Elapsed));
            stopWatch = System.Diagnostics.Stopwatch.StartNew();
            client.LoadHistoricQuotes(2016);
            stopWatch.Stop();
            logger.Info(string.Format("loaded in: {0:hh\\:mm\\:ss\\.fff}", stopWatch.Elapsed));
        }
Example #2
0
        public void B3ProviderMustFindOptions()
        {
            // create a configuration instance
            var config = new B3ProviderConfig();

            // define properties
            config.ReplaceExistingFiles = true;

            // create an instance of the client
            var client = new B3ProviderClient(config);

            // load all instruments into memory
            client.LoadInstruments();

            // load all instruments into memory
            client.LoadQuotes();

            // load all instruments into memory
            client.LoadHistoricQuotes(2018);

            // get information about PETR4 stock (the most popular in B3)
            var equity = client.EquityInstruments.Where(e =>
                                                        e.Ticker.Equals("PETR4", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();

            // get information about option calls on PETR4 stock
            var optionsCalls = client.OptionInstruments.Where(o => o.B3IDUnderlying == equity.B3ID &&
                                                              o.Type == B3OptionOnEquityTypeInfo.Call).ToList();

            var historicQuotes = client.GetHistoricMarketData().Where(md => md.Ticker == optionsCalls.FirstOrDefault().Ticker).ToList();

            // get information about option puts on PETR4 stock
            var optionsPuts = client.OptionInstruments.Where(o => o.B3IDUnderlying == equity.B3ID &&
                                                             o.Type == B3OptionOnEquityTypeInfo.Put).ToList();
        }
Example #3
0
        public void B3ProviderMustDownloadHistoricQuoteFilesFromMultipleYears()
        {
            var logger = TestLogManager.Instance.GetLogger("B3ProviderTesting");
            var config = new B3ProviderConfig();

            config.ReplaceExistingFiles = true;

            var client    = new B3ProviderClient(config);
            var stopWatch = new System.Diagnostics.Stopwatch();
            var finalPath = string.Empty;

            stopWatch.Start();
            client.LoadHistoricQuotes(2018);
            stopWatch.Stop();
            logger.Info(string.Format("downloaded in: {0:hh\\:mm\\:ss\\.fff}", stopWatch.Elapsed));
            stopWatch.Reset();
            stopWatch.Start();
            client.LoadHistoricQuotes(2017);
            stopWatch.Stop();
            logger.Info(string.Format("downloaded in: {0:hh\\:mm\\:ss\\.fff}", stopWatch.Elapsed));
            stopWatch.Reset();
            stopWatch.Start();
            client.LoadHistoricQuotes(2016);
            stopWatch.Stop();
            logger.Info(string.Format("downloaded in: {0:hh\\:mm\\:ss\\.fff}", stopWatch.Elapsed));
        }
Example #4
0
        public Main()
        {
            _quoteDictionary = new Dictionary <string, Quote>();
            FeatureList.Add(FeaturesT.SUPPORTS_REALTIME_OPTIONS_CHAIN);
            FeatureList.Add(FeaturesT.SUPPORTS_REALTIME_STOCK_QUOTE);
            FeatureList.Add(FeaturesT.SUPPORTS_STOCK_HISTORICAL_DATA);
            FeatureList.Add(FeaturesT.SUPPORTS_OPTIONS_HISTORICAL_DATA);
            FeatureList.Add(FeaturesT.SUPPORTS_HISTORICAL_VOLATILITY);
            FeatureList.Add(FeaturesT.SUPPORTS_INTEREST_RATE);

            // update server list
            ServerList.Add(Name);
            _B3Poviderconfig = new B3ProviderConfig();
            _B3PoviderClient = new B3ProviderClient(_B3Poviderconfig);
        }
        public void B3ProviderMustSectorClassification()
        {
            var config = new B3ProviderConfig();

            // define properties
            config.ReplaceExistingFiles = true;

            // create an instance of the client
            var client = new B3ProviderClient(config);

            // load all instruments into memory
            client.LoadSectorClassification();

            Assert.IsNotNull(client.SectorClassification);
            Assert.AreNotEqual(0, client.SectorClassification.Count);
        }
        public void B3ProviderShouldCalculateChange()
        {
            var config = new B3ProviderConfig();

            // define properties
            config.ReplaceExistingFiles = true;

            // create an instance of the client
            var client = new B3ProviderClient(config);

            client.LoadInstruments();
            //client.LoadInstruments();
            client.LoadHistoricQuotes(2019);
            client.LoadHistoricQuotes(2018);

            client.CalculateHistoricChanges();
        }