Exemple #1
0
        public static void RegisterProviders(SettingModel settings)
        {
            Contract.Requires(settings != null);

            MarketHoursDatabase.Reset();
            MarketHoursDatabase marketHours = MarketHoursDatabase.FromDataFolder(settings.DataFolder);
            string originalJson             = JsonConvert.SerializeObject(marketHours);

            // Try to register providers to Market
            Market.Reset();
            IEnumerable <Type> providers = AppDomain.CurrentDomain.GetAssemblies()
                                           .SelectMany(s => s.GetTypes())
                                           .Where(p => typeof(IProvider).IsAssignableFrom(p) && !p.IsInterface && !p.IsAbstract);

            foreach (Type type in providers)
            {
                IProvider provider = (IProvider)Activator.CreateInstance(type) ??
                                     throw new ApplicationException($"Can not create provider {type.Name}");
                provider.Register(settings);
            }

            // Save market hours database if changed
            string json = JsonConvert.SerializeObject(marketHours);

            if (!json.Equals(originalJson, StringComparison.OrdinalIgnoreCase))
            {
                string path = Path.Combine(settings.DataFolder, "market-hours", "market-hours-database.json");
                File.WriteAllText(path, json);
            }
        }
Exemple #2
0
        public void Setup()
        {
            SymbolCache.Clear();
            MarketHoursDatabase.Reset();

            using (Py.GIL())
            {
                _module = Py.Import("Test_QuantBookHistory");
            }
        }
Exemple #3
0
        public void Setup()
        {
            // Store initial handler
            _logHandler = Log.LogHandler;

            SymbolCache.Clear();
            MarketHoursDatabase.Reset();

            using (Py.GIL())
            {
                _module = Py.Import("Test_QuantBookHistory");
            }
        }
        public void Setup()
        {
            SymbolCache.Clear();
            MarketHoursDatabase.Reset();

            // Using a date that we have data for in the repo
            _startDate = new DateTime(2014, 3, 31);
            _endDate   = new DateTime(2014, 3, 31);

            using (Py.GIL())
            {
                _module = Py.Import("Test_QuantBookHistory");
            }
        }
        public void Setup()
        {
            // Store initial handler
            _logHandler = Log.LogHandler;

            SymbolCache.Clear();
            MarketHoursDatabase.Reset();

            // Using a date that we have data for in the repo
            _startDate = new DateTime(2014, 3, 31);
            _endDate   = new DateTime(2014, 3, 31);

            // Our qb instance to test on
            _qb = new QuantBook();

            using (Py.GIL())
            {
                _module = Py.Import("Test_QuantBookHistory");
            }
        }