Skip to content Skip to sidebar Skip to footer

Webscraping With Urllib

I am looking to get some information off the CME website Namely I want to get the Futures Yield and the Futures DV01 for the 10y Treasury Note Future. Found this little snippet on

Solution 1:

Run the script when you are done installing selenium.

from selenium import webdriver ; from bs4 import BeautifulSoup

driver = webdriver.Chrome()
driver.get("http://www.cmegroup.com/tools-information/quikstrike/treasury-analytics.html")

driver.switch_to_frame(driver.find_element_by_tag_name("iframe"))
soup = BeautifulSoup(driver.page_source, 'html.parser')
driver.quit()

table = soup.select('table.grid')[0]
list_of_rows = [[t_data.textfor t_data in item.select('th,td')]for item in table.select('tr')]for data in list_of_rows:
    print(data)

I think, this is the table [partial picture] you are after:

enter image description here

Post a Comment for "Webscraping With Urllib"