Esempio n. 1
0
 /// <summary>
 /// Load all the datastreams from the JSON formatted file.
 /// </summary>
 private void btnLoadTickLists_Click(object sender, EventArgs e)
 {
     if (File.Exists(def_datapath))
     {
         ticklistholder = TickListHolder.ReadJSON(def_datapath);
         foreach (TickList t in ticklistholder.ticklists)
         {
             addToChart(t, t.name, false, chtBackTest);
         }
         refreshGridView();
     }
     else
     {
         MessageBox.Show("No data file found");
     }
 }
Esempio n. 2
0
        public static void RunTests()
        {
            bool enabled = false;

            if (enabled)
            {
                //WebProvider w = new WebProvider("", "http://query.yahooapis.com/v1/public/" +
                //"yql?q=select%20*%20from%20yahoo.finance.historicaldata%20where%20symbol%2" +
                //"0%3D%20%22AAPL%22%20and%20startDate%20%3D%20%222012-09-11%22%20and%20endD" +
                //"ate%20%3D%20%222014-02-11%22&format=json&diagnostics=true&env=store%3A%2F" +
                //"%2Fdatatables.org%2Falltableswithkeys",0);
                //w.Download();

                String         def_datapath = "data.txt";
                TickListHolder t            = TickListHolder.ReadJSON(def_datapath);
                LiveTickList   l            = new LiveTickList(new GoogleTrends(), "bitcoin", t.ticklists[1]);
                l.update();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Reads a TickListHolder from the specified file.
        /// </summary>
        /// <param name="path">Path and filename to the file
        /// that should be read</param>
        /// <returns></returns>
        public static TickListHolder ReadJSON(String path)
        {
            TextReader reader = null;

            Logger.Log("Attempting to read JSON file " + path);
            try
            {
                reader = new StreamReader(path);
                var            fileContents = reader.ReadToEnd();
                TickListHolder readlist     = JsonConvert.DeserializeObject <TickListHolder>(fileContents);
                Logger.Log("Found the following TickListHolder:");
                Logger.Log(readlist.ToString());
                return(readlist);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }