Rajandran R Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

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.

 
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

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("
")

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

Rajandran R Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

How to Send Automated Orders from Tradingview to Algomojo…

This tutorial explores how to send automated orders from Tradingview using webhook method to Algomojo Trading Platform. Webhook is a unique way of communicating...
Rajandran R
2 min read

Tijori Finance – Better Fundamental Data Analysis using Alternative…

Tijori Finance a sleek design portal to access in-depth data such as market share, revenue break-up, location exposure, operational metrics shareholding & financial on...
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
53 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