Пример #1
0
        /// <summary>
        ///     the data loader for openquant.
        /// </summary>
        /// <param name="instrument">The instrument.</param>
        /// <param name="dtfrom">The dtfrom.</param>
        /// <param name="dtto">The dtto.</param>
        /// <param name="barsize">The barsize.</param>
        /// <returns></returns>
        public static LoaderTypes OpenquantDataLoader(string instrument, DateTime dtfrom, DateTime dtto,
                                                      Data.Data.BarType bartype, long barsize)
        {
            var BarSerie = new DataArray();
            Console.WriteLine("Initialized the Openquant-Encog Loader");
            try
            {
                //	BarSerie = this.GetHistoricalBars(dtfrom, dtto, BarType.Time, barsize);
                //	BarSerie = this.GetHistoricalBars(this.MarketDataProvider,Instrument,dtfrom,dtto,(int)barsize);
                // BarSerie = DataManager.GetHistoricalBars(instrument, Data.Data.BarType.Time, 3600);

                var typeLoaded = new LoaderTypes(instrument, dtfrom, dtto, bartype, barsize);
                Console.WriteLine("Loaded Types instrument:" + typeLoaded.Instrument);
                return typeLoaded;
            }
            catch (Exception ex)
            {
                var er = new EncogError(ex);
                Console.WriteLine("Error :" + ex.Message);
                Console.WriteLine("Error :" + ex.StackTrace);
                Console.WriteLine("Error:" + ex.InnerException);
                Console.WriteLine("Full message:" + ex);
                return null;
            }
        }
Пример #2
0
        /// <summary>
        /// the data loader for openquant.
        /// </summary>
        /// <param name="instrument">The instrument.</param>
        /// <param name="dtfrom">The dtfrom.</param>
        /// <param name="dtto">The dtto.</param>
        /// <param name="barsize">The barsize.</param>
        /// <returns></returns>
        public static LoaderTypes OpenquantDataLoader(string instrument, DateTime dtfrom, DateTime dtto, Data.Data.BarType bartype, long barsize)
        {
            DataArray BarSerie = new DataArray();

            Console.WriteLine("Initialized the Openquant-Encog Loader");
            try
            {
                //	BarSerie = this.GetHistoricalBars(dtfrom, dtto, BarType.Time, barsize);
                //	BarSerie = this.GetHistoricalBars(this.MarketDataProvider,Instrument,dtfrom,dtto,(int)barsize);
                // BarSerie = DataManager.GetHistoricalBars(instrument, Data.Data.BarType.Time, 3600);

                LoaderTypes typeLoaded = new LoaderTypes(instrument, dtfrom, dtto, bartype, barsize);
                Console.WriteLine("Loaded Types instrument:" + typeLoaded.Instrument);
                return(typeLoaded);
            }
            catch (Exception ex)
            {
                EncogError er = new EncogError(ex);
                Console.WriteLine("Error :" + ex.Message);
                Console.WriteLine("Error :" + ex.StackTrace);
                Console.WriteLine("Error:" + ex.InnerException);
                Console.WriteLine("Full message:" + ex);
                return(null);
            }
        }
Пример #3
0
        public SynthData(string settingsPath = "Assets/Settings")
        {
            settings = SettingsLoader.LoadSettings(settingsPath);

            Root = settings.GetString("paths", "root");
            if (!File.GetAttributes(Root).HasFlag(FileAttributes.Directory))
            {
                throw new SettingsException("paths", "key", "root path must be a directory");
            }

            Log = new Logger(new PathList(settings.GetStrings("paths", "log"), Root).Root);

            SampleRate      = settings.GetInt("main", "sampleRate");
            DesiredLatency  = settings.GetInt("main", "desiredLatency");
            PitchWheelRange = settings.GetFloat("main", "pitchWheelChange");


            SavedBoardsPaths   = new PathList(settings.GetStrings("paths", "savedBoards"), Root);
            DefaultBoardsPaths = new PathList(settings.GetStrings("paths", "defaultBoards"), Root);
            MidiPaths          = new PathList(settings.GetStrings("paths", "midi"), Root);
            WavPaths           = new PathList(settings.GetStrings("paths", "wav"), Root);

            ModuleTypePaths = new PathList(settings.GetStrings("paths", "moduleTypes"), Root);
            OscillatorPaths = new PathList(settings.GetStrings("paths", "oscillatorTypes"), Root);
            EffectPaths     = new PathList(settings.GetStrings("paths", "effectTypes"), Root);


            ModuleTypes     = new LoaderTypes <Module>(ModuleTypePaths, "moduleType", "SynthLib");
            OscillatorTypes = new LoaderTypes <Oscillator>(OscillatorPaths, "oscillatorType", "SynthLib");
            EffectTypes     = new LoaderTypes <Effect>(EffectPaths, "effectType", "SynthLib");

            Console.WriteLine(DefaultBoardsPaths);
            var subBoards = new Dictionary <string, BoardTemplate>();

            foreach (var f in DefaultBoardsPaths.Files())
            {
                var element  = XDocument.Load(f).Root;
                var subBoard = new BoardTemplate(element, this);
                subBoards[Path.GetFileNameWithoutExtension(f)] = subBoard;
            }
            SubBoards = subBoards;
        }
Пример #4
0
        public static void LoadingWaiter(LoaderTypes loader, Task task)
        {
            switch (loader)
            {
            case LoaderTypes.Points:
                while (!task.IsCompleted)
                {
                    ClearCurrentConsoleLine();
                    for (int i = 0; i < 5; i++)
                    {
                        Thread.Sleep(500);
                        Console.Write(". ");
                    }
                }
                break;

            case LoaderTypes.Followers:
                while (!task.IsCompleted)
                {
                    GitHubAgent.ClearCurrentConsoleLine();
                    Thread.Sleep(400);
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.Write("Followers !");
                    Thread.Sleep(400);

                    Console.ForegroundColor = ConsoleColor.Gray;
                }
                break;

            case LoaderTypes.FollowerURL:
                while (!task.IsCompleted)
                {
                    GitHubAgent.ClearCurrentConsoleLine();
                    Thread.Sleep(300);
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.Write("* * * * * * * * * ");
                    Thread.Sleep(300);
                    Console.ForegroundColor = ConsoleColor.Gray;
                }
                break;

            case LoaderTypes.Repository:
                while (!task.IsCompleted)
                {
                    GitHubAgent.ClearCurrentConsoleLine();
                    Thread.Sleep(500);
                    Console.ForegroundColor = ConsoleColor.Blue;
                    Console.Write("Repozitories !");
                    Thread.Sleep(500);
                    Console.ForegroundColor = ConsoleColor.Gray;
                }
                break;

            case LoaderTypes.Followings:
                while (!task.IsCompleted)
                {
                    GitHubAgent.ClearCurrentConsoleLine();
                    Thread.Sleep(500);
                    Console.ForegroundColor = ConsoleColor.DarkGreen;
                    Console.Write("Followings !");
                    Thread.Sleep(500);
                    Console.ForegroundColor = ConsoleColor.Gray;
                }
                break;

            default:
                break;
            }
            Console.WriteLine();
        }