Beispiel #1
0
        /// <summary>
        /// QuantConnect Google Downloader For LEAN Algorithmic Trading Engine.
        /// Original by @chrisdk2015, tidied by @jaredbroad
        /// </summary>
        public static void Main(string[] args)
        {
            if (args.Length != 3)
            {
                Console.WriteLine("Usage: GoogleDownloader SYMBOL RESOLUTION PERIOD");
                Console.WriteLine("SYMBOL = eg SPY");
                Console.WriteLine("RESOLUTION = Minute/Hour");
                Console.WriteLine("PERIOD = 10 for 10 days intraday data");
                Environment.Exit(1);
            }

            try
            {
                // Load settings from command line
                var symbol = args[0];
                var resolution = (Resolution)Enum.Parse(typeof(Resolution), args[1]);
                var period = args[2].ToInt32();

                // Load settings from config.json
                var dataDirectory = Config.Get("data-directory", "../../../Data");

                // Download the data
                var downloader = new GoogleDataDownloader();
                var data = downloader.Get(new Symbol(symbol), SecurityType.Equity, resolution, DateTime.UtcNow.AddDays(-period), DateTime.UtcNow);

                // Save the data
                var writer = new LeanDataWriter(SecurityType.Equity, resolution, symbol, dataDirectory, "usa");
                writer.Write(data);
            }
            catch (Exception err)
            {
                Log.Error("GoogleDownloader(): Error: " + err.Message);
            }
        }
Beispiel #2
0
        /// <summary>
        /// QuantConnect Google Downloader For LEAN Algorithmic Trading Engine.
        /// Original by @chrisdk2015, tidied by @jaredbroad
        /// </summary>
        public static void Main(string[] args)
        {
            if (args.Length != 3)
            {
                Console.WriteLine("Usage: GoogleDownloader SYMBOL RESOLUTION PERIOD");
                Console.WriteLine("SYMBOL = eg SPY");
                Console.WriteLine("RESOLUTION = Minute/Hour");
                Console.WriteLine("PERIOD = 10 for 10 days intraday data");
                Environment.Exit(1);
            }

            try
            {
                // Load settings from command line
                var symbol     = args[0];
                var resolution = (Resolution)Enum.Parse(typeof(Resolution), args[1]);
                var period     = args[2].ToInt32();

                // Load settings from config.json
                var dataDirectory = Config.Get("data-directory", "../../../Data");

                // Download the data
                var downloader = new GoogleDataDownloader();
                var data       = downloader.Get(new Symbol(symbol), SecurityType.Equity, resolution, DateTime.UtcNow.AddDays(-period), DateTime.UtcNow);

                // Save the data
                var writer = new LeanDataWriter(SecurityType.Equity, resolution, symbol, dataDirectory, "usa");
                writer.Write(data);
            }
            catch (Exception err)
            {
                Log.Error("GoogleDownloader(): Error: " + err.Message);
            }
        }
Beispiel #3
0
        /// <summary>
        /// QuantConnect Google Downloader For LEAN Algorithmic Trading Engine.
        /// Original by @chrisdk2015, tidied by @jaredbroad
        /// </summary>
        public static void Main(string[] args)
        {
            if (args.Length != 4)
            {
                Console.WriteLine("Usage: GoogleDownloader SYMBOLS RESOLUTION FROMDATE TODATE");
                Console.WriteLine("SYMBOLS = eg SPY,AAPL");
                Console.WriteLine("RESOLUTION = Minute/Hour");
                Console.WriteLine("FROMDATE = yyyymmdd");
                Console.WriteLine("TODATE = yyyymmdd");
                Environment.Exit(1);
            }

            try
            {
                // Load settings from command line
                var symbols = args[0].Split(',');
                var resolution = (Resolution)Enum.Parse(typeof(Resolution), args[1]);
                var startDate = DateTime.ParseExact(args[2], "yyyyMMdd", CultureInfo.InvariantCulture);
                var endDate = DateTime.ParseExact(args[3], "yyyyMMdd", CultureInfo.InvariantCulture);

                // Load settings from config.json
                var dataDirectory = Config.Get("data-directory", "../../../Data");

                // Create an instance of the downloader
                const string market = Market.USA;
                var downloader = new GoogleDataDownloader();

                foreach (var symbol in symbols)
                {
                    // Download the data
                    var sid = SecurityIdentifier.GenerateEquity(symbol, market);
                    var symbolObject = new Symbol(sid, symbol);
                    var data = downloader.Get(symbolObject, SecurityType.Equity, resolution, startDate, endDate);

                    // Save the data
                    var writer = new LeanDataWriter(SecurityType.Equity, resolution, symbolObject, dataDirectory, market);
                    writer.Write(data);
                }
            }
            catch (Exception err)
            {
                Log.Error("GoogleDownloader(): Error: " + err.Message);
            }
        }
