MorningScraper:

Simple scraper for morningstar.co.uk

A quick and dirty web page scraper for morningstar.co.uk.

Warning

Some stocks are updated via javascript and so the information is not available by just scraping the html.

funds are best referenced by ISIN e.g.

'GB00B54RK123' - CF Odey Opus I Acc

'LU1023728089' - Moorea Fd Euro Fixed Income IE

stocks are best referenced by name and exchange e.g.

'LLOY LSE' - Lloyds Banking Group PLC

'GOOG NASDAQ' - Google Inc Class C Capital Stock

Documentation

Documentation available at http://pythonhosted.org/MorningScraper

Installation

pip install MorningScraper

Source code

Code available at https://github.com/tobes/MorningScraper

Functions

get_data()

morningscraper.get_data(ref, verbose=False)

Search morningstar.co.uk for ref

If ref is found return details for each fund/stock

Parameters:
  • ref (str) – search term can be ISIN or search term
  • verbose (bool) – provide outpuss
Returns:

list containing dict for each found entry

[{
    'name': (str) name of the fund/stock
    'ISIN': (str) ISIN reference for the fund/stock
    'date': (Date) date of valuation
    'value': (Decimal) value of the fund/stock
    'currency': (str) currency e.g. GBP USD
    'change': (str) percent change, including %
    'type': (str) e.g. Fund Stock
    'url': (str) fully qualified url info gathered from
}, ...]

Return type:

list

get_url()

morningscraper.get_url(url, verbose=False)

open morningstar.co.uk url and return details

Parameters:
  • url (str) – url to parse
  • verbose (bool) – provide output
Returns:

list containing fund/stock info

{
    'name': (str) name of the fund/stock
    'ISIN': (str) ISIN reference for the fund/stock
    'date': (Date) date of valuation
    'value': (Decimal) value of the fund/stock
    'currency': (str) currency e.g. GBP USD
    'change': (str) percent change, including %
    'type': (str) e.g. Fund Stock
    'url': (str) fully qualified url info gathered from
}

Return type:

dict