Reputation: 3889
The following picture shows the page of my broker. It's stock market broker. As you can see in the picture there are 4 fields for 2 different stocks. I like to know can I write a program in my computer that reads the tables content online and do some calculation on my PC then fills the blank fields(Price and Value) then pushes Buy/Sell buttons? I mean how a human can use this site for trading, I want to leave it to my program(like stock robots. But on this stock market robots don't work).
If is it possible, how can I do that and I must search and learn what topic(s)?
Upvotes: -1
Views: 70
Reputation: 309
You can use selenium to automate it. Here is the example code which written in python
from selenium import webdriver
from bs4 import BeautifulSoup
driver = webdriver.Chrome()
url = "https://www.flipkart.com/redmi-note-6-pro-blue-64-gb/p/itmfayzxgzxwfvx6?pid=MOBFAJB4RSWTEYJJ"
driver.get(url)
zipcode = driver.find_element_by_class_name('_3X4tVa')
zipcode.send_keys('641035')
driver.find_element_by_class_name('_2aK_gu').click()
soup = BeautifulSoup(driver.page_source)
stock = soup.select('._13J5uS')
if stock:
stock = stock[0].text
print stock
driver.close()
[OP]: Currently out of stock in this area.
Upvotes: 1