Exemple #1
0
        public static void SaveCourers(string path = StaticData.PATH_COUR_DB)
        {
            var doc = new Excel();

            doc.FileOpen(path);
            doc.Rows.Clear();
            doc.AddRow(new[] { "id", "username", "link", "status" });
            foreach (var cour in Courier.Couriers)
            {
                doc.AddRow(cour.Peek());
            }
            doc.FileSave(path);
            lastCourDbHash = ComputeMD5Checksum(path);
        }
Exemple #2
0
        private void Get_data_Click(object sender, RoutedEventArgs e)
        {
            string temp = temp_item.Text;
            Excel  xl   = new Excel();

            if (System.IO.File.Exists("TradesTable .xlsx"))
            {
                xl.FileOpen("TradesTable .xlsx");
            }
            else
            {
                xl.AddRow("id", "price", "quantitu", "side", "timestamp");
                xl.FileSave("TradesTable .xlsx");
            }


            string url = "https://api.hitbtc.com/api/2/public/trades/" + temp + "?sort=DESC&limit=1000";

            try
            {
                HttpWebRequest  request            = (HttpWebRequest)WebRequest.Create(url);
                HttpWebResponse response           = (HttpWebResponse)request.GetResponse();
                Stream          dataStream         = response.GetResponseStream();
                StreamReader    reader             = new StreamReader(dataStream);
                string          responseFromServer = reader.ReadToEnd();
                TradesTable[]   TradesArray        = JsonConvert.DeserializeObject <TradesTable[]>(responseFromServer);
                foreach (TradesTable t in TradesArray)
                {
                    xl.AddRow(t.id, t.price, t.price, t.side, t.timestamp.ToString());
                }
                xl.FileSave("TradesTable .xlsx");

                reader.Close();


                MessageBox.Show("success!");
                response.Close();
            }
            catch (WebException у)
            {
                MessageBox.Show("Error argument!" + у);
            }
        }
Exemple #3
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (System.IO.File.Exists("TradesTable .xlsx"))
     {
         Process.Start(@"TradesTable .xlsx");
     }
     else
     {
         Excel xl = new Excel();
         xl.AddRow("id", "price", "quantitu", "side", "timestamp");
         xl.FileSave("TradesTable .xlsx");
         Process.Start(@"TradesTable .xlsx");
     }
 }