Skip to main content

Simple scraper for morningstar.co.uk

Project description

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

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

functions

morningscraper.search(ref, verbose=False)

Search morningstar.co.uk for ref

If ref is found and is a fund or stock return details

Args:

ref (str): search term can be ISIN or search term

verbose (bool): provide output

Returns:

list of dicts: containing info

dict for stock:
    {
        'name': (str) name of stock
        'url': (str) url for stock info
        'type': (str) 'Stock'
        'ticker': (str) ticker name
        'currency': (str) currency code of stock
    }

dict for fund:
    {
        'name': (str) name of fund
        'url': (str) url for fund info
        'type': (str) 'Fund'
        'ISIN': (str) ISIN of fund
    }

morningscraper.get_data(ref, verbose=False)

Search morningstar.co.uk for ref

If ref is found return details for each fund/stock

Args:

ref (str): search term can be ISIN or search term

verbose (bool): provide output

Returns:

list of dicts: containing 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
}, ...]

morningscraper.get_url(url, verbose=False)

open morningstar.co.uk url and return details

Args:

url (str): url to parse

verbose (bool): provide output

Returns:

dict: containing 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
}

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for MorningScraper, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size MorningScraper-0.1-py2.py3-none-any.whl (8.0 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size MorningScraper-0.1.tar.gz (4.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page