Noob_The_ Jacky
Member
- Joined
- Dec 21, 2020
- Messages
- 14
- Programming Experience
- Beginner
Here is the thing. What I want is to print out the time, price , change, Premium , and the Nprice(price in real) at the same row. Like :
10:13:16 Price:10300 change: +100 Premium : +5 Nprice: 10295
but if I try to put all in a row, some of data would disappear:
The output would like:
下午 06:26:54
10,439 <-------------even I separate the data, I lost the string this time
NChange: -51.99 (0.50%)
Premium: 高水 8
NPrice: 10,430.53
---------------------------------------------------
Nchange: -51.99 (0.50%) Premium: 高水 8 Nprice: 10,430.53 <-------Time and Price is missing
I want to repeatedly execute the program and update the data periodically.So would be better if I can able to see all on a single row.
Seeking Help
10:13:16 Price:10300 change: +100 Premium : +5 Nprice: 10295
but if I try to put all in a row, some of data would disappear:
Console.Write() missing out some string /variance:
WebClient httpins = new WebClient();
httpins.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0");
httpins.Headers.Add("Method", "GET");
DateTime now = DateTime.Now;
Stream resp = httpins.OpenRead(http);
StreamReader resstring = new StreamReader(resp);
string s = resstring.ReadToEnd();
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(s);
resstring.Close();
HtmlNode pricenode = doc.DocumentNode.SelectSingleNode("html/body/form/div[4]/div/div[4]/div[5]/table/tr/td/div[4]");
HtmlNode pricenow = doc.DocumentNode.SelectSingleNode("html/body/form/div[4]/div/div[4]/div[5]/table/tr[7]/td/div[5]");
HtmlNode change = doc.DocumentNode.SelectSingleNode("html/body/form/div[4]/div/div[4]/div[5]/table/tr[7]/td/div[7]");
HtmlNode premium = doc.DocumentNode.SelectSingleNode("html/body/form/div[4]/div/div[4]/div[5]/table/tr/td[3]/div[4]/span");
Console.WriteLine(now.ToString("T"));
Console.WriteLine($"Price: {pricenode.InnerText}");
Console.WriteLine($"NChange: {change.InnerText}");
Console.WriteLine($"Premium: {premium.InnerText}");
Console.WriteLine($"NPrice: {pricenow.InnerText}");
Console.WriteLine("---------------------------------------------------");//down there is what i want
Console.Write(now.ToString("T") + $"Price: {pricenode.InnerText} Nchange: {change.InnerText} Premium: {premium.InnerText} Nprice: {pricenow.InnerText}");
The output would like:
下午 06:26:54
10,439 <-------------even I separate the data, I lost the string this time
NChange: -51.99 (0.50%)
Premium: 高水 8
NPrice: 10,430.53
---------------------------------------------------
Nchange: -51.99 (0.50%) Premium: 高水 8 Nprice: 10,430.53 <-------Time and Price is missing
I want to repeatedly execute the program and update the data periodically.So would be better if I can able to see all on a single row.
Seeking Help