<commit_before>﻿/*
 * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
 * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
*/

using System;
using System.IO;
using System.IO.Compression;
using System.Net;
using QuantConnect.ToolBox;

namespace QuantConnect.GoogleDownloader
{
    class Program
    {
        /// <summary>
        /// QuantConnect Google Downloader For LEAN Algorithmic Trading Engine.
        /// Original by @chrisdk2015, tidied by @jaredbroad
        /// </summary>
        public static void Main(string[] args)
        {
            //q=SYMBOL
            //i=resolution in seconds
            //p=period in days
            // Strangely Google forces CHLO format instead of normal OHLC.
            const string urlPrototype = @"http://www.google.com/finance/getprices?q={0}&i={1}&p={2}d&f=d,c,h,l,o,v";

            //if (args.Length != 3)
            //{
            //    Console.WriteLine("Usage: GoogleDownloader SYMBOL RESOLUTION PERIOD");
            //    Console.WriteLine("SYMBOL = eg SPY");
            //    Console.WriteLine("RESOLUTION = 60 for minute intraday data");
            //    Console.WriteLine("PERIOD = 10 for 10 days intraday data");
            //    Environment.Exit(1);
            //}
            var symbol = "SPY"; //args[0];
            var resolution = 60; //args[1];
            var period = 1; //args[2];
            
            // Create the Google formatted URL.
            var url = string.Format(urlPrototype, symbol, resolution, period);
            Log.Trace("GoogleDownloader.Main(): Downloading " + period + " days of " + resolution + "sec bars for symbol: " + symbol);

            try
            {
                //Download the data from Google.
                string[] lines;<commit_msg>Google downloader submitted by @chrisdk2015<commit_after>﻿/*
 * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
 * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
*/

using System;
using System.IO;
using System.IO.Compression;
using System.Net;
using QuantConnect.ToolBox;

namespace QuantConnect.GoogleDownloader
{
    class Program
    {
        /// <summary>
        /// QuantConnect Google Downloader For LEAN Algorithmic Trading Engine.
        /// Original by @chrisdk2015, tidied by @jaredbroad
        /// </summary>
        public static void Main(string[] args)
        {
            //q=SYMBOL
            //i=resolution in seconds
            //p=period in days
            // Strangely Google forces CHLO format instead of normal OHLC.
            const string urlPrototype = @"http://www.google.com/finance/getprices?q={0}&i={1}&p={2}d&f=d,c,h,l,o,v";

            if (args.Length != 3)
            {
                Console.WriteLine("Usage: GoogleDownloader SYMBOL RESOLUTION PERIOD");
                Console.WriteLine("SYMBOL = eg SPY");
                Console.WriteLine("RESOLUTION = 60 for minute intraday data");
                Console.WriteLine("PERIOD = 10 for 10 days intraday data");
                Environment.Exit(1);
            }
            var symbol = args[0];
            var resolution = int.Parse(args[1]);
            var period = args[2];
            
            // Create the Google formatted URL.
            var url = string.Format(urlPrototype, symbol, resolution, period);
            Log.Trace("GoogleDownloader.Main(): Downloading " + period + " days of " + resolution + "sec bars for symbol: " + symbol);

            try
            {
                //Download the data from Google.
                string[] lines;
{'fraction_non_alphanumeric': 0.10052910052910052, 'fraction_numerical': 0.013333333333333334, 'mean_word_length': 2.2259385665529012, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6801961', 'n_tokens_mistral': 1279, 'n_tokens_neox': 1208, 'n_words': 430}