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 and Co-Creator of Algomojo (Algorithmic Trading Platform for DIY Traders)

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 and Co-Creator of Algomojo (Algorithmic Trading Platform for DIY Traders)

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

[Free Course] Mini Certification on Options Trading in Indian…

It is a long-pending request from the Marketcalls Readers This Mini-Course on Options Trading in Indian Markets gets you the basic building blocks about...
Rajandran R
1 min read

State of the Market – 20th June 2022

It's Monday morning and SGX Nifty is trading sub 15300 levels and a little bit of nervousness in the markets as the last Thursday's...
Rajandran R
1 min 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