SHOW:
|
|
- or go back to the newest paste.
| 1 | # From https://pastebin.com/h0h7LcSk | |
| 2 | ||
| 3 | url = 'https://dayminer.herokuapp.com/' | |
| 4 | browser = webdriver.Chrome() | |
| 5 | browser.get(url) | |
| 6 | ||
| 7 | try: | |
| 8 | myElem = WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.XPATH, '/html/body/div[2]/div[1]/div/div[11]'))) | |
| 9 | print("Page is ready!")
| |
| 10 | except TimeoutException: | |
| 11 | print("Loading took too much time!")
| |
| 12 | ||
| 13 | ## limit portfolio to only WSB subreddit | |
| 14 | setting_ids = ["investing-check", "pennystocks-check", "robinhood-check", | |
| 15 | "daytrading-check", "stocks-check", "options-check", "thewallstreet-check", | |
| 16 | "stockmarket-check", "securityanalysis-check"] | |
| 17 | for setting in setting_ids: | |
| 18 | print(setting) | |
| 19 | browser.execute_script("document.getElementById('" + setting + "').checked = false")
| |
| 20 | browser.execute_script("changeSubs()")
| |
| 21 | time.sleep(1) | |
| 22 | ||
| 23 | tickers = browser.find_elements_by_class_name('symbol-col')
| |
| 24 | scores = browser.find_elements_by_class_name('count-col')
| |
| 25 | prices = browser.find_elements_by_class_name('price-col') ## new
| |
| 26 | raw_port = [] | |
| 27 | ||
| 28 | NOW = datetime.now().strftime("%d/%m/%Y %H:%M")
| |
| 29 | print("Getting prices, time : " + NOW)
| |
| 30 | ||
| 31 | for i in range(len(tickers)-2): | |
| 32 | stonk = {
| |
| 33 | "ticker": tickers[i+1].text, | |
| 34 | "score": int(scores[i+1].text), | |
| 35 | "pop": 0, | |
| 36 | "shares": 0, | |
| 37 | "price": float(prices[i+1].text[1:]) ## new | |
| 38 | } | |
| 39 | raw_port.append(stonk) | |
| 40 | ||
| 41 |