I need to parse the table data from the website "https://www.cmegroup.com/clearing/operations-and-deliveries/accepted-trade-types/block-data.html#contractTypes=FUT&exchanges=XCBT,XCME&assetClassId=1,6", `
I want to get the table value like 41Q9, ZQQ9, 30 Day Federal Funds Futures, FUT, CBOT, 97.92, 3500, 09:40:05
I tried to use HtmlAgilityPack and WebClient, get the table first and then try to output those value, but somehow failed. Could anyone please help me with this? Thank you very much for your help.
The html code is something like this:
`<tr class="dataRow" id="ZQQ9_FUT_CBOT_094005">
<td width="120">41Q9</td>
<td width="120">ZQQ9</td>
<td class="colContract">30 Day Federal Funds Futures</td>
<td class="colType">FUT</td>
<td class="colExchange">CBOT</td>
<td style="text-align:right; padding-right:15px;">97.92</td>
<td style="text-align:right;padding-right:20px;">3500</td>
<td style="text-align:right;">09:40:05 CT</td>
</tr>
My code is shown as follows:
var html = @"https://www.cmegroup.com/clearing/operations-and-
deliveries/accepted-trade-types/block-
data.html#contractTypes=FUT&exchanges=XCBT,XCME&assetClassId=1,6";
HtmlWeb web = new HtmlWeb();
var doc = web.Load(html);
foreach (HtmlNode table in doc.DocumentNode.SelectNodes(".//table"))
{
foreach (HtmlNode row in table.SelectNodes("tr"))
{
foreach (HtmlNode cell in row.SelectNodes("th|td"))
{
Console.Write(cell.InnerText);
}
}
}
I want to get the table value like 41Q9, ZQQ9, 30 Day Federal Funds Futures, FUT, CBOT, 97.92, 3500, 09:40:05