Rajandran R Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, USDINR and High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in)

The Beautiful Soup

40 sec read

I just want to parse an HTML page especially nseindia website containing a table and import it into a MySQL table in an automated way to make a realtime/EOD charting web application. After a search of nearly about a year unfortunately the search ends today @ Prasanna’s Blog.
[wp_ad_camp_5]

 
Beautiful Soup is a Python HTML/XML Parser i.e it pick data’s from a table which we need to make updating every minute/hour/Day with programming skills.Now web parsing is no more difficult with beatutiful soups. Iam very new to python language just need to explore more to create a wonderful and a decent web charting application.

Here is the sample python script


<pre>f = open("input_file.html","r")
g = open("outfile_file.csv,"w")
soup = BeautifulSoup(f)
t = soup.findAll('table')
for table in t:
rows = table.findAll('tr')
for tr in rows:
cols = tr.findAll('td')
for td in cols:
g.write(td.find(text=True))
g.write(",")
g.write("
")</pre>

This script parses a simple HTML table without looking for any special tags or anything. Thats the beautiful of the Soup

Rajandran R Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, USDINR and High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in)

Best Programming Languages for Traders & Investors to Learn…

Here is a list of programming languages that traders/investors may want to consider learning in the year 2023 to build their own trading indicators,...
Rajandran R
4 min read

What is Retail Digital Rupee?

The retail digital rupee will be introduced on December 1 as part of a pilot programme, the Reserve Bank of India (RBI) stated in...
Rajandran R
1 min read

TradersKart – One Stop Shop for Traders

TradersKart offers One-Stop E-commerce Solution for all the traders, where traders will get access to their trading needs. Traderskart provides the necessary tools required...
Rajandran R
56 sec read

3 Replies to “The Beautiful Soup”

  1. Ever heard of WebQL. Try that it might help, you might then take te output from WebQL do a bit of clean up and put it into MySQ. I guess iMacro is also something similar.

    1. @Daemonkane

      Thanks for the input sujith. It looks WebQL could also aggregates data from Web, PDF and Word documents, spreadsheets, email repositories, corporate data stores

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More