Beispiel #4
0
        /// <summary>
        /// QuantConnect Google Downloader For LEAN Algorithmic Trading Engine.
        /// Original by @chrisdk2015, tidied by @jaredbroad
        /// </summary>
        public static void Main(string[] args)
        {
            if (args.Length != 4)
            {
                Console.WriteLine("Usage: GoogleDownloader SYMBOLS RESOLUTION FROMDATE TODATE");
                Console.WriteLine("SYMBOLS = eg SPY,AAPL");
                Console.WriteLine("RESOLUTION = Minute/Hour");
                Console.WriteLine("FROMDATE = yyyymmdd");
                Console.WriteLine("TODATE = yyyymmdd");
                Environment.Exit(1);
            }

            try
            {
                // Load settings from command line
                var symbols    = args[0].Split(',');
                var resolution = (Resolution)Enum.Parse(typeof(Resolution), args[1]);
                var startDate  = DateTime.ParseExact(args[2], "yyyyMMdd", CultureInfo.InvariantCulture);
                var endDate    = DateTime.ParseExact(args[3], "yyyyMMdd", CultureInfo.InvariantCulture);

                // Load settings from config.json
                var dataDirectory = Config.Get("data-directory", "../../../Data");

                // Create an instance of the downloader
                const string market     = Market.USA;
                var          downloader = new GoogleDataDownloader();

                foreach (var symbol in symbols)
                {
                    // Download the data
                    var sid          = SecurityIdentifier.GenerateEquity(symbol, market);
                    var symbolObject = new Symbol(sid, symbol);
                    var data         = downloader.Get(symbolObject, SecurityType.Equity, resolution, startDate, endDate);

                    // Save the data
                    var writer = new LeanDataWriter(SecurityType.Equity, resolution, symbolObject, dataDirectory, market);
                    writer.Write(data);
                }
            }
            catch (Exception err)
            {
                Log.Error("GoogleDownloader(): Error: " + err.Message);
            }
        }
Beispiel #5
0
        /// <summary>
        /// QuantConnect Google Downloader For LEAN Algorithmic Trading Engine.
        /// Original by @chrisdk2015, tidied by @jaredbroad
        /// </summary>
        public static void Main(string[] args)
        {
            //if (args.Length != 4)
            //{
            //    Console.WriteLine("Usage: GoogleDownloader SYMBOLS RESOLUTION FROMDATE TODATE");
            //    Console.WriteLine("SYMBOLS = eg SPY,AAPL");
            //    Console.WriteLine("RESOLUTION = Minute/Hour");
            //    Console.WriteLine("FROMDATE = yyyymmdd");
            //    Console.WriteLine("TODATE = yyyymmdd");
            //    Environment.Exit(1);
            //}

            try
            {
                // Load settings from command line
                var symbols    = "GARAN,AKBNK".Split(',');
                var resolution = (Resolution)Enum.Parse(typeof(Resolution), "Minute");
                var startDate  = DateTime.ParseExact("20150101", "yyyyMMdd", CultureInfo.InvariantCulture);
                var endDate    = DateTime.ParseExact("20160101", "yyyyMMdd", CultureInfo.InvariantCulture);

                // Load settings from config.json
                var dataDirectory = Config.Get("data-directory", "../../../Data");

                // Create an instance of the downloader
                const string market     = Market.USA;
                var          downloader = new GoogleDataDownloader();

                foreach (var symbol in symbols)
                {
                    // Download the data
                    var symbolObject = Symbol.Create(symbol, SecurityType.Equity, market);
                    var data         = downloader.Get(symbolObject, resolution, startDate, endDate);

                    // Save the data
                    var writer = new LeanDataWriter(resolution, symbolObject, dataDirectory);
                    writer.Write(data);
                }
            }
            catch (Exception err)
            {
                Log.Error(err);
            }
        }
Beispiel #6
0
        /// <summary>
        /// QuantConnect Google Downloader For LEAN Algorithmic Trading Engine.
        /// Original by @chrisdk2015, tidied by @jaredbroad
        /// </summary>
        public static void GoogleDownloader(IList <string> tickers, string resolution, DateTime startDate, DateTime endDate)
        {
            if (resolution.IsNullOrEmpty() || tickers.IsNullOrEmpty())
            {
                Console.WriteLine("GoogleDownloader ERROR: '--tickers=' or '--resolution=' parameter is missing");
                Console.WriteLine("--tickers=eg SPY,AAPL");
                Console.WriteLine("--resolution=Minute/Hour/Daily");
                Environment.Exit(1);
            }

            try
            {
                var castResolution = (Resolution)Enum.Parse(typeof(Resolution), resolution);

                // Load settings from config.json
                var dataDirectory = Config.Get("data-directory", "../../../Data");

                // Create an instance of the downloader
                const string market     = Market.USA;
                var          downloader = new GoogleDataDownloader();

                foreach (var ticker in tickers)
                {
                    // Download the data
                    var symbolObject = Symbol.Create(ticker, SecurityType.Equity, market);
                    var data         = downloader.Get(symbolObject, castResolution, startDate, endDate);

                    // Save the data
                    var writer = new LeanDataWriter(castResolution, symbolObject, dataDirectory);
                    writer.Write(data);
                }
            }
            catch (Exception err)
            {
                Log.Error(err);
            }
        }